Re: Is Django logging multi-process safe?

2019-02-26 Thread Dan Davis
So, there are some issues in managing the files.   It is not very 12-factor 
to have the application worry about such things.

The issues with using a FileHandler or TimedRotatingFileHandler from 
multiple processes/kernel threads are less important, but still exist.  If 
a file is append-only, then write automatically does a seek to the end 
before writing, and python logging works hard to make sure this is a single 
write.   Practically, that means that a log write to a file is atomic if:

   - It's size is less than a page in the buffer cache (4k)
   - You are not using NFS as a target for logs

In the later case (NFS), the kernel *simulates* the atomic seek to the end 
and write.  So, if there are multiple writers across multiple servers, you 
are going to be screwed, but if each single server has its own file, and 
multiple processes are writing, then it is mostly going to be OK.

There may be some other potential pitfalls using rotating files, such as 
logging.handlers.TimedRotatingFileHandler.  Haven't analyzed that closely.

So, anyway, the most likely problem then is if the log entries get larger 
than 4k, which may not be very likely but is possible.

-- 
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+unsubscr...@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/ebde5694-6494-497a-8873-a43f61872711%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Django logging multi-process safe?

2018-12-22 Thread Jason
my company uses logentries for log aggregation and search, but an ELK-based 
stack is indeed a very viable option for handling logs across multiple 
servers and containers.

-- 
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+unsubscr...@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/7a49142a-ff5e-4491-88bc-cd2ab2c560bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Django logging multi-process safe?

2018-12-22 Thread PASCUAL Eric
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  on behalf 
of Dan Davis 
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 
mailto:eric.pasc...@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<mailto:django-users@googlegroups.com> 
mailto:django-users@googlegroups.com>> on behalf 
of Dan Davis mailto:dansm...@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:

https://docs.python.org/3.5/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes

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+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto: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<https://groups.google.com/d/msgid/django-users/b1792c98-0373-42e6-93ac-8b0961ec83e6%40googlegroups.com?utm_medium=email_source=footer>.
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+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto: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<https://groups.google.com/d/msgid/django-users/AM6P193MB042177E51A91076EAC03931E8CB80%40AM6P193MB0421.EURP193.PROD.OUTLOOK.COM?utm_medium=email_source=footer>.
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+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto: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<https://groups.google.com/d/msgid/django-users/CAFzonYY5_uOiwn7xZUSzqKA3AX6J0V8TPD%2BRRZ%2B%3DdS5OpixGcw%40mail.gmail.

Re: Is Django logging multi-process safe?

2018-12-21 Thread Dan Davis
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  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  on
> behalf of Dan Davis 
> *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:
>
>
> https://docs.python.org/3.5/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes
>
> 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+unsubscr...@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
> <https://groups.google.com/d/msgid/django-users/b1792c98-0373-42e6-93ac-8b0961ec83e6%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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+unsubscr...@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
> <https://groups.google.com/d/msgid/django-users/AM6P193MB042177E51A91076EAC03931E8CB80%40AM6P193MB0421.EURP193.PROD.OUTLOOK.COM?utm_medium=email_source=footer>
> .
> 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+unsubscr...@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.


Re: Is Django logging multi-process safe?

2018-12-21 Thread PASCUAL Eric
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  on behalf 
of Dan Davis 
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:

https://docs.python.org/3.5/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes

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+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto: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<https://groups.google.com/d/msgid/django-users/b1792c98-0373-42e6-93ac-8b0961ec83e6%40googlegroups.com?utm_medium=email_source=footer>.
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+unsubscr...@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.


Re: Is Django logging multi-process safe?

2018-12-21 Thread Dan Davis
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:
>
>
> https://docs.python.org/3.5/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes
>
> 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+unsubscr...@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.


Is Django logging multi-process safe?

2018-12-21 Thread Dan Davis

I just came across this:

https://docs.python.org/3.5/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes

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+unsubscr...@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/3c141b58-ac35-450d-955b-7bddad0b3052%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: use django logging from outside

2016-02-15 Thread Det S. Pillner


On Thursday, February 11, 2016 at 1:32:51 PM UTC+1, Det S. Pillner wrote:
>
>
>
> On Saturday, January 23, 2016 at 11:38:31 AM UTC+1, James Schneider wrote:
>>
>>
>> On Jan 20, 2016 2:35 AM, "Det S. Pillner" <silve...@gmail.com> wrote:
>> >
>> > Hi all,
>> >
>> > I work on a django project. I use very heavy logging in this project. 
>> Some parts of code needs to start over a cron job outside of the django 
>> project. In this - I call it modules - I try to use my existing django 
>> logging config. Code execution displays no errors bud there are no logging 
>> entries.
>> >
>> > Can somebody help to fix my problem?
>> >
>>
>> Are you bring in your entire Django environment via a django.setup() 
>> call, or are you simply trying to import the logging configuration that is 
>> being used by your Django project?
>>
>> Without some explanation of what you've tried, I don't think we have 
>> enough information to help.
>>
>> -James
>>
>
> Oh Sorry for the late answer. Holiday.
>
> Here is the content of my bash script to call one of the modules that I 
> use from outside of Django:
>
>
>   
> # django/python settings
>
> PYTHONPATH="${PYTHONPATH}:/srv/wpkg_webtools/"
> export PYTHONPATH
> export DJANGO_SETTINGS_MODULE=wpkg_webtools.settings.privat
>
> # call python part (django module)
> python /srv/wpkg_webtools/wpkg/modules/fill.py $1
>
>
> This script is called from a cron job and find.
>
> In my module I use this:
>
> import os
> import os.path
> import glob
> import sys
> import xml.etree.ElementTree as eTree
> import logging
> import logging.config
> import logging.handlers
> from time import gmtime, strftime
>
> from django.db import connection
>
> from wpkg.models.wpkg import *
>
> logger = logging.getLogger('imp')  # global logger for fill
>
>
> I does not get a error message. That means: Python can find all things. 
> And below: a part from settings.py:
>
> 'imp': {
> 'handlers': ['import'],
> 'level': 'DEBUG',
> },
>
>
> This logger is used by other parts IN django also.
>
> Thanks for your reaction. I will try django.setup() in the head of my 
> module.
>

Tested . Works great.

No I use django.setup() in __main__ section and get logger in function. 
Many 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+unsubscr...@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/108a653a-3465-4daf-8f42-8e1f92c0766d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: use django logging from outside

2016-02-11 Thread Det S. Pillner


On Saturday, January 23, 2016 at 11:38:31 AM UTC+1, James Schneider wrote:
>
>
> On Jan 20, 2016 2:35 AM, "Det S. Pillner" <silve...@gmail.com 
> > wrote:
> >
> > Hi all,
> >
> > I work on a django project. I use very heavy logging in this project. 
> Some parts of code needs to start over a cron job outside of the django 
> project. In this - I call it modules - I try to use my existing django 
> logging config. Code execution displays no errors bud there are no logging 
> entries.
> >
> > Can somebody help to fix my problem?
> >
>
> Are you bring in your entire Django environment via a django.setup() call, 
> or are you simply trying to import the logging configuration that is being 
> used by your Django project?
>
> Without some explanation of what you've tried, I don't think we have 
> enough information to help.
>
> -James
>

