You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Jathy <xu...@yahoo.com> on 2008/09/12 05:34:13 UTC
How to config log4cxx to delete the log files periodically
Hi All,
In my project, I need produce one log file per day and delete the log files
periodically so that at most 31 files are stored. I used
DailyRollingFileAppender, it helped me to reach my first goal easily. But
how to config it to delete the log files automatically? Thanks.
Regard,
Jathy
--
View this message in context: http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19448819.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.
RE: How to config log4cxx to delete the log files periodically
Posted by re...@rubixinfotech.com.
Again, this is my opinion: I would suppose that would be the case...
however, from an OOAD perspective, DailyRollingFileAppender deleting files
would end up being a dichotomy in the use-case of a "FileAppender". I
would suggest you setup a ExpiredFileManager or something that sets up its
own timer, or alarm, and processes the old files.... if you want to do it
from within your process.
Renny Koshy
Jathy <xu...@yahoo.com>
09/17/2008 06:30 AM
Please respond to
"Log4CXX User" <lo...@logging.apache.org>
To
log4cxx-user@logging.apache.org
cc
Subject
RE: How to config log4cxx to delete the log files periodically
Thanks all.
Does it mean I must extend DailyRollingFileAppender class if I want to
reach
such goal?
renny.koshy wrote:
>
> From what I've seen out there... small biz to large enterprises is that
> for System Admins, they see deleting logfiles as part of a global task
> that they generally set-up as part most large-scale enterprise systems.
> They prefer to have one point that manages all historical data,
archiving,
> etc. and do not really appreciate when a process deletes its logfiles.
> Specifically, we have customers who maintain logs for 3 days and some
even
> up to 30 days, and some that archive old logs for compliance/audit
> purposes.
>
> So... while I agree that a listener interface that one can register for
> log rotation would be nice, IMHO most large-scale uses of Log4CXX would
> not be able to use that to delete log file...
>
> Regards,
>
> Renny Koshy
>
>
>
>
> Conway Allen <Al...@atosorigin.com>
> 09/16/2008 09:19 AM
> Please respond to
> "Log4CXX User" <lo...@logging.apache.org>
>
>
> To
> Log4CXX User <lo...@logging.apache.org>
> cc
>
> Subject
> RE: How to config log4cxx to delete the log files periodically
>
>
>
>
>
>
> I suppose that if it were possible to define a callback that would be
> invoked when a roll-over takes place it would be possible to do the kind
> of housekeeping he wants without needing to use the crontab…
>
> regards, Allen.
>
> From: Dale King [mailto:dalewking@gmail.com]
> Sent: Saturday, September 13, 2008 4:20 PM
> To: Log4CXX User
> Subject: Re: How to config log4cxx to delete the log files periodically
>
> Log4Cxx does not have this capability. It only lets you specify a max
> number of files when using the size based rolling policy. This is not an
> arbitrary decision. There is no good way to accomplish what you want.
How
> is log4cxx supposed to know what files it can delete? Log4cxx maintains
no
> history of what files it has created in the past.
>
> I suggest you create a daily job that deletes log files that are more
than
> 31 days old based on creation date.
> On Fri, Sep 12, 2008 at 2:45 AM, Jathy <xu...@yahoo.com> wrote:
>
> Anybody has any idea about the below question? Waiting online...
>
>
> Jathy wrote:
>>
>> Hi All,
>>
>> In my project, I need produce one log file per day and delete the log
>> files periodically so that at most 31 files are stored. I used
>> DailyRollingFileAppender, it helped me to reach my first goal easily.
> But
>> how to config it to delete the log files automatically? Thanks.
>>
>> Regard,
>> Jathy
>>
>
> --
> View this message in context:
>
http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19450427.html
> Sent from the Log4cxx - Users mailing list archive at Nabble.com.
>
>
>
> --
> Dale King
>
>
> Ce message et les pièces jointes sont confidentiels et réservés à
l'usage
> exclusif de ses destinataires. Il peut également être protégé par le
> secret professionnel. Si vous recevez ce message par erreur, merci d'en
> avertir immédiatement l'expéditeur et de le détruire. L'intégrité du
> message ne pouvant être assurée sur Internet, la responsabilité du
groupe
> Atos Origin ne pourra être recherchée quant au contenu de ce message.
Bien
> que les meilleurs efforts soient faits pour maintenir cette transmission
> exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard
> et sa responsabilité ne saurait être recherchée pour tout dommage
> résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Atos Origin group
> liability cannot be triggered for the message content. Although the
sender
> endeavours to maintain a computer virus-free network, the sender does
not
> warrant that this transmission is virus-free and will not be liable for
> any damages resulting from any virus transmitted.
>
>
>
--
View this message in context:
http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19529245.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.
RE: How to config log4cxx to delete the log files periodically
Posted by Jathy <xu...@yahoo.com>.
Thanks all.
Does it mean I must extend DailyRollingFileAppender class if I want to reach
such goal?
renny.koshy wrote:
>
> From what I've seen out there... small biz to large enterprises is that
> for System Admins, they see deleting logfiles as part of a global task
> that they generally set-up as part most large-scale enterprise systems.
> They prefer to have one point that manages all historical data, archiving,
> etc. and do not really appreciate when a process deletes its logfiles.
> Specifically, we have customers who maintain logs for 3 days and some even
> up to 30 days, and some that archive old logs for compliance/audit
> purposes.
>
> So... while I agree that a listener interface that one can register for
> log rotation would be nice, IMHO most large-scale uses of Log4CXX would
> not be able to use that to delete log file...
>
> Regards,
>
> Renny Koshy
>
>
>
>
> Conway Allen <Al...@atosorigin.com>
> 09/16/2008 09:19 AM
> Please respond to
> "Log4CXX User" <lo...@logging.apache.org>
>
>
> To
> Log4CXX User <lo...@logging.apache.org>
> cc
>
> Subject
> RE: How to config log4cxx to delete the log files periodically
>
>
>
>
>
>
> I suppose that if it were possible to define a callback that would be
> invoked when a roll-over takes place it would be possible to do the kind
> of housekeeping he wants without needing to use the crontab…
>
> regards, Allen.
>
> From: Dale King [mailto:dalewking@gmail.com]
> Sent: Saturday, September 13, 2008 4:20 PM
> To: Log4CXX User
> Subject: Re: How to config log4cxx to delete the log files periodically
>
> Log4Cxx does not have this capability. It only lets you specify a max
> number of files when using the size based rolling policy. This is not an
> arbitrary decision. There is no good way to accomplish what you want. How
> is log4cxx supposed to know what files it can delete? Log4cxx maintains no
> history of what files it has created in the past.
>
> I suggest you create a daily job that deletes log files that are more than
> 31 days old based on creation date.
> On Fri, Sep 12, 2008 at 2:45 AM, Jathy <xu...@yahoo.com> wrote:
>
> Anybody has any idea about the below question? Waiting online...
>
>
> Jathy wrote:
>>
>> Hi All,
>>
>> In my project, I need produce one log file per day and delete the log
>> files periodically so that at most 31 files are stored. I used
>> DailyRollingFileAppender, it helped me to reach my first goal easily.
> But
>> how to config it to delete the log files automatically? Thanks.
>>
>> Regard,
>> Jathy
>>
>
> --
> View this message in context:
> http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19450427.html
> Sent from the Log4cxx - Users mailing list archive at Nabble.com.
>
>
>
> --
> Dale King
>
>
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage
> exclusif de ses destinataires. Il peut également être protégé par le
> secret professionnel. Si vous recevez ce message par erreur, merci d'en
> avertir immédiatement l'expéditeur et de le détruire. L'intégrité du
> message ne pouvant être assurée sur Internet, la responsabilité du groupe
> Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien
> que les meilleurs efforts soient faits pour maintenir cette transmission
> exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard
> et sa responsabilité ne saurait être recherchée pour tout dommage
> résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Atos Origin group
> liability cannot be triggered for the message content. Although the sender
> endeavours to maintain a computer virus-free network, the sender does not
> warrant that this transmission is virus-free and will not be liable for
> any damages resulting from any virus transmitted.
>
>
>
--
View this message in context: http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19529245.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.
Re: How to config log4cxx to delete the log files periodically
Posted by "Jacob L. Anawalt" <ja...@geckosoftware.com>.
On 2008-09-19 15:31, Jacob L. Anawalt wrote:
> heartedly. This discussion and some recent tweaking of a mail service's
> log rotation (via logrotate) on one server motivated me to figure out
> how to make this work.
>
I have implemented this in my multi-threaded application by blocking all signals
I want to respond to before starting any threads, and then starting an async
signal handler thread to loop on sigwait. When I get a SIGHUP I simply call
log4cxx::xml::DOMConfigurator::configure(confFile). This makes my program act
like most daemons where they re-read the config and reopen files on SIGHUP.
This seems to work well, but I am going to review the log4cxx code a little
closer since it is starting it's own threads, possibly before I block the
signals. I didn't notice a problem in the "single threaded"* version using
sigaction or this multi-threaded one but that could have been chance.
* In log4cxx-hup I was momentarily forgetting that log4cxx was starting it's own
threads. It almost seems strange that I didn't run into trouble using sigaction.
--
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026
Re: How to config log4cxx to delete the log files periodically
Posted by "Jacob L. Anawalt" <ja...@geckosoftware.com>.
On 2008-09-16 12:06, renny.koshy@rubixinfotech.com wrote:
> From what I've seen out there... small biz to large enterprises is that
> for System Admins, they see deleting logfiles as part of a global task
As I've started implementing some projects with log4cxx logging I had decided to
use the sized based rolling policy since it was an in-my-face solution, but what
I really wanted was for my programs to work into the logrotate system like most
of the other daemons on my Debian systems.
I've looked into how to do this a couple of times, but only half heartedly. This
discussion and some recent tweaking of a mail service's log rotation (via
logrotate) on one server motivated me to figure out how to make this work.
Attached is a sample program that compiles on a Debian Etch (4.1) system with
the liblog4cxx9-dev (0.9.7-6) package [1]. It is self-contained, no external
conf file required. Just compile it and it should write to the terminal and to a
file named log4cxx-hup.log. Rename the file to eg log4cxx-hup.1.log, like a
rotation program would, and it continues to write to the file. Send it a SIGHUP
and FileAppender::activateOptions() closes and re-opens the file, thus writing
again to log4cxx-hup.log. You can even pre-create the file and set the
permissions you want, as long as they allow the program to write, and it should
work.
While I appreciate the portability issues the built-in rotation schemas try to
provide, I prefer this solution if it will reliably work within my current
logging framework.
Please glance over the attached code. I would like to have a reasonably polished
example to put on the wiki that is simple without hiding too many details (eg no
using namespace xxx), shows best practice ideas (eg NDC without push/pop) and
easy to copy and paste as a boilerplate for doing the same in someone's
application. I haven't checked this against 0.10.0, so I don't know if any
methods are deprecated or if better options in that version.
[1] 0.9.7? Yes. I know. Unsupported by log4cxx project. Unfortunately this
appears to be the version that will be in Lenny as well, so without a person
willing to be responsible for the backport, or more time dropping into my lap,
this is the version I will probably be dealing with for a few more years.
--
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026
RE: How to config log4cxx to delete the log files periodically
Posted by re...@rubixinfotech.com.
From what I've seen out there... small biz to large enterprises is that
for System Admins, they see deleting logfiles as part of a global task
that they generally set-up as part most large-scale enterprise systems.
They prefer to have one point that manages all historical data, archiving,
etc. and do not really appreciate when a process deletes its logfiles.
Specifically, we have customers who maintain logs for 3 days and some even
up to 30 days, and some that archive old logs for compliance/audit
purposes.
So... while I agree that a listener interface that one can register for
log rotation would be nice, IMHO most large-scale uses of Log4CXX would
not be able to use that to delete log file...
Regards,
Renny Koshy
Conway Allen <Al...@atosorigin.com>
09/16/2008 09:19 AM
Please respond to
"Log4CXX User" <lo...@logging.apache.org>
To
Log4CXX User <lo...@logging.apache.org>
cc
Subject
RE: How to config log4cxx to delete the log files periodically
I suppose that if it were possible to define a callback that would be
invoked when a roll-over takes place it would be possible to do the kind
of housekeeping he wants without needing to use the crontab…
regards, Allen.
From: Dale King [mailto:dalewking@gmail.com]
Sent: Saturday, September 13, 2008 4:20 PM
To: Log4CXX User
Subject: Re: How to config log4cxx to delete the log files periodically
Log4Cxx does not have this capability. It only lets you specify a max
number of files when using the size based rolling policy. This is not an
arbitrary decision. There is no good way to accomplish what you want. How
is log4cxx supposed to know what files it can delete? Log4cxx maintains no
history of what files it has created in the past.
I suggest you create a daily job that deletes log files that are more than
31 days old based on creation date.
On Fri, Sep 12, 2008 at 2:45 AM, Jathy <xu...@yahoo.com> wrote:
Anybody has any idea about the below question? Waiting online...
Jathy wrote:
>
> Hi All,
>
> In my project, I need produce one log file per day and delete the log
> files periodically so that at most 31 files are stored. I used
> DailyRollingFileAppender, it helped me to reach my first goal easily.
But
> how to config it to delete the log files automatically? Thanks.
>
> Regard,
> Jathy
>
--
View this message in context:
http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19450427.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.
--
Dale King
Ce message et les pièces jointes sont confidentiels et réservés à l'usage
exclusif de ses destinataires. Il peut également être protégé par le
secret professionnel. Si vous recevez ce message par erreur, merci d'en
avertir immédiatement l'expéditeur et de le détruire. L'intégrité du
message ne pouvant être assurée sur Internet, la responsabilité du groupe
Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien
que les meilleurs efforts soient faits pour maintenir cette transmission
exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard
et sa responsabilité ne saurait être recherchée pour tout dommage
résultant d'un virus transmis.
This e-mail and the documents attached are confidential and intended
solely for the addressee; it may also be privileged. If you receive this
e-mail in error, please notify the sender immediately and destroy it. As
its integrity cannot be secured on the Internet, the Atos Origin group
liability cannot be triggered for the message content. Although the sender
endeavours to maintain a computer virus-free network, the sender does not
warrant that this transmission is virus-free and will not be liable for
any damages resulting from any virus transmitted.
RE: How to config log4cxx to delete the log files periodically
Posted by Conway Allen <Al...@atosorigin.com>.
I suppose that if it were possible to define a callback that would be invoked when a roll-over takes place it would be possible to do the kind of housekeeping he wants without needing to use the crontab...
regards, Allen.
From: Dale King [mailto:dalewking@gmail.com]
Sent: Saturday, September 13, 2008 4:20 PM
To: Log4CXX User
Subject: Re: How to config log4cxx to delete the log files periodically
Log4Cxx does not have this capability. It only lets you specify a max number of files when using the size based rolling policy. This is not an arbitrary decision. There is no good way to accomplish what you want. How is log4cxx supposed to know what files it can delete? Log4cxx maintains no history of what files it has created in the past.
I suggest you create a daily job that deletes log files that are more than 31 days old based on creation date.
On Fri, Sep 12, 2008 at 2:45 AM, Jathy <xu...@yahoo.com>> wrote:
Anybody has any idea about the below question? Waiting online...
Jathy wrote:
>
> Hi All,
>
> In my project, I need produce one log file per day and delete the log
> files periodically so that at most 31 files are stored. I used
> DailyRollingFileAppender, it helped me to reach my first goal easily. But
> how to config it to delete the log files automatically? Thanks.
>
> Regard,
> Jathy
>
--
View this message in context: http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19450427.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.
--
Dale King
________________________________
Ce message et les pi?ces jointes sont confidentiels et r?serv?s ? l'usage exclusif de ses destinataires. Il peut ?galement ?tre prot?g? par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir imm?diatement l'exp?diteur et de le d?truire. L'int?grit? du message ne pouvant ?tre assur?e sur Internet, la responsabilit? du groupe Atos Origin ne pourra ?tre recherch?e quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'exp?diteur ne donne aucune garantie ? cet ?gard et sa responsabilit? ne saurait ?tre recherch?e pour tout dommage r?sultant d'un virus transmis.
This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
Re: How to config log4cxx to delete the log files periodically
Posted by Dale King <da...@gmail.com>.
Log4Cxx does not have this capability. It only lets you specify a max number
of files when using the size based rolling policy. This is not an arbitrary
decision. There is no good way to accomplish what you want. How is log4cxx
supposed to know what files it can delete? Log4cxx maintains no history of
what files it has created in the past.
I suggest you create a daily job that deletes log files that are more than
31 days old based on creation date.
On Fri, Sep 12, 2008 at 2:45 AM, Jathy <xu...@yahoo.com> wrote:
>
> Anybody has any idea about the below question? Waiting online...
>
>
> Jathy wrote:
> >
> > Hi All,
> >
> > In my project, I need produce one log file per day and delete the log
> > files periodically so that at most 31 files are stored. I used
> > DailyRollingFileAppender, it helped me to reach my first goal easily. But
> > how to config it to delete the log files automatically? Thanks.
> >
> > Regard,
> > Jathy
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19450427.html
> Sent from the Log4cxx - Users mailing list archive at Nabble.com.
>
>
--
Dale King
Re: How to config log4cxx to delete the log files periodically
Posted by Jathy <xu...@yahoo.com>.
Anybody has any idea about the below question? Waiting online...
Jathy wrote:
>
> Hi All,
>
> In my project, I need produce one log file per day and delete the log
> files periodically so that at most 31 files are stored. I used
> DailyRollingFileAppender, it helped me to reach my first goal easily. But
> how to config it to delete the log files automatically? Thanks.
>
> Regard,
> Jathy
>
--
View this message in context: http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19450427.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.
Re: How to config log4cxx to delete the log files periodically
Posted by Dale King <da...@gmail.com>.
An example of what?
How to setup the rolling::RollingFileAppender? That's covered in its docs:
<
http://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1rolling_1_1_rolling_file_appender.html
>
How to subclass TimeBasedRollingPolicy? If you don't know how to create a
subclass, I'm not going to tutor you.
How to use your subclass in the configruation? It has to be registered so
that it can be used using Log4J style names. See the use of
IMPLEMENT_LOG4CXX_OBJECT throughout the code. That has the magic.
How to have a callback when rolling is done? If your subclass overrides
rollover that is what is called to do the rollover. So if you put your own
custom code here and call the superclass then you have notification when the
rollover is done.
How to delete the old log files? That is up to you. All I said was that it
is possible to execute whatever code you want when a rollover is done by
subclassing TimeBasedRollingPolicy.
On Fri, Sep 26, 2008 at 5:43 AM, Jathy <xu...@yahoo.com> wrote:
>
> Hi, Could you give more information or an example on this? Thanks.
>
>
> Dale King-2 wrote:
> >
> > That is already possible. You would need to use the RollingFileAppender
> > that is in the rolling namespace. It is a more flexible class and is the
> > superclass that the others are derived from. With it you specify a
> rolling
> > policy and a triggering policy (the time based one is both). You could
> > easily subclass the time based triggering policy to do whatever you want.
> > Note that this only works with an XML configuration file. The more
> general
> > rolling.RollingFileAppender cannot be configured using a properties file.
> >
> > -----Original Message-----
> > From: Conway Allen <Al...@atosorigin.com>
> > Sent: Tuesday, September 16, 2008 9:19 AM
> > To: Log4CXX User <lo...@logging.apache.org>
> > Subject: RE: How to config log4cxx to delete the log files periodically
> >
> > I suppose that if it were possible to define a callback that would be
> > invoked when a roll-over takes place it would be possible to do the kind
> > of housekeeping he wants without needing to use the crontab…
> >
> > regards, Allen.
> >
> > From: Dale King [mailto:dalewking@gmail.com]
> > Sent: Saturday, September 13, 2008 4:20 PM
> > To: Log4CXX User
> > Subject: Re: How to config log4cxx to delete the log files periodically
> >
> > Log4Cxx does not have this capability. It only lets you specify a max
> > number of files when using the size based rolling policy. This is not an
> > arbitrary decision. There is no good way to accomplish what you want. How
> > is log4cxx supposed to know what files it can delete? Log4cxx maintains
> no
> > history of what files it has created in the past.
> >
> > I suggest you create a daily job that deletes log files that are more
> > than 31 days old based on creation date.
> > On Fri, Sep 12, 2008 at 2:45 AM, Jathy <xu...@yahoo.com> wrote:
> >
> > Anybody has any idea about the below question? Waiting online...
> >
> >
> > Jathy wrote:
> > >
> > > Hi All,
> > >
> > > In my project, I need produce one log file per day and delete the log
> > > files periodically so that at most 31 files are stored. I used
> > > DailyRollingFileAppender, it helped me to reach my first goal easily.
> > But
> > > how to config it to delete the log files automatically? Thanks.
> > >
> > > Regard,
> > > Jathy
> > >
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19450427.html
> > Sent from the Log4cxx - Users mailing list archive at Nabble.com.
> >
> >
> >
> > --
> > Dale King
> >
> > Ce message et les pièces jointes sont confidentiels et réservés à
> l'usage
> > exclusif de ses destinataires. Il peut également être protégé par le
> > secret professionnel. Si vous recevez ce message par erreur, merci d'en
> > avertir immédiatement l'expéditeur et de le détruire. L'intégrité du
> > message ne pouvant être assurée sur Internet, la responsabilité du groupe
> > Atos Origin ne pourra être recherchée quant au contenu de ce message.
> Bien
> > que les meilleurs efforts soient faits pour maintenir cette transmission
> > exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard
> > et sa responsabilité ne saurait être recherchée pour tout dommage
> > résultant d'un virus transmis.
> >
> > This e-mail and the documents attached are confidential and intended
> > solely for the addressee; it may also be privileged. If you receive this
> > e-mail in error, please notify the sender immediately and destroy it. As
> > its integrity cannot be secured on the Internet, the Atos Origin group
> > liability cannot be triggered for the message content. Although the
> sender
> > endeavours to maintain a computer virus-free network, the sender does not
> > warrant that this transmission is virus-free and will not be liable for
> > any damages resulting from any virus transmitted.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19685393.html
> Sent from the Log4cxx - Users mailing list archive at Nabble.com.
>
>
--
Dale King
RE: How to config log4cxx to delete the log files periodically
Posted by Jathy <xu...@yahoo.com>.
Hi, Could you give more information or an example on this? Thanks.
Dale King-2 wrote:
>
> That is already possible. You would need to use the RollingFileAppender
> that is in the rolling namespace. It is a more flexible class and is the
> superclass that the others are derived from. With it you specify a rolling
> policy and a triggering policy (the time based one is both). You could
> easily subclass the time based triggering policy to do whatever you want.
> Note that this only works with an XML configuration file. The more general
> rolling.RollingFileAppender cannot be configured using a properties file.
>
> -----Original Message-----
> From: Conway Allen <Al...@atosorigin.com>
> Sent: Tuesday, September 16, 2008 9:19 AM
> To: Log4CXX User <lo...@logging.apache.org>
> Subject: RE: How to config log4cxx to delete the log files periodically
>
> I suppose that if it were possible to define a callback that would be
> invoked when a roll-over takes place it would be possible to do the kind
> of housekeeping he wants without needing to use the crontab
>
> regards, Allen.
>
> From: Dale King [mailto:dalewking@gmail.com]
> Sent: Saturday, September 13, 2008 4:20 PM
> To: Log4CXX User
> Subject: Re: How to config log4cxx to delete the log files periodically
>
> Log4Cxx does not have this capability. It only lets you specify a max
> number of files when using the size based rolling policy. This is not an
> arbitrary decision. There is no good way to accomplish what you want. How
> is log4cxx supposed to know what files it can delete? Log4cxx maintains no
> history of what files it has created in the past.
>
> I suggest you create a daily job that deletes log files that are more
> than 31 days old based on creation date.
> On Fri, Sep 12, 2008 at 2:45 AM, Jathy <xu...@yahoo.com> wrote:
>
> Anybody has any idea about the below question? Waiting online...
>
>
> Jathy wrote:
> >
> > Hi All,
> >
> > In my project, I need produce one log file per day and delete the log
> > files periodically so that at most 31 files are stored. I used
> > DailyRollingFileAppender, it helped me to reach my first goal easily.
> But
> > how to config it to delete the log files automatically? Thanks.
> >
> > Regard,
> > Jathy
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19450427.html
> Sent from the Log4cxx - Users mailing list archive at Nabble.com.
>
>
>
> --
> Dale King
>
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage
> exclusif de ses destinataires. Il peut également être protégé par le
> secret professionnel. Si vous recevez ce message par erreur, merci d'en
> avertir immédiatement l'expéditeur et de le détruire. L'intégrité du
> message ne pouvant être assurée sur Internet, la responsabilité du groupe
> Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien
> que les meilleurs efforts soient faits pour maintenir cette transmission
> exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard
> et sa responsabilité ne saurait être recherchée pour tout dommage
> résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Atos Origin group
> liability cannot be triggered for the message content. Although the sender
> endeavours to maintain a computer virus-free network, the sender does not
> warrant that this transmission is virus-free and will not be liable for
> any damages resulting from any virus transmitted.
>
>
--
View this message in context: http://www.nabble.com/How-to-config-log4cxx-to-delete-the-log-files-periodically-tp19448819p19685393.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.