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 Darren Hall <dh...@utrs.com> on 2006/06/14 23:34:50 UTC

Dynamic log names

Question for everyone,

 

I'm generating two log files, an event log and an error log using Log4j
1.2.13 and Struts 1.2.9 on Tomcat 5.5 on a Windows Pro dev box.

Currently I'm using the FileAppender class to generate the logs.

 

What I'd like to do is generate daily logs with a filename along the lines
of uwaf-event.2006-05-03.log and uwaf-error.2006-05-03.log.

Meaning I'd like to append the date into the name of the log file.

 

How would I go about doing this?

And do I need to use a different class to generate the log (maybe
RollingFileAppender or DailyFileAppender)?

 

Thanks,

 

Darren


Re: Dynamic log names

Posted by James Stauffer <st...@gmail.com>.
Neither my appender nor DailyRollingFileAppender will make a new file
until there is a new log to add to the file.  The first time that
happens after midnight a new file is created.

On 6/16/06, oops shin <sh...@gmail.com> wrote:
> Hi. James Stauffer..
>
> Did you test your appender make new file after midnight?
>
> First that made new logfile with exact name.
> but I found DateFormatFileAppender didn't rolling log file...
>
> Maybe that's my fault....
> but how about check again?
>
> 2006/6/15, James Stauffer <st...@gmail.com>:
> > I have also written a new appender that is even more configurable.
> > The date can be in any part of the file.
> > http://stauffer.james.googlepages.com/DateFormatFileAppender.java
> >
> > On 6/15/06, Darren Hall <dh...@utrs.com> wrote:
> > > I've answered my own question.
> > >
> > > For those interested -
> > > The Log4j documentation doesn't appear to say anything about handling
> > > dynamic log names as I've described. The closest thing seems to be the
> > > DailyRollingAppender - however it appends the date after the '.log' (i.e.
> > > "error.log.06-15-2006").
> > >
> > > I was able to find a library online from minaret.biz that does handle the
> > > job. It will produce log file names in a [prefix].date.[suffix] format (i.e.
> > > "error.06-15-2006.log"), and by virtue of that, it will automatically create
> > > new log files when the date changes. For those interested, here's the link -
> > > http://minaret.biz/tips/datedFileAppender.html
> > >
> > > Thanks again for the help with everything,
> > >
> > > Darren
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Darren Hall [mailto:dhall@utrs.com]
> > > Sent: Thursday, June 15, 2006 8:47 AM
> > > To: 'Log4J Users List'
> > > Subject: RE: Dynamic log names
> > >
> > > DailyRollingAppender is the option I was thinking about...
> > > However, how do I specify a date in the name of my file?
> > >
> > > Thanks,
> > >
> > > Darren
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: James Stauffer [mailto:stauffer.james@gmail.com]
> > > Sent: Wednesday, June 14, 2006 10:09 PM
> > > To: Log4J Users List
> > > Subject: Re: Dynamic log names
> > >
> > > DailyRollingAppender will do something close to that.  Give it a try.
> > > One difference is that the file will end with the date (not ".log")
> > > and the current file doesn't have the date in the name.
> > >
> > > On 6/14/06, Darren Hall <dh...@utrs.com> wrote:
> > > > Question for everyone,
> > > >
> > > >
> > > >
> > > > I'm generating two log files, an event log and an error log using Log4j
> > > > 1.2.13 and Struts 1.2.9 on Tomcat 5.5 on a Windows Pro dev box.
> > > >
> > > > Currently I'm using the FileAppender class to generate the logs.
> > > >
> > > >
> > > >
> > > > What I'd like to do is generate daily logs with a filename along the lines
> > > > of uwaf-event.2006-05-03.log and uwaf-error.2006-05-03.log.
> > > >
> > > > Meaning I'd like to append the date into the name of the log file.
> > > >
> > > >
> > > >
> > > > How would I go about doing this?
> > > >
> > > > And do I need to use a different class to generate the log (maybe
> > > > RollingFileAppender or DailyFileAppender)?
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > >
> > > >
> > > > Darren
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > James Stauffer
> > > 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
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> >
> >
> > --
> > James Stauffer
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer
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: Dynamic log names

Posted by oops shin <sh...@gmail.com>.
Hi. James Stauffer..

Did you test your appender make new file after midnight?

First that made new logfile with exact name.
but I found DateFormatFileAppender didn't rolling log file...

Maybe that's my fault....
but how about check again?

