concurrent-log-handler icon indicating copy to clipboard operation
concurrent-log-handler copied to clipboard

when log file rotate, raise exception

Open ShiLiGo opened this issue 2 years ago • 1 comments

[uWSGIWorker1Core0 31324 Fri Oct 27 14:01:32 2023] Unable to do rollover: 'ConcurrentRotatingFileHandler' object has no attribute 'rotation_filename': File "/usr/lib/python2.7/site-packages/web/application.py", line 279, in wsgi result = self.handle_with_processors() File "/usr/lib/python2.7/site-packages/web/application.py", line 249, in handle_with_processors return process(self.processors) File "/usr/lib/python2.7/site-packages/web/application.py", line 237, in process return p(lambda: process(processors)) File "/usr/lib/python2.7/site-packages/web/application.py", line 566, in processor return handler() File "/usr/lib/python2.7/site-packages/web/application.py", line 237, in return p(lambda: process(processors)) File "/usr/lib/python2.7/site-packages/web/application.py", line 237, in process return p(lambda: process(processors)) File "/usr/lib/python2.7/site-packages/web/application.py", line 581, in processor result = handler() File "/usr/lib/python2.7/site-packages/web/application.py", line 237, in return p(lambda: process(processors)) File "/usr/lib/python2.7/site-packages/web/application.py", line 239, in process return self.handle() File "/usr/lib/python2.7/site-packages/web/application.py", line 230, in handle return self._delegate(fn, self.fvars, args) File "/usr/lib/python2.7/site-packages/web/application.py", line 420, in _delegate return handle_class(cls) File "/usr/lib/python2.7/site-packages/web/application.py", line 396, in handle_class return tocall(*args) File "/var/www/apps/duole/webpy-duole.py", line 294, in GET g_log_test.info("invalid url:" + path + ",ip:" + web.ctx.ip) File "/usr/lib64/python2.7/logging/init.py", line 1149, in info self._log(INFO, msg, args, **kwargs) File "/usr/lib64/python2.7/logging/init.py", line 1268, in _log self.handle(record) File "/usr/lib64/python2.7/logging/init.py", line 1278, in handle self.callHandlers(record) File "/usr/lib64/python2.7/logging/init.py", line 1318, in callHandlers hdlr.handle(record) File "/usr/lib64/python2.7/logging/init.py", line 749, in handle self.emit(record) File "/usr/lib/python2.7/site-packages/concurrent_log_handler/init.py", line 387, in emit self._console_log("Unable to do rollover: %s" % (e,), stack=True) File "/usr/lib/python2.7/site-packages/concurrent_log_handler/init.py", line 356, in _console_log stack_str = ":\n" + "".join(traceback.format_stack())

my conf file [loggers] keys=root,requestlog

[handlers] keys=consoleHandler,requestlogHandler

[formatters] keys=simpleFormatter

[formatter_simpleFormatter] format=[%(asctime)s]%(lineno)d : %(message)s

[logger_root] level=DEBUG handlers=consoleHandler

[handler_consoleHandler] class=StreamHandler level=DEBUG formatter=simpleFormatter args=(sys.stdout,)

[logger_requestlog] level=DEBUG handlers=consoleHandler,requestlogHandler qualname=requestlog propagate=0

[handler_requestlogHandler] class=concurrent_log_handler.ConcurrentRotatingFileHandler level=DEBUG formatter=simpleFormatter args=('log/aaa.log', 'a', 3000, 9, None, True)

I find rotation_filename not support in Python 2.7, I remove this call and fix the bug.

ShiLiGo avatar Oct 27 '23 06:10 ShiLiGo

you are right, I changed version to 0.9.20 , now it works

lgm1989 avatar Dec 12 '23 07:12 lgm1989