根据设计,我的应用程序有时会产生重复错误,这些错误会填满日志文件并使其难以阅读.它看起来像这样:
WARNING:__main__:CRON10: clock unset or no wind update received in 60 sec -> supressed rrd update
WARNING:__main__:CRON10: clock unset or no wind update received in 60 sec -> supressed rrd update
WARNING:__main__:CRON10: clock unset or no wind update received in 60 sec -> supressed rrd update
WARNING:__main__:CRON10: clock unset or no wind update received in 60 sec -> supressed rrd update
Run Code Online (Sandbox Code Playgroud)
如何使用Python日志记录模块来抑制重复消息并输出更多rsyslog样式(http://www.rsyslog.com/doc/rsconf1_repeatedmsgreduction.html):
WARNING:__main__:CRON10: clock unset or no wind update received in 60 sec -> supressed rrd update
--- …Run Code Online (Sandbox Code Playgroud)