2006/6/15, James Stauffer <st...@gmail.com>:
> I have also written a new appender that is even more configurable.
> The date can be in any part of the file.
> http://stauffer.james.googlepages.com/DateFormatFileAppender.java
>
> On 6/15/06, Darren Hall <dh...@utrs.com> wrote:
> > I've answered my own question.
> >
> > For those interested -
> > The Log4j documentation doesn't appear to say anything about handling
> > dynamic log names as I've described. The closest thing seems to be the
> > DailyRollingAppender - however it appends the date after the '.log' (i.e.
> > "error.log.06-15-2006").
> >
> > I was able to find a library online from minaret.biz that does handle the
> > job. It will produce log file names in a [prefix].date.[suffix] format (i.e.
> > "error.06-15-2006.log"), and by virtue of that, it will automatically create
> > new log files when the date changes. For those interested, here's the link -
> > http://minaret.biz/tips/datedFileAppender.html
> >
> > Thanks again for the help with everything,
> >
> > Darren
> >
> >
> >
> > -----Original Message-----
> > From: Darren Hall [mailto:dhall@utrs.com]
> > Sent: Thursday, June 15, 2006 8:47 AM
> > To: 'Log4J Users List'
> > Subject: RE: Dynamic log names
> >
> > DailyRollingAppender is the option I was thinking about...
> > However, how do I specify a date in the name of my file?
> >
> > Thanks,
> >
> > Darren
> >
> >
> >
> > -----Original Message-----
> > From: James Stauffer [mailto:stauffer.james@gmail.com]
> > Sent: Wednesday, June 14, 2006 10:09 PM
> > To: Log4J Users List
> > Subject: Re: Dynamic log names
> >
> > DailyRollingAppender will do something close to that.  Give it a try.
> > One difference is that the file will end with the date (not ".log")
> > and the current file doesn't have the date in the name.
> >
> > On 6/14/06, Darren Hall <dh...@utrs.com> wrote:
> > > Question for everyone,
> > >
> > >
> > >
> > > I'm generating two log files, an event log and an error log using Log4j
> > > 1.2.13 and Struts 1.2.9 on Tomcat 5.5 on a Windows Pro dev box.
> > >
> > > Currently I'm using the FileAppender class to generate the logs.
> > >
> > >
> > >
> > > What I'd like to do is generate daily logs with a filename along the lines
> > > of uwaf-event.2006-05-03.log and uwaf-error.2006-05-03.log.
> > >
> > > Meaning I'd like to append the date into the name of the log file.
> > >
> > >
> > >
> > > How would I go about doing this?
> > >
> > > And do I need to use a different class to generate the log (maybe
> > > RollingFileAppender or DailyFileAppender)?
> > >
> > >
> > >
> > > Thanks,
> > >
> > >
> > >
> > > Darren
> > >
> > >
> > >
> >
> >
> > --
> > James Stauffer
> > 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
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> James Stauffer
> 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
>
>

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


Re: Dynamic log names

Posted by James Stauffer <st...@gmail.com>.
I have also written a new appender that is even more configurable.
The date can be in any part of the file.
http://stauffer.james.googlepages.com/DateFormatFileAppender.java

On 6/15/06, Darren Hall <dh...@utrs.com> wrote:
> I've answered my own question.
>
> For those interested -
> The Log4j documentation doesn't appear to say anything about handling
> dynamic log names as I've described. The closest thing seems to be the
> DailyRollingAppender - however it appends the date after the '.log' (i.e.
> "error.log.06-15-2006").
>
> I was able to find a library online from minaret.biz that does handle the
> job. It will produce log file names in a [prefix].date.[suffix] format (i.e.
> "error.06-15-2006.log"), and by virtue of that, it will automatically create
> new log files when the date changes. For those interested, here's the link -
> http://minaret.biz/tips/datedFileAppender.html
>
> Thanks again for the help with everything,
>
> Darren
>
>
>
> -----Original Message-----
> From: Darren Hall [mailto:dhall@utrs.com]
> Sent: Thursday, June 15, 2006 8:47 AM
> To: 'Log4J Users List'
> Subject: RE: Dynamic log names
>
> DailyRollingAppender is the option I was thinking about...
> However, how do I specify a date in the name of my file?
>
> Thanks,
>
> Darren
>
>
>
> -----Original Message-----
> From: James Stauffer [mailto:stauffer.james@gmail.com]
> Sent: Wednesday, June 14, 2006 10:09 PM
> To: Log4J Users List
> Subject: Re: Dynamic log names
>
> DailyRollingAppender will do something close to that.  Give it a try.
> One difference is that the file will end with the date (not ".log")
> and the current file doesn't have the date in the name.
>
> On 6/14/06, Darren Hall <dh...@utrs.com> wrote:
> > Question for everyone,
> >
> >
> >
> > I'm generating two log files, an event log and an error log using Log4j
> > 1.2.13 and Struts 1.2.9 on Tomcat 5.5 on a Windows Pro dev box.
> >
> > Currently I'm using the FileAppender class to generate the logs.
> >
> >
> >
> > What I'd like to do is generate daily logs with a filename along the lines
> > of uwaf-event.2006-05-03.log and uwaf-error.2006-05-03.log.
> >
> > Meaning I'd like to append the date into the name of the log file.
> >
> >
> >
> > How would I go about doing this?
> >
> > And do I need to use a different class to generate the log (maybe
> > RollingFileAppender or DailyFileAppender)?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Darren
> >
> >
> >
>
>
> --
> James Stauffer
> 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
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer
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: Dynamic log names

