ランタイム時にログを更新してサポートするにはexc_info
キー?exc_infoを使用したlog.exceptionエラー
例:
log.exception(e, exc_info = 1)
リターンエラー:
TypeError: exception() got an unexpected keyword argument 'exc_info'
これはPythonである2.6.6
ランタイム時にログを更新してサポートするにはexc_info
キー?exc_infoを使用したlog.exceptionエラー
例:
log.exception(e, exc_info = 1)
リターンエラー:
TypeError: exception() got an unexpected keyword argument 'exc_info'
これはPythonである2.6.6
exception
方法は、例外のロギングが望まれる例外節から呼び出されることを意味するためexc_info
を受け入れていない単一のメソッド(すなわちexc_info
が暗黙的に設定されます)。 exc_info
をFalse
に設定した場合と同じ効果を得たい場合は、exception
メソッドではなく、error
ロガーメソッドを使用してください。 the documentationから:
Logger.error(msg, *args, **kwargs)
Logs a message with level ERROR on this logger. The arguments are interpreted as for debug().
...
Logger.exception(msg, *args, **kwargs)
Logs a message with level ERROR on this logger. The arguments are interpreted as for debug(). Exception info is added to the logging message. This method should only be called from an exception handler.
使用トレースバック https://docs.python.org/2/library/traceback.html
トレースバックが例外とスタックを出力しますexceの原因となったコードを示すトレースption
import traceback
_traceback = traceback.format_exc()
print _traceback
log.exception(_traceback)