Oh Sorry for the late answer. Holiday.

Here is the content of my bash script to call one of the modules that I use 
from outside of Django:


  
# django/python settings

PYTHONPATH="${PYTHONPATH}:/srv/wpkg_webtools/"
export PYTHONPATH
export DJANGO_SETTINGS_MODULE=wpkg_webtools.settings.privat

# call python part (django module)
python /srv/wpkg_webtools/wpkg/modules/fill.py $1


This script is called from a cron job and find.

In my module I use this:

import os
import os.path
import glob
import sys
import xml.etree.ElementTree as eTree
import logging
import logging.config
import logging.handlers
from time import gmtime, strftime

from django.db import connection

from wpkg.models.wpkg import *

logger = logging.getLogger('imp')  # global logger for fill


I does not get a error message. That means: Python can find all things. And 
below: a part from settings.py:

'imp': {
'handlers': ['import'],
'level': 'DEBUG',
},


This logger is used by other parts IN django also.

Thanks for your reaction. I will try django.setup() in the head of my 
module.

-- 
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+unsubscr...@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/30a968e4-4464-489f-ad7d-502f3b695f44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: use django logging from outside

2016-01-23 Thread James Schneider
On Jan 20, 2016 2:35 AM, "Det S. Pillner" <silver0...@gmail.com> wrote:
>
> Hi all,
>
> I work on a django project. I use very heavy logging in this project.
Some parts of code needs to start over a cron job outside of the django
project. In this - I call it modules - I try to use my existing django
logging config. Code execution displays no errors bud there are no logging
entries.
>
> Can somebody help to fix my problem?
>

Are you bring in your entire Django environment via a django.setup() call,
or are you simply trying to import the logging configuration that is being
used by your Django project?

Without some explanation of what you've tried, I don't think we have enough
information to help.

-James

-- 
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+unsubscr...@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/CA%2Be%2BciXQyLvuAGM3LnXOCVmSZ%3DPfQy4PWr_jRbsszF%2BcMVF%3DvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


use django logging from outside

2016-01-20 Thread Det S. Pillner
Hi all,

I work on a django project. I use very heavy logging in this project. Some 
parts of code needs to start over a cron job outside of the django project. 
In this - I call it modules - I try to use my existing django logging 
config. Code execution displays no errors bud there are no logging entries.

Can somebody help to fix my problem?

-- 
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+unsubscr...@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/81b111d9-b259-4020-ae70-f5840c2d2c2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


A problem with django logging

2016-01-04 Thread 朴诚
Hi,

I encountered a django logging problem which can not be solved for several 
hours. My django logging setting is:

LOGGING = {
'version': 1,
'disable_existing_loggers': False,

'formatters': {
'standard': {
'format': '[%(asctime)s - %(name)s - %(levelname)s - 
%(filename)s:%(lineno)d] %(message)s'
},
},

'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
},

'file': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': '%s/logs/django.log' % (BASE_DIR),
'maxBytes': 1024 * 1024 * 5,
'backupCount': 5,
'formatter': 'standard',
},
},

'loggers': {
'django': {
'handlers': ['file', 'console'],
'propagate': True,
'level': 'DEBUG',
},
},
}


and in a .py file which django calls, i write:

logger = logging.getLogger('project.xxx.util')
logger.info('xxx')

I deploy django with nginx using uwsgi. When I started django, the log file 
can be created successfully, but no logs will be written to file when 
executing the py file.
Did anyone have encountered the same problem? 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+unsubscr...@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/4f5e4951-40b2-43ea-8264-8991ec731c6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Logging Send Email on Openshift

2015-04-06 Thread Steve Pousty
It's not a good idea to send emails directly from OpenShift since we are on 
AWS ip ranges. You should use a service like SendGrid or MailGun.

On Monday, April 6, 2015 at 10:31:11 AM UTC-7, Guilherme Leal wrote:
>
> Is anybody using OpenShift for Django hosting? I'm having trouble 
> configuring the Logging engine to send emails on errors and could use some 
> help.
>

-- 
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+unsubscr...@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/cc51a93f-21f9-44eb-8b9e-1d4056443591%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Logging Send Email on Openshift

2015-04-06 Thread Guilherme Leal
Is anybody using OpenShift for Django hosting? I'm having trouble
configuring the Logging engine to send emails on errors and could use some
help.

-- 
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+unsubscr...@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/CAOs3Lp6tBDdu6RCFxYJOqE5KxbFjtTS469uJUH7HoK8XbfdVyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Logging database queries

2014-03-19 Thread Venkatraman S
INSERT/UPDATE/DELETE/SELECT cover almost all types that will be used. What
else is getting logged?

And what do you mean by 'FAILED' Select queries? Do you mean Timed-out ones?



On Thu, Mar 13, 2014 at 12:32 PM, Anju SB  wrote:

> Dear All,
>
> I am a newbie in Django programming and developing a web application
> using django 1.3 and postgresql.  I want to log insert, update, delete and
> failed select queries in my daily log file.  I configured  
> 'django.db.backends'
> in the logger of the Logging dict in Settings.py.   But I get all the
> queries in that application. I need only insert, update, delete and failed
> select queries.
>
> Please help me to move on
>
> Thanking you
> Anju
>
>  --
> 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+unsubscr...@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/f5d6457e-9b23-4395-86c0-89f673689d46%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+unsubscr...@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/CAN7tdFQ-A%2BhU6%3DRmzDy5Mje4ErpeXmrJ1z9m4Fn4nMjeZTo0Zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Logging database queries

2014-03-13 Thread Anju SB
Dear All,

I am a newbie in Django programming and developing a web application using 
django 1.3 and postgresql.  I want to log insert, update, delete and failed 
select queries in my daily log file.  I configured  'django.db.backends' in 
the logger of the Logging dict in Settings.py.   But I get all the queries 
in that application. I need only insert, update, delete and failed select 
queries. 

Please help me to move on 

Thanking you 
Anju 

-- 
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+unsubscr...@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/f5d6457e-9b23-4395-86c0-89f673689d46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


TimedThrottleFilter: Django logging filter to throttle logging

2011-10-05 Thread Michael Manfre
I recently encountered the problem of underlying IO issues triggering gigs
of repeated logs that were compounded by the extra logging. To help improve
the signal to noise ratio of the logs and prevent the downward spiral of IO
issues causing logging that cause more IO issues, I created a logging filter
to help reduce the repeated messages.

The basic design of the filter is to classify each message based upon a few
configurable criteria and then only allow a configurable number of repeated
messages in a given interval. The cache is used to track the frequency.

There were three specific logging cases I addressed with my approach. System
wide issues, a single point of failure, and user specific issues. The user
specific issues are mostly to address our GSA and other internal crawlers.
To catch system wide issues, logging messages are grouped by exception type
and repr(), if type is Exception. Single point of failure really means a
single logging call in the code. These are detected by logger name, function
name and line number. The filter can be configured (in settings) to ignore
specific logging statements to allow uncaught or common exception handlers
from being incorrectly grouped together. Specific user logging messages are
grouped if the filter can access the request.