Posted by Darren Hall <dh...@utrs.com>.
I've answered my own question.

For those interested -
The Log4j documentation doesn't appear to say anything about handling
dynamic log names as I've described. The closest thing seems to be the
DailyRollingAppender - however it appends the date after the '.log' (i.e.
"error.log.06-15-2006").

I was able to find a library online from minaret.biz that does handle the
job. It will produce log file names in a [prefix].date.[suffix] format (i.e.
"error.06-15-2006.log"), and by virtue of that, it will automatically create
new log files when the date changes. For those interested, here's the link -
http://minaret.biz/tips/datedFileAppender.html

Thanks again for the help with everything,

Darren



-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Thursday, June 15, 2006 8:47 AM
To: 'Log4J Users List'
Subject: RE: Dynamic log names

DailyRollingAppender is the option I was thinking about...
However, how do I specify a date in the name of my file?

Thanks,

Darren



-----Original Message-----
From: James Stauffer [mailto:stauffer.james@gmail.com] 
Sent: Wednesday, June 14, 2006 10:09 PM
To: Log4J Users List
Subject: Re: Dynamic log names

DailyRollingAppender will do something close to that.  Give it a try.
One difference is that the file will end with the date (not ".log")
and the current file doesn't have the date in the name.

On 6/14/06, Darren Hall <dh...@utrs.com> wrote:
> Question for everyone,
>
>
>
> I'm generating two log files, an event log and an error log using Log4j
> 1.2.13 and Struts 1.2.9 on Tomcat 5.5 on a Windows Pro dev box.
>
> Currently I'm using the FileAppender class to generate the logs.
>
>
>
> What I'd like to do is generate daily logs with a filename along the lines
> of uwaf-event.2006-05-03.log and uwaf-error.2006-05-03.log.
>
> Meaning I'd like to append the date into the name of the log file.
>
>
>
> How would I go about doing this?
>
> And do I need to use a different class to generate the log (maybe
> RollingFileAppender or DailyFileAppender)?
>
>
>
> Thanks,
>
>
>
> Darren
>
>
>


-- 
James Stauffer
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





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





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


RE: Dynamic log names

Posted by Darren Hall <dh...@utrs.com>.
DailyRollingAppender is the option I was thinking about...
However, how do I specify a date in the name of my file?

Thanks,

Darren



-----Original Message-----
From: James Stauffer [mailto:stauffer.james@gmail.com] 
Sent: Wednesday, June 14, 2006 10:09 PM
To: Log4J Users List
Subject: Re: Dynamic log names

DailyRollingAppender will do something close to that.  Give it a try.
One difference is that the file will end with the date (not ".log")
and the current file doesn't have the date in the name.

On 6/14/06, Darren Hall <dh...@utrs.com> wrote:
> Question for everyone,
>
>
>
> I'm generating two log files, an event log and an error log using Log4j
> 1.2.13 and Struts 1.2.9 on Tomcat 5.5 on a Windows Pro dev box.
>
> Currently I'm using the FileAppender class to generate the logs.
>
>
>
> What I'd like to do is generate daily logs with a filename along the lines
> of uwaf-event.2006-05-03.log and uwaf-error.2006-05-03.log.
>
> Meaning I'd like to append the date into the name of the log file.
>
>
>
> How would I go about doing this?
>
> And do I need to use a different class to generate the log (maybe
> RollingFileAppender or DailyFileAppender)?
>
>
>
> Thanks,
>
>
>
> Darren
>
>
>


-- 
James Stauffer
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





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


Re: Dynamic log names

Posted by James Stauffer <st...@gmail.com>.
DailyRollingAppender will do something close to that.  Give it a try.
One difference is that the file will end with the date (not ".log")
and the current file doesn't have the date in the name.

On 6/14/06, Darren Hall <dh...@utrs.com> wrote:
> Question for everyone,
>
>
>
> I'm generating two log files, an event log and an error log using Log4j
> 1.2.13 and Struts 1.2.9 on Tomcat 5.5 on a Windows Pro dev box.
>
> Currently I'm using the FileAppender class to generate the logs.
>
>
>
> What I'd like to do is generate daily logs with a filename along the lines
> of uwaf-event.2006-05-03.log and uwaf-error.2006-05-03.log.
>
> Meaning I'd like to append the date into the name of the log file.
>
>
>
> How would I go about doing this?
>
> And do I need to use a different class to generate the log (maybe
> RollingFileAppender or DailyFileAppender)?
>
>
>
> Thanks,
>
>
>
> Darren
>
>
>


-- 
James Stauffer
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