[Interest] logrotating qDebug

Thiago Macieira thiago.macieira at intel.com
Fri Sep 27 20:22:47 CEST 2013


On sexta-feira, 27 de setembro de 2013 09:14:08, Francesco Lamonica wrote:
> Hi all,
> i am using logrotate on a file that is populated by qDebug() statements of
> my app (that does not get restarted).
> Sometimes ( i have been unable to find the behaviour's causes so far ) the
> logorotating does not happen and what i get is what seems to be a binary
> file.
> Any ideas what might be happening?

You forgot the restarting of your application.

The file looks binary because of that "copytruncate" at the end. When logrotate 
runs, it will truncate the output file to zero size. But since you didn't 
restart the application, it will continue writing from the exact byte offset as 
it had been before. That means the beginning of the file is composed of NUL 
bytes. Hence, binary.

> 
> the logrotate options used are:
> /opt/nrsc/consolelogs/*.txt {
>   rotate 2
>   daily
>   size 2M
>   compress
>   missingok
>   notifempty
>   copytruncate
> }

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130927/f384ac5e/attachment.sig>


More information about the Interest mailing list