Code and example LOGGING configuration can be found at
https://gist.github.com/1264432

Regards,
Michael Manfre

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Weird behaviour in Django logging (Django 1.3 RC)

2011-03-09 Thread Edwin
I've had help from SO:
http://stackoverflow.com/questions/5249265/strange-behaviour-in-django-logging-django-1-3-rc/5250829#5250829

The solution is simply to explicitly call self.format(record) on my
emit() method under DatabaseHandler.

Hope this helps whoever face a similar problem.


-Edwin

On Mar 7, 8:58 am, Edwin <edwinja...@gmail.com> wrote:
> Sorry I wasn't clear enough. Here's the stack trace:
>
> Traceback:
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py" in get_response
>   89.                     response = middleware_method(request)
> File "/home/user/projects/django/../django/common/middleware.py" in
> process_request
>   27.             return login(request, **defaults)
> File "/usr/local/lib/python2.6/dist-packages/django/utils/
> decorators.py" in _wrapped_view
>   93.                     response = view_func(request, *args,
> **kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   79.         response = view_func(request, *args, **kwargs)
> File "/home/user/projects/django/../django/apps/django_extra_auth/
> views.py" in login
>   57.             auth_login(request, form.get_user())
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
> __init__.py" in login
>   85.     user_logged_in.send(sender=user.__class__, request=request,
> user=user)
> File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
> dispatcher.py" in send
>   172.             response = receiver(signal=self, sender=sender,
> **named)
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
> models.py" in update_last_login
>   50.     user.save()
> File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
> in save
>   460.         self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
> in save_base
>   570.                 created=(not record_exists), raw=raw,
> using=using)
> File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
> dispatcher.py" in send
>   172.             response = receiver(signal=self, sender=sender,
> **named)
> File "/home/user/projects/django/apps/history/audit.py" in
> post_save_handler
>   102.             logging.log_to_db(logging.INFO, msg, log_type)
> File "/home/user/projects/django/apps/history/__init__.py" in
> log_to_db
>   61.         db_logger.log(level, msg, extra=extras)
> File "/usr/lib/python2.6/logging/__init__.py" in log
>   1119.             self._log(level, msg, args, **kwargs)
> File "/usr/lib/python2.6/logging/__init__.py" in _log
>   1173.         self.handle(record)
> File "/usr/lib/python2.6/logging/__init__.py" in handle
>   1183.             self.callHandlers(record)
> File "/usr/lib/python2.6/logging/__init__.py" in callHandlers
>   1220.                     hdlr.handle(record)
> File "/usr/lib/python2.6/logging/__init__.py" in handle
>   679.                 self.emit(record)
> File "/home/user/projects/django/apps/history/handlers.py" in emit
>   11.         timestamp = datetime.strptime(record.asctime,
> settings.LOG_DATE_FORMAT)
>
> Also, I have a wrapper to call db_logger, which you can see from the
> stacktrace:
>     def log_to_db(self, level, msg, log_type, extra={}):
>         db_logger = logging.getLogger('db_logger')
>         extras = {
>             'category': log_type.category.name,
>             'sub_category': log_type.sub_category.name,
>             'type_id': log_type.type_id,
>         }
>         extras.update(extra)
>         db_logger.log(level, msg, extra=extras)
>
> My DB Handler looks like this:
>
> class DatabaseHandler(logging.Handler):
>     def emit(self, record):
>         user = getattr(record, 'user', None)
>         category = getattr(record, 'category', None)
>         sub_category = getattr(record, 'sub_category', None)
>         type_id = getattr(record, 'type_id', None)
>         timestamp = datetime.strptime(record.asctime,
> settings.LOG_DATE_FORMAT)
>         from history.models import LogRecord
>         LogRecord.objects.create(timestamp=timestamp,
> level=record.levelname,
>             category=category, sub_category=sub_category,
> type_id=type_id,
>             message=record.message, user=user)
>
> Thanks again.
>
> On Mar 5, 10:59 pm, Russell Keith-Magee <russ...@keith-magee.com>
> wrote:
>
> > On Sat, Mar 5, 2011 at 10:41 AM, Edwin <edwinja...@gmail.com> wr

Re: Weird behaviour in Django logging (Django 1.3 RC)

2011-03-07 Thread Edwin
Sorry I wasn't clear enough. Here's the stack trace:

Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  89. response = middleware_method(request)
File "/home/user/projects/django/../django/common/middleware.py" in
process_request
  27. return login(request, **defaults)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  93. response = view_func(request, *args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  79. response = view_func(request, *args, **kwargs)
File "/home/user/projects/django/../django/apps/django_extra_auth/
views.py" in login
  57. auth_login(request, form.get_user())
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
__init__.py" in login
  85. user_logged_in.send(sender=user.__class__, request=request,
user=user)
File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
dispatcher.py" in send
  172. response = receiver(signal=self, sender=sender,
**named)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
models.py" in update_last_login
  50. user.save()
File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
in save
  460. self.save_base(using=using, force_insert=force_insert,
force_update=force_update)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
in save_base
  570. created=(not record_exists), raw=raw,
using=using)
File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
dispatcher.py" in send
  172. response = receiver(signal=self, sender=sender,
**named)
File "/home/user/projects/django/apps/history/audit.py" in
post_save_handler
  102. logging.log_to_db(logging.INFO, msg, log_type)
File "/home/user/projects/django/apps/history/__init__.py" in
log_to_db
  61. db_logger.log(level, msg, extra=extras)
File "/usr/lib/python2.6/logging/__init__.py" in log
  1119. self._log(level, msg, args, **kwargs)
File "/usr/lib/python2.6/logging/__init__.py" in _log
  1173. self.handle(record)
File "/usr/lib/python2.6/logging/__init__.py" in handle
  1183. self.callHandlers(record)
File "/usr/lib/python2.6/logging/__init__.py" in callHandlers
  1220. hdlr.handle(record)
File "/usr/lib/python2.6/logging/__init__.py" in handle
  679. self.emit(record)
File "/home/user/projects/django/apps/history/handlers.py" in emit
  11. timestamp = datetime.strptime(record.asctime,
settings.LOG_DATE_FORMAT)


Also, I have a wrapper to call db_logger, which you can see from the
stacktrace:
def log_to_db(self, level, msg, log_type, extra={}):
db_logger = logging.getLogger('db_logger')
extras = {
'category': log_type.category.name,
'sub_category': log_type.sub_category.name,
'type_id': log_type.type_id,
}
extras.update(extra)
db_logger.log(level, msg, extra=extras)


My DB Handler looks like this:

class DatabaseHandler(logging.Handler):
def emit(self, record):
user = getattr(record, 'user', None)
category = getattr(record, 'category', None)
sub_category = getattr(record, 'sub_category', None)
type_id = getattr(record, 'type_id', None)
timestamp = datetime.strptime(record.asctime,
settings.LOG_DATE_FORMAT)
from history.models import LogRecord
LogRecord.objects.create(timestamp=timestamp,
level=record.levelname,
category=category, sub_category=sub_category,
type_id=type_id,
message=record.message, user=user)


