Re: python logging and multiple process issue?

2010-07-12 Thread Graham Dumpleton


On Jul 13, 2:00 pm, ydjango  wrote:
> After reading your message, I googled and found this from you -
>
> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
>
> I guess this is what you are referring to.
>
> does it mean -
> 1) any uncaught exceptions from my code running under mod_wsgi are
> automatically logged in apache log files?

No, because Django will capture those and turn it into a 500 error
page. Whether Django will also send an email to someone about or log
it will depend on Django configuration.

> or
>
> 2) I need to do in my code
>
> try:
> .
> except Exception,e:
>
> print >> sys.stderr, " error in method xyz, exception:", e

If you want to do explicit logging for any reason, yes you can do
that, irrespective of whether an exception is being raised.

You don't though need to use raw sys.stderr though and instead could
just configure Python logging module to use sys.stderr and then you
would use the logging module, allowing you configure what is and isn't
logged.

Graham

> thanks
>
> On Jul 12, 8:18 pm, Graham Dumpleton 
> wrote:
>
>
>
> > What is wrong with letting it log to stderr and thus the Apache error
> > log files?
>
> > Graham
>
> > On Jul 13, 11:52 am, ydjango  wrote:
>
> > > Just checking, if anyone can point me to a good solution to it. Or
> > > logging to sockets as in official doc is the best solution.
>
> > > On Jul 11, 9:35 am, ydjango  wrote:
>
> > > > Python logging has know limitation with multiple processes logging to
> > > > same file.
> > > > (I am using rotatingfilehandler.)
>
> > > > Which in case of prefork MPM will always be an issue and can be an
> > > > issue for worker mpm as well?
>
> > > > Python doc recommends logging to sockets.
>
> > > > What workarounds  are you using and can recommend ?

-- 
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: python logging and multiple process issue?

2010-07-12 Thread Andy McKay
Are you wanting to log errors that occur in your django site? If that's the 
case I'd recommend starting with simple tools like django's email logging and 
working up to more sophisticated tools like django-db-log or arecibo.

If you want to debug development code or you will find python's built in 
logging will be just fine for all but the most complicated of use cases. 

If you want to do access logging, your web server does that for you.
--
  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: python logging and multiple process issue?

2010-07-12 Thread ydjango

After reading your message, I googled and found this from you -

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques

I guess this is what you are referring to.

does it mean -
1) any uncaught exceptions from my code running under mod_wsgi are
automatically logged in apache log files?

or

2) I need to do in my code

try:
.
except Exception,e:

print >> sys.stderr, " error in method xyz, exception:", e


thanks

On Jul 12, 8:18 pm, Graham Dumpleton 
wrote:
> What is wrong with letting it log to stderr and thus the Apache error
> log files?
>
> Graham
>
> On Jul 13, 11:52 am, ydjango  wrote:
>
> > Just checking, if anyone can point me to a good solution to it. Or
> > logging to sockets as in official doc is the best solution.
>
> > On Jul 11, 9:35 am, ydjango  wrote:
>
> > > Python logging has know limitation with multiple processes logging to
> > > same file.
> > > (I am using rotatingfilehandler.)
>
> > > Which in case of prefork MPM will always be an issue and can be an
> > > issue for worker mpm as well?
>
> > > Python doc recommends logging to sockets.
>
> > > What workarounds  are you using and can recommend ?

-- 
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: python logging and multiple process issue?

2010-07-12 Thread ydjango

You mean by using simple print statements. I used to do that when I
was on mod_python.
Then I moved to using mod_wsgi and read somewhere that mod_wsgi does
not log print statements.
I may have been mistaken.


On Jul 12, 8:18 pm, Graham Dumpleton 
wrote:
> What is wrong with letting it log to stderr and thus the Apache error
> log files?
>
> Graham
>
> On Jul 13, 11:52 am, ydjango  wrote:
>
> > Just checking, if anyone can point me to a good solution to it. Or
> > logging to sockets as in official doc is the best solution.
>
> > On Jul 11, 9:35 am, ydjango  wrote:
>
> > > Python logging has know limitation with multiple processes logging to
> > > same file.
> > > (I am using rotatingfilehandler.)
>
> > > Which in case of prefork MPM will always be an issue and can be an
> > > issue for worker mpm as well?
>
> > > Python doc recommends logging to sockets.
>
> > > What workarounds  are you using and can recommend ?

-- 
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: python logging and multiple process issue?

2010-07-12 Thread Graham Dumpleton
What is wrong with letting it log to stderr and thus the Apache error
log files?

Graham

On Jul 13, 11:52 am, ydjango  wrote:
> Just checking, if anyone can point me to a good solution to it. Or
> logging to sockets as in official doc is the best solution.
>
> On Jul 11, 9:35 am, ydjango  wrote:
>
>
>
> > Python logging has know limitation with multiple processes logging to
> > same file.
> > (I am using rotatingfilehandler.)
>
> > Which in case of prefork MPM will always be an issue and can be an
> > issue for worker mpm as well?
>
> > Python doc recommends logging to sockets.
>
> > What workarounds  are you using and can recommend ?

-- 
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: python logging and multiple process issue?

2010-07-12 Thread ydjango
Just checking, if anyone can point me to a good solution to it. Or
logging to sockets as in official doc is the best solution.

On Jul 11, 9:35 am, ydjango  wrote:
> Python logging has know limitation with multiple processes logging to
> same file.
> (I am using rotatingfilehandler.)
>
> Which in case of prefork MPM will always be an issue and can be an
> issue for worker mpm as well?
>
> Python doc recommends logging to sockets.
>
> What workarounds  are you using and can recommend ?

-- 
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.



python logging and multiple process issue?

2010-07-11 Thread ydjango
Python logging has know limitation with multiple processes logging to
same file.
(I am using rotatingfilehandler.)

Which in case of prefork MPM will always be an issue and can be an
issue for worker mpm as well?

Python doc recommends logging to sockets.

What workarounds  are you using and can recommend ?

-- 
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.