Add date stamps to django (I think) logfiles?
The webserver and archive part of mailman writes some logfiles on my system with entries like:
17:19:05 [Q] INFO Process-1 guarding cluster twenty-pluto-arizona-pasta 17:19:05 [Q] INFO Process-1:4 pushing tasks at 2831 17:19:05 [Q] INFO Q Cluster twenty-pluto-arizona-pasta running.
These seem to match this format in settings.py:
'format': '%(levelname)s %(asctime)s %(process)d %(name)s %(message)s'
except that I would expect asctime to have a date attached.
A pointer to relevant documentation would be very much appreciated.
Thanks.
Ken
kjohnson@eclypse.org writes:
17:19:05 [Q] INFO Q Cluster twenty-pluto-arizona-pasta running.
That would be qcluster, which is part of Django. For a long-term fix you'll have to talk to them. If you want to hack the code it's in site-packages/django_q/conf.py at line 214 or so. It sets the date format to "%H:%M:%S". I think this is just strftime format (which varies by platform so...).
On 9/1/23 19:36, Stephen J. Turnbull wrote:
kjohnson@eclypse.org writes:
17:19:05 [Q] INFO Q Cluster twenty-pluto-arizona-pasta running.
That would be qcluster, which is part of Django. For a long-term fix you'll have to talk to them. If you want to hack the code it's in site-packages/django_q/conf.py at line 214 or so. It sets the date format to "%H:%M:%S". I think this is just strftime format (which varies by platform so...).
You can actually configure the loggers directly in settings.py, even for 3rd party packages (regardless of them being related to Django).
'LOGGING' in settings.py is basically an input to
logging.config.dictConfig()
.
If you know the name of the logger, which in this case, is "django-q", you can add it under "loggers" configuration (default one should have examples of the structure) and define the "handler" you want to use (probably "file" is what you want?).
Assuming your "file" handler (or whatever you have picked) has the right "formatter" associated, django-q will start using the
'%(levelname)s %(asctime)s %(process)d %(name)s %(message)s'
format after a restart.
-- thanks, Abhilash Raj (maxking)
participants (3)
-
Abhilash Raj
-
kjohnson@eclypse.org
-
Stephen J. Turnbull