Thanks again.

On Mar 5, 10:59 pm, Russell Keith-Magee 
wrote:
> On Sat, Mar 5, 2011 at 10:41 AM, Edwin  wrote:
> > I'm getting a strange behaviour when setting up logging. Here's my
> > logging configuration:
>
> > LOGGING =
> > {
> >    'version': 1,
> >    'disable_existing_loggers': True,
> >    'formatters': {
> >        'admin_configuration': {
> >            'format': '%(asctime)s %(levelname)s %(category)s %
> > (sub_category)s %(type_id)s %(message)s',
> >            'datefmt': LOG_DATE_FORMAT,
> >        },
> >    },
> >    'handlers': {
> >        'admin_console': {
> >            'level':'DEBUG',
> >            'class':'logging.StreamHandler',
> >            'formatter': 'admin_configuration'
> >        },
> >        'db': {
> >            'level':'DEBUG',
> >            'class':'apps.history.handlers.DatabaseHandler',
> >            'formatter': 'admin_configuration'
> >        },
> >    },
> >    'loggers': {
> >        'db_logger': {
> >            'handlers': [ 'admin_console', 'db' ],
> >            'level': 'DEBUG',
> >            'propagate': False,
> >        },
> >    }
> > }
>
> > I then created a Database log handler and the 

Re: Weird behaviour in Django logging (Django 1.3 RC)

2011-03-05 Thread Russell Keith-Magee
On Sat, Mar 5, 2011 at 10:41 AM, Edwin  wrote:
> I'm getting a strange behaviour when setting up logging. Here's my
> logging configuration:
>
> LOGGING =
> {
>    'version': 1,
>    'disable_existing_loggers': True,
>    'formatters': {
>        'admin_configuration': {
>            'format': '%(asctime)s %(levelname)s %(category)s %
> (sub_category)s %(type_id)s %(message)s',
>            'datefmt': LOG_DATE_FORMAT,
>        },
>    },
>    'handlers': {
>        'admin_console': {
>            'level':'DEBUG',
>            'class':'logging.StreamHandler',
>            'formatter': 'admin_configuration'
>        },
>        'db': {
>            'level':'DEBUG',
>            'class':'apps.history.handlers.DatabaseHandler',
>            'formatter': 'admin_configuration'
>        },
>    },
>    'loggers': {
>        'db_logger': {
>            'handlers': [ 'admin_console', 'db' ],
>            'level': 'DEBUG',
>            'propagate': False,
>        },
>    }
> }
>
> I then created a Database log handler and the log record will be
> created using signals (e.g. on model save/delete) because I'm trying
> to keep track of model changes.  As you can see from my config, the
> logger has 2 handlers, 1 for DB and 1 for stdout (stream handler).
>
> I use the logger this way:
>
> logging.getLogger('db_logger').log(level, msg, extra=extras)
>
> where extras are extra attributes I'm passing to the logger.
>
> Now the weird thing is, when I change the order of 'handlers'
> definition under 'db_logger' to ['db', 'admin_console'], the logger
> raises this error:
> LogRecord instance has no attribute 'asctime'
>
> After checking the record instance, 'message' attribute is generated
> either, but all of my extra attributes are there.
> The same error happens if I remove 'admin_console' handler. The only
> way I can get the logger to work is that the handler must be in the
> original order:  'handlers': [ 'admin_console', 'db' ]
>
>
> Any idea why this is happening??

It's difficult to say. If I had to guess, I'd say there was something
unusual about your db logger. However, without seeing explicit stack
traces or sample code, that's about the best I can offer.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Weird behaviour in Django logging (Django 1.3 RC)

2011-03-04 Thread Edwin
I'm getting a strange behaviour when setting up logging. Here's my
logging configuration:

LOGGING =
{
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'admin_configuration': {
'format': '%(asctime)s %(levelname)s %(category)s %
(sub_category)s %(type_id)s %(message)s',
'datefmt': LOG_DATE_FORMAT,
},
},
'handlers': {
'admin_console': {
'level':'DEBUG',
'class':'logging.StreamHandler',
'formatter': 'admin_configuration'
},
'db': {
'level':'DEBUG',
'class':'apps.history.handlers.DatabaseHandler',
'formatter': 'admin_configuration'
},
},
'loggers': {
'db_logger': {
'handlers': [ 'admin_console', 'db' ],
'level': 'DEBUG',
'propagate': False,
},
}
}

I then created a Database log handler and the log record will be
created using signals (e.g. on model save/delete) because I'm trying
to keep track of model changes.  As you can see from my config, the
logger has 2 handlers, 1 for DB and 1 for stdout (stream handler).

I use the logger this way:

logging.getLogger('db_logger').log(level, msg, extra=extras)

where extras are extra attributes I'm passing to the logger.

Now the weird thing is, when I change the order of 'handlers'
definition under 'db_logger' to ['db', 'admin_console'], the logger
raises this error:
LogRecord instance has no attribute 'asctime'

After checking the record instance, 'message' attribute is generated
either, but all of my extra attributes are there.
The same error happens if I remove 'admin_console' handler. The only
way I can get the logger to work is that the handler must be in the
original order:  'handlers': [ 'admin_console', 'db' ]


Any idea why this is happening??


THanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django logging database changes

2010-10-10 Thread David
Hello

I have a very simple app that I am writing that simply stores form
data to a database. I can then scroll through and edit data stored in
the database.

I was wondering if there is a built in function that would enable me
to log all data update/changes like the django admin history log does.
I didn't want to start work on it, and then find something already
existed.

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django logging

2010-06-23 Thread Andy McKay

On 2010-06-23, at 8:48 AM, thusjanthan wrote:
> I am creating a new django framework and figured django would come
> with its own logging feature. I found this one that Fraser wrote but
> is no longer in development (http://code.google.com/p/django-logging/
> wiki/Overview) Can anyone suggest me a django logging project to log
> debug/error messages at server level and as a bonus feature perhaps an
> email to admin if a critical error happens.

Give Arecibo a look. 

http://www.areciboapp.com/
http://www.areciboapp.com/docs/client/django.html
http://www.agmweb.ca/blog/andy/2268/

etc...

Cheers
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django logging

