cGmail creates giant log files and never cleans up

Bug #730792 reported by ullix
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cgmail (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: cgmail

I am running cGmail 0.6.1 under Ubuntu 10.04.2. It is a python script and generally works quite well as a mail checker under the Gnome desktop.

However, it logs every single action - error or not - into a logfile, and never does anything like a rolling backup or otherwise shrinking the file. The cgmailservice.log file on my netbook has grown to > 300MByte, which is quite a burden on a slow computer with a small and very slow 8GB SSD as hard disk (Acer Aspire One 110L).

The file is also rather useless after the first start, as no date and time info is provided in any entry. Here is an excerpt:
+++
authenticate user ...
... connection done to the server imap.xxx.de on port 143
authenticate user ...
...auth done
getting mails...
...auth done
getting mails...
...auth done
getting mails...
...auth done
getting mails...
... connection done to the server imap.xxx.de on port 143
authenticate user ...
... connection done to the server imap.xxx.de on port 143
authenticate user ...
+++

Simply making the cgmailservice.log 'read-only' is of no help, because then the python script hangs.

This is the logging function from script utils.py in folder /usr/share/cGmail/cGmail/lib:

def log(logdata):
 # work-around to unlimited log file is 'return' on next line
 return
 logfile = prepend_config_path("cgmailservice.log")
 logdata += "\n"
 if not os.path.isfile(logfile):
  logfile = open(logfile, 'w+')
 else:
  logfile = open(logfile, 'a+')
 logfile.write(logdata)
 logfile.close()

Note that the 'return' in 3rd line is my dirty-work-around to the ever growing file problem. I am proposing modifications:
1) add date and time to each entry
2) unless in debug mode write only warnings and errors
3) make the script continue if file exists but is not writable, or cannot be created
4) make rolling backups, or otherwise limit file size to a few days worth of data

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.