[Interest] logrotating qDebug
franki
franki at franki.eu.org
Fri Sep 27 11:16:28 CEST 2013
Dnia piątek, 27 września 2013 o 09:36:51 Francesco Lamonica napisał(a):
> Hi Kai, no, at the moment i am just redirecting process output
Hi,
I have log of my app rotated by logrotate,
but when you just redirect process output it won't work that way, unless you
restart your app.
In my opinion you should make your own Qt message handler, have it on some
global variable/class like Singleton, and let it write to specific file not just
to stdout, or stderr. Then in logrotate after rotating you must send signal to
your app, to release file inode, and open new one (simpy close and open file
again)
So, something like:
postrotate
/etc/init.d/myapp restart
endscript
and inside this sh script you should send SIGHUP to your app.
regards
Marek
>
> On Fri, Sep 27, 2013 at 9:34 AM, Koehne Kai <Kai.Koehne at digia.com> wrote:
> > > -----Original Message-----
> > > From: interest-bounces+kai.koehne=digia.com at qt-project.org
> > > [mailto:interest-bounces+kai.koehne=digia.com at qt-project.org] On Behalf
> > > Of Francesco Lamonica
> > > Sent: Friday, September 27, 2013 9:14 AM
> > > To: interest
> > > Subject: [Interest] logrotating qDebug
> > >
> > > 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?
> >
> > I don't have experience with logrotate ... anyhow, how are you generating
> > the log file? Have you written your own Qt message handler, or are you
> > just forwarding e.g. the stdout to a file?
> >
> > If you have written your own message handler, keep in mind that it has to
> > be reentrant ... that is, it might be called concurrently from different
> > threads.
> >
> > Regards
> >
> > Kai
More information about the Interest
mailing list