2010-06-23 Thread Russell Keith-Magee
On Thu, Jun 24, 2010 at 1:07 AM, David De La Harpe Golden
<david.delaharpe.gol...@ichec.ie> wrote:
> On 23/06/10 16:48, thusjanthan wrote:
>>
>> Hi,
>>
>> I am creating a new django framework and figured django would come
>> with its own logging feature. I found this one that Fraser wrote but
>> is no longer in development (http://code.google.com/p/django-logging/
>> wiki/Overview)
>
> That's wasn't really for logging in the operational server system logs
> sense, it was for showing log messages arising in the request-response cycle
> in the html returned to the browser (which IS very handy during
> development/debug, but not something you'd do on a production server...).
>
> django-debug-toolbar has a superset of its functionality.
>
>>  Can anyone suggest me a django logging project to log
>> debug/error messages at server level and as a bonus feature perhaps an
>> email to admin if a critical error happens.
>>
>
> Python itself ships with a logging infrastructure (quite the baroque one),
> module "logging".  You can just use that in conjunction with django.
>
> http://docs.python.org/release/2.6/library/logging.html
>
> regarding email:  Django does fire off certain exception emails when
> disaster strikes, python logging has SMTPHandler, and there's also the
> "logwatch" tool once you have stuff going to logs.

I would also add that adding support for logging is one of the high
priority items for Django 1.3 [1]. The design is mostly sorted at this
point, and a preliminary implementation is available at [2]

[1] http://code.djangoproject.com/tickets/12012
[2] https://code.launchpad.net/~vinay-sajip/django/logging

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django logging

2010-06-23 Thread David De La Harpe Golden

On 23/06/10 16:48, thusjanthan wrote:

Hi,

I am creating a new django framework and figured django would come
with its own logging feature. I found this one that Fraser wrote but
is no longer in development (http://code.google.com/p/django-logging/
wiki/Overview)


That's wasn't really for logging in the operational server system logs 
sense, it was for showing log messages arising in the request-response 
cycle in the html returned to the browser (which IS very handy during 
development/debug, but not something you'd do on a production server...).


django-debug-toolbar has a superset of its functionality.


 Can anyone suggest me a django logging project to log
debug/error messages at server level and as a bonus feature perhaps an
email to admin if a critical error happens.



Python itself ships with a logging infrastructure (quite the baroque 
one), module "logging".  You can just use that in conjunction with django.


http://docs.python.org/release/2.6/library/logging.html

regarding email:  Django does fire off certain exception emails when 
disaster strikes, python logging has SMTPHandler, and there's also the 
"logwatch" tool once you have stuff going to logs.


###

So, most of our django app's python files do something like the 
following near the top:


# say for the models.py in a django app "accounts"
import logging
_log = logging.getLogger('accounts.models')

# and then use

_log.error("ohno")
_log.warning("grr")
_log.info("hey")
_log.debug("soturnsout")


We use the leading underscore on the module-level _log so that A doesn't 
pick up B's logger if A does a "from B import *" !


###

We then init python's logging in a vaguely django-project-useful fashion 
in a function called from our settings.py or somewhere similarly early 
(you may need to take steps to make sure to only register the handlers 
once per process, say a global "configured" var)


e.g. (not precisely the code we use, untested):

# prefix is just a per-project prefix we set, that way two
# instances of the same app in two different projects are
# distinguishable in combined logging.

# root logger for argument's sake
# you might want something else, see logging docs
rl = logging.getLogger('')

# Stuff you send to stderr with mod_wsgi does end up in the apache log,
# though maybe it's not the best option.

streamformatter = logging.Formatter("django[%(process)d]: %(levelname)s: 
[" + prefix + "]%(name)s: %(message)s")

streamhandler = logging.StreamHandler() # defaults to stderr
streamhandler.setLevel(logging.WARNING)
streamhandler.setFormatter(streamformatter)
rl.addHandler(streamhandler)

# and/or you could send to syslog

slformatter = logging.Formatter("django[%(process)d]: %(levelname)s: [" 
+ prefix + "]%(name)s: %(message)s")


sysloghandler = logging.handlers.SysLogHandler(
address='/dev/log', 
facility=logging.handlers.SysLogHandler.LOG_DAEMON)


sysloghandler.setLevel(logging.WARNING)
sysloghandler.setFormatter(slformatter)
rl.addHandler(sysloghandler)


# And/or to a file
# N.B. python 2.5 lacks WatchedFileHandler, but it's an easy backport
# from 2.6 sources.

# base some base file path+name

fformatter = logging.Formatter("[%(asctime)s] django[%(process)d]: 
%(levelname)s: [" + prefix + "]%(name)s: %(message)s")

h = WatchedFileHandler(base + ".log", encoding='utf-8')
h.setLevel(logging.INFO)
h.setFormatter(fformatter)
rl.addHandler(h)
e = WatchedFileHandler(base + ".err", encoding='utf-8')
e.setLevel(logging.ERROR)
e.setFormatter(fformatter)
rl.addHandler(e)

if settings.DEBUG:
debugformatter = logging.Formatter("[%(asctime)s] 
django[%(process)d]: %(levelname)s: [" + prefix + "]%(name)s: 
%(pathname)s(%(lineno)d): %(message)s")

d = WatchedFileHandler(base + ".dbg", encoding='utf-8')
d.setLevel(logging.DEBUG)
d.setFormatter(debugformatter)
rl.addHandler(d)


# See logging docs for more.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django logging

2010-06-23 Thread thusjanthan
Hi,

I am creating a new django framework and figured django would come
with its own logging feature. I found this one that Fraser wrote but
is no longer in development (http://code.google.com/p/django-logging/
wiki/Overview) Can anyone suggest me a django logging project to log
debug/error messages at server level and as a bonus feature perhaps an
email to admin if a critical error happens.

Cheers,
Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django-logging in production mode

2009-09-09 Thread eli

Hi,

It's a good idea to logging errors, notices etc using python module
logging in app under production mode (Nginx)?

I know about for ex: sending error:500 emails to admins etc, but
sometimes I want to log errors and lets app go on.

(I'm talking about logging errors to the file, and later sending it
via email using cron)

regards.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django-logging and python logging together

2009-07-16 Thread Rodrigue

Am I the only one thinking about using both django-logging and the
logging module from the standard library at the same time?

I find it useful to not have to dig into a log file while I'm
developing or debugging, but I still want to have my logs written to
disk on production though. Is there a better way of achieving that?

Rodrigue

On Jul 13, 12:26 pm, Rodrigue <rodriguealca...@gmail.com> wrote:
> Hi all,
>
> I have been 
> usingdjango-logging(http://code.google.com/p/django-logging/wiki/Overview) 
> and found it very useful. However, I configured
> python logging for my project anddjango-loggingdoes not display
> logging messages anymore.
>
> Here is the logging.conf I am using:
>
> [loggers]
> keys = root,xxx
>
> [handlers]
> keys = xxxHandler
>
> [formatters]
> keys = defaultFormatter
>
> # Loggers
> # ==
>
> [logger_root]
> level = ERROR
> handlers = xxxHandler
>
> [logger_xxx
> level = DEBUG
> handlers = xxxHandler
> qualname = xxx
> propagate = 0
>
> # Handlers
> # ==
>
> [handler_xxxHandler]
> class = handlers.RotatingFileHandler
> level = DEBUG
> args = ("/tmp/logs/xxx.log", 'a', 5, 3)
> formatter = defaultFormatter
>
> # Formatters
> # ==
>
> [formatter_defaultFormatter]
> format = %(asctime)s [%(threadName)s] - %(pathname)s:[%(lineno)d] - %
> (levelname)s - %(message)s
> datefmt = %d-%m-%y %H:%M:%S
>
> I then grab my logger via: logging.getLogger(__name__)
>
> I can see all my log in the expected file, but thedjango-logginghtml
> does not show them.
>
> I see thedjango-loggingadded to the bottom of my pages but it only
> says: no log entries.
>
> Having had a look at thedjango-loggingmiddleware module, I found
> this:
>
> # Initialise and register the handler
> handler = ThreadBufferedHandler()
> logging.root.setLevel(logging.NOTSET)
> logging.root.addHandler(handler)
>
> So my understanding is that it only attaches a handler to the root
> logger but the root logger does not get called/used (not sure what the
> correct term is regarding the logging module).
>
> I have tried setting propagate=1 in my logging.conf, hoping that my
> log messages would be propagated to the root logger but no...
>
> Quite perplexed as to what the config is supposed to be.
>
> Any idea anyone?
>
> Rodrigue
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django-logging and python logging together

2009-07-13 Thread Rodrigue

Hi all,

I have been using django-logging (http://code.google.com/p/django-
logging/wiki/Overview) and found it very useful. However, I configured
python logging for my project and django-logging does not display
logging messages anymore.

Here is the logging.conf I am using:

[loggers]
keys = root,xxx

[handlers]
keys = xxxHandler

[formatters]
keys = defaultFormatter


# Loggers
# ==

[logger_root]
level = ERROR
handlers = xxxHandler

[logger_xxx
level = DEBUG
handlers = xxxHandler
qualname = xxx
propagate = 0

# Handlers
# ==

[handler_xxxHandler]
class = handlers.RotatingFileHandler
level = DEBUG
args = ("/tmp/logs/xxx.log", 'a', 5, 3)
formatter = defaultFormatter

# Formatters
# ==

[formatter_defaultFormatter]
format = %(asctime)s [%(threadName)s] - %(pathname)s:[%(lineno)d] - %
(levelname)s - %(message)s
datefmt = %d-%m-%y %H:%M:%S

I then grab my logger via: logging.getLogger(__name__)

I can see all my log in the expected file, but the django-logging html
does not show them.

I see the django-logging added to the bottom of my pages but it only
says: no log entries.

Having had a look at the django-logging middleware module, I found
this:

# Initialise and register the handler
handler = ThreadBufferedHandler()
logging.root.setLevel(logging.NOTSET)
logging.root.addHandler(handler)

So my understanding is that it only attaches a handler to the root
logger but the root logger does not get called/used (not sure what the
correct term is regarding the logging module).

I have tried setting propagate=1 in my logging.conf, hoping that my
log messages would be propagated to the root logger but no...

Quite perplexed as to what the config is supposed to be.

Any idea anyone?

Rodrigue
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django-logging

2009-06-19 Thread Rama Vadakattu

1. you can initialize the root logger in settings and use it across
every application.
   in such cases you need to embed the name in the log message for
easy debugging.

   Other disadvantage  is :
   you can't customize your logging on application basis  (like) i
want only debug messages from app1 and only info messages from app2


2. Initializing logger for every module/file
1) Here you  customize your logging on app basis.


On Jun 19, 12:56 pm, "eric.frederich" <eric.freder...@gmail.com>
wrote:
> Thanks a bunch.
>
> I needed help telling me where to do these things.
> Putting it in settings.py seems to work.
>
> Do you think putting something like...
>
> logger = logging.getLogger(__name__)
>
> ...at the beginning of every file that will use logging will be a
> problem?
>
> I could always just use the root logger, and embed __name__ in the
> message.
>
> I think I like this solution of using the logging module.  I guess
> with mod_python your stdout messages make it into apache's logs but
> I'm using mod-wsgi which actually errors when it gets something on
> stdout and throws all stderr messages away.  Time to go test it out
> for real now...
>
> On Jun 19, 8:03 am, Rama Vadakattu <rama.vadaka...@gmail.com> wrote:
>
>
>
> > I  usually use the python logging facility for doing logging in django
> > Any way the below is code i write
> > --
> > i hope you can figure out what is happening here
>
> > 1. Prepare logging conf file and name it  as logging.conf and put
> > under project directory
>
> >    Here goes the typicall contents
> >    
>
> >    [loggers]
> > keys=root,scoremore,scoremore.sampleapp     #loggers for different
> > apps
>
> > [handlers]
> > keys=consoleHandler,rfileHandler
>
> > [formatters]
> > keys=simpleFormatter
>
> > [logger_scoremore.sampleapp]
> > level=DEBUG
> > handlers=consoleHandler,rfileHandler
> > qualname=scoremore.sampleapp
> > propagate=0
>
> > [logger_scoremore]
> > level=DEBUG
> > handlers=consoleHandler,rfileHandler
> > qualname=scoremore
> > propagate=0
>
> > [logger_root]
> > level=DEBUG
> > handlers=consoleHandler,rfileHandler
>
> > [handler_consoleHandler]  #display on console all message which are >=
> > DEBUG
> > class=StreamHandler
> > level=DEBUG  #you need define as per your needs
> > formatter=simpleFormatter
> > args=(sys.stdout,)
>
> > [handler_rfileHandler]  #also put on file all messages which are
> > greater that  >= DEBUG
> > class=handlers.RotatingFileHandler
> > level=DEBUG
> > formatter=simpleFormatter
> > args=(%(log_path)s,'a',500,5)  # we will pass the file path here
> > to which log messages to appear
>
> > [formatter_simpleFormatter]
> > format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
> > datefmt=
>
> > -
> > 2. put down the following in settings.py
> > ===
> > # initialization of logging module
>
> > #LOG_FILE_PATH in django
> > LOG_FILE_PATH = "\""+os.path.join(os.path.dirname(os.path.normpath
> > (__file__)),"logs.txt")+"\""
> > #LOG FILE NAME In django
> > LOG_FILE_NAME = os.path.join(os.path.dirname(os.path.normpath
> > (__file__)),'logging.conf')
>
> > #loading the logging configuration
> > logging.config.fileConfig(LOG_FILE_NAME,defaults=dict
> > (log_path=LOG_FILE_PATH))
>
> > 3.so you have defined the configuration and also initialized the
> > logging (means telling  various loggers ,handlers,formatters)
> >    whenever you want use logging in any view or models do the below
> >  ---
>
> > import logging
> > import logging.config
>
> > mlogger = logging.getLogger(__name__) #name is module name it chooses
> > the  logger which contains name as prefix if none it chooses root
>
> > #now use this mlogger.debug to print message at debug level and
> > mlogger.info to print messages at info level
> > mlogger.debug("completed the question paper at present reviewing it")
>
> > Hope the above is clear for you to start...
>
> > --rama vadakattu
>
> > .
>
> > On Jun 18, 11:20 pm, "eric.frederich" <eric.freder...@gmail.com>
> > wrote:
>
> > > I need some advice on using the python logging module with django-
> > > logging.
>
> > > I have djangologging installed and working.  I re

Re: django-logging

2009-06-19 Thread eric.frederich

Thanks a bunch.

I needed help telling me where to do these things.
Putting it in settings.py seems to work.

Do you think putting something like...

logger = logging.getLogger(__name__)

...at the beginning of every file that will use logging will be a
problem?

I could always just use the root logger, and embed __name__ in the
message.


I think I like this solution of using the logging module.  I guess
with mod_python your stdout messages make it into apache's logs but
I'm using mod-wsgi which actually errors when it gets something on
stdout and throws all stderr messages away.  Time to go test it out
for real now...

On Jun 19, 8:03 am, Rama Vadakattu <rama.vadaka...@gmail.com> wrote:
> I  usually use the python logging facility for doing logging in django
> Any way the below is code i write
> --
> i hope you can figure out what is happening here
>
> 1. Prepare logging conf file and name it  as logging.conf and put
> under project directory
>
>    Here goes the typicall contents
>    
>
>    [loggers]
> keys=root,scoremore,scoremore.sampleapp     #loggers for different
> apps
>
> [handlers]
> keys=consoleHandler,rfileHandler
>
> [formatters]
> keys=simpleFormatter
>
> [logger_scoremore.sampleapp]
> level=DEBUG
> handlers=consoleHandler,rfileHandler
> qualname=scoremore.sampleapp
> propagate=0
>
> [logger_scoremore]
> level=DEBUG
> handlers=consoleHandler,rfileHandler
> qualname=scoremore
> propagate=0
>
> [logger_root]
> level=DEBUG
> handlers=consoleHandler,rfileHandler
>
> [handler_consoleHandler]  #display on console all message which are >=
> DEBUG
> class=StreamHandler
> level=DEBUG  #you need define as per your needs
> formatter=simpleFormatter
> args=(sys.stdout,)
>
> [handler_rfileHandler]  #also put on file all messages which are
> greater that  >= DEBUG
> class=handlers.RotatingFileHandler
> level=DEBUG
> formatter=simpleFormatter
> args=(%(log_path)s,'a',500,5)  # we will pass the file path here
> to which log messages to appear
>
> [formatter_simpleFormatter]
> format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
> datefmt=
>
> -
> 2. put down the following in settings.py
> ===
> # initialization of logging module
>
> #LOG_FILE_PATH in django
> LOG_FILE_PATH = "\""+os.path.join(os.path.dirname(os.path.normpath
> (__file__)),"logs.txt")+"\""
> #LOG FILE NAME In django
> LOG_FILE_NAME = os.path.join(os.path.dirname(os.path.normpath
> (__file__)),'logging.conf')
>
> #loading the logging configuration
> logging.config.fileConfig(LOG_FILE_NAME,defaults=dict
> (log_path=LOG_FILE_PATH))
>
> 3.so you have defined the configuration and also initialized the
> logging (means telling  various loggers ,handlers,formatters)
>    whenever you want use logging in any view or models do the below
>  ---
>
> import logging
> import logging.config
>
> mlogger = logging.getLogger(__name__) #name is module name it chooses
> the  logger which contains name as prefix if none it chooses root
>
> #now use this mlogger.debug to print message at debug level and
> mlogger.info to print messages at info level
> mlogger.debug("completed the question paper at present reviewing it")
>
> Hope the above is clear for you to start...
>
> --rama vadakattu
>
> .
>
> On Jun 18, 11:20 pm, "eric.frederich" <eric.freder...@gmail.com>
> wrote:
>
> > I need some advice on using the python logging module with django-
> > logging.
>
> > I have djangologging installed and working.  I read the documentation
> > and am trying to figure out how I can best take advantage of the built
> > in logging module.  The djangologging docs mention adding handlers and
> > other things.  I could not find any practical examples of using this
> > on a django site.
>
> > I'm not sure what I want yet... either one big log for my entire
> > django site or separate logs per application.  I could go either way,
> > although if some of my apps talk to each other it might be nice to
> > have a single log.
>
> > Anyway, I am to the point now where I am sending emails where
> > appropriate to users and admins.  What I would like now is to create
> > logs for things that are important to log but not necessarily
> > important enough to fill someone's inbox with.
>
> > I was having trouble getting through Python's logging module
> > documentation.  I am largely confused.  It mentions hierarchy and
> > inheritance and roo

Re: django-logging

2009-06-19 Thread Rama Vadakattu

I  usually use the python logging facility for doing logging in django
Any way the below is code i write
--
i hope you can figure out what is happening here

1. Prepare logging conf file and name it  as logging.conf and put
under project directory

   Here goes the typicall contents
   

   [loggers]
keys=root,scoremore,scoremore.sampleapp #loggers for different
apps

[handlers]
keys=consoleHandler,rfileHandler

[formatters]
keys=simpleFormatter

[logger_scoremore.sampleapp]
level=DEBUG
handlers=consoleHandler,rfileHandler
qualname=scoremore.sampleapp
propagate=0

[logger_scoremore]
level=DEBUG
handlers=consoleHandler,rfileHandler
qualname=scoremore
propagate=0

[logger_root]
level=DEBUG
handlers=consoleHandler,rfileHandler

[handler_consoleHandler]  #display on console all message which are >=
DEBUG
class=StreamHandler
level=DEBUG  #you need define as per your needs
formatter=simpleFormatter
args=(sys.stdout,)

[handler_rfileHandler]  #also put on file all messages which are
greater that  >= DEBUG
class=handlers.RotatingFileHandler
level=DEBUG
formatter=simpleFormatter
args=(%(log_path)s,'a',500,5)  # we will pass the file path here
to which log messages to appear

[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=


-
2. put down the following in settings.py
===
# initialization of logging module

#LOG_FILE_PATH in django
LOG_FILE_PATH = "\""+os.path.join(os.path.dirname(os.path.normpath
(__file__)),"logs.txt")+"\""
#LOG FILE NAME In django
LOG_FILE_NAME = os.path.join(os.path.dirname(os.path.normpath
(__file__)),'logging.conf')

#loading the logging configuration
logging.config.fileConfig(LOG_FILE_NAME,defaults=dict
(log_path=LOG_FILE_PATH))


3.so you have defined the configuration and also initialized the
logging (means telling  various loggers ,handlers,formatters)
   whenever you want use logging in any view or models do the below
 ---

import logging
import logging.config

mlogger = logging.getLogger(__name__) #name is module name it chooses
the  logger which contains name as prefix if none it chooses root


#now use this mlogger.debug to print message at debug level and
mlogger.info to print messages at info level
mlogger.debug("completed the question paper at present reviewing it")


Hope the above is clear for you to start...

--rama vadakattu





.


























On Jun 18, 11:20 pm, "eric.frederich" <eric.freder...@gmail.com>
wrote:
> I need some advice on using the python logging module with django-
> logging.
>
> I have djangologging installed and working.  I read the documentation
> and am trying to figure out how I can best take advantage of the built
> in logging module.  The djangologging docs mention adding handlers and
> other things.  I could not find any practical examples of using this
> on a django site.
>
> I'm not sure what I want yet... either one big log for my entire
> django site or separate logs per application.  I could go either way,
> although if some of my apps talk to each other it might be nice to
> have a single log.
>
> Anyway, I am to the point now where I am sending emails where
> appropriate to users and admins.  What I would like now is to create
> logs for things that are important to log but not necessarily
> important enough to fill someone's inbox with.
>
> I was having trouble getting through Python's logging module
> documentation.  I am largely confused.  It mentions hierarchy and
> inheritance and root loggers and such.  How am I supposed to use this
> module?  Do I just run logging.info() and logging.warn() and have my
> own logger inherit from the root, or do I call info or warn on my own
> instance of logger?
>
> In the end I just want to be able to have a simple line here and there
> within my views where I can output to a log file.
>
> Could give me some help to get up and running?
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django-logging

2009-06-18 Thread eric.frederich

I need some advice on using the python logging module with django-
logging.

I have djangologging installed and working.  I read the documentation
and am trying to figure out how I can best take advantage of the built
in logging module.  The djangologging docs mention adding handlers and
other things.  I could not find any practical examples of using this
on a django site.

I'm not sure what I want yet... either one big log for my entire
django site or separate logs per application.  I could go either way,
although if some of my apps talk to each other it might be nice to
have a single log.

Anyway, I am to the point now where I am sending emails where
appropriate to users and admins.  What I would like now is to create
logs for things that are important to log but not necessarily
important enough to fill someone's inbox with.

I was having trouble getting through Python's logging module
documentation.  I am largely confused.  It mentions hierarchy and
inheritance and root loggers and such.  How am I supposed to use this
module?  Do I just run logging.info() and logging.warn() and have my
own logger inherit from the root, or do I call info or warn on my own
instance of logger?

In the end I just want to be able to have a simple line here and there
within my views where I can output to a log file.

Could give me some help to get up and running?

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Logging

2009-05-09 Thread Raashid Malik
Hello,

  I m using django-logging module and able to see log messages at the bottom
of browser. I m also able to create a file. But what u want is that i should
be able to create an HTML file and all the logs should be appended.

-- 
Thanks,
Raashid Malik

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-Logging

2009-05-08 Thread Emily Rodgers



On May 8, 10:33 am, Raashid Malik <rama...@gmail.com> wrote:
> This means i have to call debug function with some message as argument. But
> my requirement is that all the django activity should be logged. Is there a
> way where in all operations of an application are logged.


Perhaps AuditTrail is what you are after? 
http://code.djangoproject.com/wiki/AuditTrail

Reversion may also be near what you are looking for:
http://code.google.com/p/django-reversion/


> On Fri, May 8, 2009 at 2:37 PM, K*K <xuqingku...@gmail.com> wrote:
>
> > You can have try this snippet:
>
> >http://www.djangosnippets.org/snippets/16/
>
> > On May 8, 3:39 pm, Raashid Malik <rama...@gmail.com> wrote:
> > > Hello,
>
> > >    Please guid me to some good resource on django logging.
>
> > > Thanks,
> > > Raashid Malik
>
> --
> Thanks,
> Raashid Malik
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-Logging

2009-05-08 Thread Raashid Malik
This means i have to call debug function with some message as argument. But
my requirement is that all the django activity should be logged. Is there a
way where in all operations of an application are logged.

On Fri, May 8, 2009 at 2:37 PM, K*K <xuqingku...@gmail.com> wrote:

>
> You can have try this snippet:
>
> http://www.djangosnippets.org/snippets/16/
>
> On May 8, 3:39 pm, Raashid Malik <rama...@gmail.com> wrote:
> > Hello,
> >
> >    Please guid me to some good resource on django logging.
> >
> > Thanks,
> > Raashid Malik
> >
>


-- 
Thanks,
Raashid Malik

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-Logging

2009-05-08 Thread K*K

Actually I always prefer enable DEBUG_PROPAGATE_EXCEPTIONS = True in
settings then use print to output log for debug.


On May 8, 3:39 pm, Raashid Malik <rama...@gmail.com> wrote:
> Hello,
>
>    Please guid me to some good resource on django logging.
>
> Thanks,
> Raashid Malik
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-Logging

2009-05-08 Thread K*K

You can have try this snippet:

http://www.djangosnippets.org/snippets/16/

On May 8, 3:39 pm, Raashid Malik <rama...@gmail.com> wrote:
> Hello,
>
>    Please guid me to some good resource on django logging.
>
> Thanks,
> Raashid Malik
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django-Logging

2009-05-08 Thread Raashid Malik
Hello,

   Please guid me to some good resource on django logging.


Thanks,
Raashid Malik

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django-Logging Problem..

2009-03-26 Thread caliman

do you have INTERNAL_IPS set in yout settings file?

if your on localhost you probably need:

INTERNAL_IPS = ('127.0.0.1',)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django-Logging Problem..

2009-03-07 Thread Harish

Hi Everybody...

I am trying out the Django-logging Middleware  for my application.

I am using Ubuntu as an OS, with Python Version 2.5 and Django Version
0.97-pre-SVN-7049.

I just tried the way they specified in the following link
http://code.google.com/p/django-logging/wiki/Overview

This is my settings snippet
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'djangologging.middleware.LoggingMiddleware',
 
'djangologging.middleware.SuppressLoggingOnAjaxRequestsMiddleware',
)

LOGGING_OUTPUT_ENABLED=True
LOGGING_LOG_SQL=True
LOGGING_SHOW_METRICS=True
LOGGING_REWRITE_CONTENT_TYPES =True


The problem I am facing is that... It gives a Log-in information at
the end of the page but The Log message says  "Request Log No log
entries."  (In spite of using  LOGGING_SHOW_METRICS=True )

I already set the LOGGING_OUTPUT_ENABLED =True; and
LOGGING_OUTPUT_ENABLED = True.

Is there anything wrong in my above step


Regards
Harish Bhat


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



FYI: django-logging problem with latest dev version of Django (patch info included)

2007-07-26 Thread keithb

Using the latest Django revision (anything after the Unicode branch
merge), if a view returns a page with any non-ASCII characters, you'll
get an error in django-logging when it tries to rewrite the page.

For more info and a patch, check out the django-logging ticket:

http://code.google.com/p/django-logging/issues/detail?id=5

-keithb


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django logging facilities

2007-06-19 Thread Ben Godfrey

I used logging for a while but messages were dropped too often. I'm
not entirely sure why, as logging is reputedly thread safe. Instead I
switched to syslog, which is more reliable, but truncates log
messages. Not so useful for later inspection of stack traces.

I have not looked at configuring Apache logging, at the time I was
afraid of it, but I'm beginning to think it's not so scary and might
be a better fit. I do prefer to have application and web server
logging in different locations however.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django logging facilities

2007-06-19 Thread Teófilo Ruiz

Hi. I'm new to this list (and mostly to Django) and I just wanted to
say hello first.

I'm doing some research with Django and I came to the time of
debugging my application. Actually, not only debugging, but logging
what happens in my application for later processing.

Is there any documentation on how to use the 'logging' Python module
with Django? I'm been taking a look at 'django-logging'[1], which is a
MiddleWare supposed to be used only when in DEBUG mode and not in
"production" mode.

Do you guys recommend using it for normal "production" mode or is
there any better option?

Thanks in advance,

[1] http://code.google.com/p/django-logging/wiki/Overview
-- 
teo - http://blog.eltridente.org

"Res publica non dominetur"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---