Logger - rotating logs

This is the place for queries that don't fit in any of the other categories.

Logger - rotating logs

Postby micksulley » Tue Apr 30, 2013 9:02 pm

I have setup logger thanks to help form this forum, and I am using the standard logrotate package to manage the files, but something is not right. When the logfile grows beyond the limit it moves it to logfile.log.1 and creates a new logfile.log but continues to write to logfile.log.1

I feel sure that the problem is that my program runs for ever and so the log file is never closed, so even when it is moved to logfile.log.1 as it is still open it just keeps writing to that file. Is that the problem? If so how do I close and reopen the log file? I can't find anything in hte documentation I have looked at.

I set it up and start it with -

fh = logging.FileHandler('logfileloation')

Posts: 7
Joined: Tue Mar 26, 2013 9:08 pm

Re: Logger - rotating logs - Fixed

Postby micksulley » Mon May 06, 2013 10:10 pm

OK sorted it. Need to add

at the end of the loop, then start it all again
Posts: 7
Joined: Tue Mar 26, 2013 9:08 pm

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 4 guests