Tuesday, November 24, 2015

Re: Using request object in settings.py for custom logging

Hi,

Problem is that you quite certainly have different users and several processess/threads which would lead logging configuration per request.

Is there a reason you don't use something like sites framework to differentiate clients?


On 24.11.2015 12:22, Nikunj Badjatya wrote:
Hello,

Currently for our application, all django logs are generated and kept at '/var/log/django.log'
We want to have different log files for different clients. i.e.
/var/log/client-1/django.log
/var/log/client-2/django.log
/var/log/client-3/django.log
....
....

The request object has information about the logged in user (and thus client). These inturn are stored in a mysql database.

How can django log file path be modified dynamically such that when client-1 is using the application, his logs go into '/var/log/client-1/django.log' and so on for other clients ?

Using Django 1.6.11 and Python 2.7.
'LOGGING' is defined in settings.py.

Thanks.

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c7c7d27a-2804-4993-8bb9-dd9c3fb7eeab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment