Saturday, December 22, 2018

Re: Is Django logging multi-process safe?

I do not  have the details in mind, but in the context of a former  Docker based deployment, we have used the ELK stack to manage the logs of the containers, by capturing the containers' stdout. Thanks to this option, it has been possible to stay with basic stream based logs.


If you are interested, I can try to retrieve the exact procedure, but I can't promise : it was for the first deployment of this app, which was hosted on Azure at that time. Since then we have moved to a Kubernetes managed solution on GCP.


BTW we have kept using stream based logs, GCP log tooling offering the appropriate tools for exploiting them.


Regards 


Eric



From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf of Dan Davis <dansmood@gmail.com>
Sent: Friday, December 21, 2018 11:00:17 PM
To: django-users@googlegroups.com
Subject: Re: Is Django logging multi-process safe?
 

Eric, thanks for confirming.  I've written my share of logrotate.d files, but I may push to do something else, like send them directly to Elasticsearch with a delay of some sort.


On Fri, Dec 21, 2018 at 2:00 PM PASCUAL Eric <eric.pascual@cstb.fr> wrote:

Hi,


If you are running on a Linux system, you'd better using the standard stream logs and logrotate to manage file rotating.


The later is the blessed tool for this kind of task, since it manages for free the compression of rotated files and removal of oldest ones if you want to.


Regards


Eric



From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf of Dan Davis <dansmood@gmail.com>
Sent: Friday, December 21, 2018 5:55:35 PM
To: Django users
Subject: Re: Is Django logging multi-process safe?
 
Looks like I should use a WatchedFileHandler and then have logrotate do the logging.   If the file pointer is moved by another process, then it will work.
Does gunicorn patch this for me?   Will I be better off using syslog or something?

On Friday, December 21, 2018 at 11:51:16 AM UTC-5, Dan Davis wrote:

I just came across this:


This suggests that log messages sent to a StreamHandler will be processed properly, but log messages sent to a standard logging.handlers.TimedRotatingFileHandler are not process safe.

What sayeth the group?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b1792c98-0373-42e6-93ac-8b0961ec83e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/1E1MuO08okk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/AM6P193MB042177E51A91076EAC03931E8CB80%40AM6P193MB0421.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFzonYY5_uOiwn7xZUSzqKA3AX6J0V8TPD%2BRRZ%2B%3DdS5OpixGcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment