[Tutor] Python logging

Stefan Behnel stefan_ml at behnel.de
Sun Apr 19 14:12:59 CEST 2009


Hi,

just commenting on this part:

Scott SA wrote:
>     [handler_warn_logfile]
>     class=handlers.RotatingFileHandler
>     level=WARNING
>     formatter=DatetimeLevelMessage
>     args=('test_warn.log', 'a', 125829120, 5)
>     filename=test_warn.log
>     mode=a
> 
> ... 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).

Stefan



More information about the Tutor mailing list