logging question

Automn automn at willow.org
Sat Feb 7 03:48:58 EST 2015


Hello,

On 2014-08-13, Arulnambi Nandagoban <a.nandagoban at traxens.com> wrote:
>
> My pc restarts regularly. Whenever it restarts I lose all the log since it
> writes in the file once per day.  Is there a way to log information in a
> file as soon as it available.

You can log in the /var/tmp directory instead of /tmp. The former does not get
cleaned when you restart. You can rotate your
/var/log logfile manually or with a cronjob or with a shell program.

>
> My application is a tcp server. Before I did it without using logger module,
> I developed customized log module for the application.  As soon as there is
> a connection I append it in the log file.
>
> By that way I didn't lose any log information.  
>

Try to find out why your logfile gets truncated. I don't know it very well in
python but if you open a file with libc you get to choose if you truncate, 
AFAIK it can be in sys or logging module.

HTH,
Automn
-- 
my blog : http://thediaryofelvishhealer.blogger.com/
Time heals.



More information about the Python-list mailing list