Wednesday, November 25, 2015

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

Well sites framework makes possible to do for example multitenancy inside database.

But apparently that is not your case. So why you like to log something per user? What's the real usecase here?

On 25.11.2015 11:45, Nikunj Badjatya wrote:
Thank you for your response.
Well our application is single site only. AFAIK, sites framework is useful when your django application serves multiple sites.
Can you throw some more light on what can be achieved using sites ?

I would like to evaluate all available options.

Thanks.


On Tuesday, November 24, 2015 at 4:54:36 PM UTC+5:30, Jani Tiainen wrote:
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...@googlegroups.com.
To post to this group, send email to django...@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.

--
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/4e6070d9-b589-4001-b2c2-c9d3bbe8a4d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment