我已将日志模块配置为使用以下内容格式化日志消息:...
'formatters': {
'verbose': {
'format': '%(asctime)s [%(levelname)s] '
'(%(name)s:pid=%(process)d) %(module)s(%(lineno)d): '
'%(message)s'
},
},
...
但是,当它打印异常时,它会显示如下:
^{pr2}$
是否可以让它在格式化程序中运行每一行?E、 g.所以它会输出如下内容:2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): Catchall exception at top level.
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): Traceback (most recent call last):
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): File "build/bdist.linux-x86_64/egg/argh/dispatching.py", line 228, in dispatch_command
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): dispatch(parser, *args, **kwargs)
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): File "build/bdist.linux-x86_64/egg/argh/dispatching.py", line 124, in dispatch
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): for line in lines:
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): File "build/bdist.linux-x86_64/egg/argh/dispatching.py", line 200, in _execute_command
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): for line in result:
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): ...,
2014-02-12 14:16:20,454 [ERROR] (app:pid=1930) main(105): NameError: global name 'sftp' is not defined