Hi Stephan & Kent,

On Apr 19, 2009, at 6:12 AM, Stefan Behnel wrote:

just commenting on this part:

... which basically says append WARNING messages to the rotating file
handler in DatetimeLevelMessage format to a log-file named test_warn.log
splitting the log-file when it exceeds 125829120 bytes.

You may have a reason to cut these at "125829120" bytes, but it's usually a
bad idea to cut log files by size. It's much more natural to have time
sliced log files (one per day or per hour), so that you directly know which file you have to look at to analyse that stuff that went so terribly wrong
yesterday evening (especially once they get archived somewhere).

I didn't set-up this portion of the file config. file and have not found much documentation for the conf-file formating (much of the rest is very well documented). I guess I should really find the actual code and read what it is doing... as Kent very gently prodded me with. I did go through a few PEPs too, and I don't recall seeing anything about time-based rotation ... but then maybe it was there and it didn't register with me. Thanks for the heads-up, I'll go back and re- read the material.

Looking at the code for the logging module, I think it will work to
create the RotatingFileHandler with the parameter delay=True, then in
your code get the handler and change its baseFilename attribute to be
the path you want, e.g.
"/home/user/workspace/logged_app/test_warn.log".

That's an interesting feature, I'll have to go look and see what other jewels are lurking in various modules. So far I've not spent a lot of time going through the code for modules like this, but obviously I should (I often learn more than just how a bit of code works by reading how others have solved problems).

Thank you both!

Scott
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to