You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by anoobthomas <an...@gmail.com> on 2008/01/28 05:52:11 UTC

Renaming log file

Currently I am using Daily Rolling File Appender to generate log files.

I want to rename my log file from "ABC.log2008-1-27" to "ABC.log number
sequence" , like "ABC.log1","ABC.log2" and so on.

Should I create a custom appender or are there any appenders that generate
this format.
If I have to create a custom appender please let me know how to do it. 
-- 
View this message in context: http://www.nabble.com/Renaming-log-file-tp15128382p15128382.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Renaming log file

Posted by "James A. N. Stauffer" <st...@gmail.com>.
That depends on how you are configuring (properties, xml, or code).
Searching the archives and/or Google will surely give some examples.

On Jan 30, 2008 8:21 AM, anoobthomas <an...@gmail.com> wrote:
>
> Currently my log files are generated with a date stamp because I am using the
> Daily Rolling File Appender
>
> My requirement is that I want my log files without the date stamp, instead I
> want them as filename.log.1, filename.log.2, etc. as a sequence of numbers.
> You said Rolling File Appender would solve my problem. Could you be kind
> enough to show me how with an example?  I am rather new to log4j.
>
>
>
>
> carnold-3 wrote:
> >
> >
> > On Jan 28, 2008, at 6:47 AM, James A. N. Stauffer wrote:
> >
> >> I'm not sure what you want but RollingFileAppender will make files
> >> like what you want.
> >
> > If you do need to write custom code, I would recommend writing a
> > custom RollingPolicy for the
> > org.apache.log4j.rolling.RollingFileAppender (o.a.l.r.RFA) in the
> > extras companion (http://logging.apache.org/companions/extras).  The
> > o.a.l.r.RFA was designed to support pluggable RollingPolicies which
> > provide the strategy for renaming files and TriggeringPolicies which
> > provide the strategy for determining when to trigger files.  It seems
> > like you might just want to mix the FixedWindowRollingPolicy (which
> > provides .1, .2, etc file names) with a TimeBasedTriggeringPolicy.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Renaming-log-file-tp15128382p15183091.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>



-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Renaming log file

Posted by anoobthomas <an...@gmail.com>.
Currently my log files are generated with a date stamp because I am using the
Daily Rolling File Appender

My requirement is that I want my log files without the date stamp, instead I
want them as filename.log.1, filename.log.2, etc. as a sequence of numbers. 
You said Rolling File Appender would solve my problem. Could you be kind
enough to show me how with an example?  I am rather new to log4j.

 

carnold-3 wrote:
> 
> 
> On Jan 28, 2008, at 6:47 AM, James A. N. Stauffer wrote:
> 
>> I'm not sure what you want but RollingFileAppender will make files
>> like what you want.
> 
> If you do need to write custom code, I would recommend writing a  
> custom RollingPolicy for the  
> org.apache.log4j.rolling.RollingFileAppender (o.a.l.r.RFA) in the  
> extras companion (http://logging.apache.org/companions/extras).  The  
> o.a.l.r.RFA was designed to support pluggable RollingPolicies which  
> provide the strategy for renaming files and TriggeringPolicies which  
> provide the strategy for determining when to trigger files.  It seems  
> like you might just want to mix the FixedWindowRollingPolicy (which  
> provides .1, .2, etc file names) with a TimeBasedTriggeringPolicy.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Renaming-log-file-tp15128382p15183091.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Renaming log file

Posted by Curt Arnold <ca...@apache.org>.
On Jan 28, 2008, at 6:47 AM, James A. N. Stauffer wrote:

> I'm not sure what you want but RollingFileAppender will make files
> like what you want.

If you do need to write custom code, I would recommend writing a  
custom RollingPolicy for the  
org.apache.log4j.rolling.RollingFileAppender (o.a.l.r.RFA) in the  
extras companion (http://logging.apache.org/companions/extras).  The  
o.a.l.r.RFA was designed to support pluggable RollingPolicies which  
provide the strategy for renaming files and TriggeringPolicies which  
provide the strategy for determining when to trigger files.  It seems  
like you might just want to mix the FixedWindowRollingPolicy (which  
provides .1, .2, etc file names) with a TimeBasedTriggeringPolicy.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Renaming log file

Posted by "James A. N. Stauffer" <st...@gmail.com>.
I'm not sure what you want but RollingFileAppender will make files
like what you want.

On Jan 27, 2008 10:52 PM, anoobthomas <an...@gmail.com> wrote:
>
> Currently I am using Daily Rolling File Appender to generate log files.
>
> I want to rename my log file from "ABC.log2008-1-27" to "ABC.log number
> sequence" , like "ABC.log1","ABC.log2" and so on.
>
> Should I create a custom appender or are there any appenders that generate
> this format.
> If I have to create a custom appender please let me know how to do it.
> --
> View this message in context: http://www.nabble.com/Renaming-log-file-tp15128382p15128382.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>



-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org