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 Andrew Marlow <An...@icap.com> on 2007/03/23 16:02:53 UTC
Enh rqst: a variation on DailyRollingFileAppender
guys,
I am using DailyRollingFileAppender to have an AM and PM log for each
day. This isn't quite what I want but is close enough for now. What I
would really like is an appender that writes directly to the target
file, rather than it writing it to a different file and rolling that
file over at a certain time. It's the rolling over that I don't like. I
have had some weird problems where log4j sometimes complains that it
cannot do the rollover at startup.
Here is an example of how a logger worked that I was using before I
started using log4j.
The logfile name was of the form <prefix>yyyymmdd-w.txt where w is a
watch number. The day is divided into 6 watches of 4 hours each, i.e.
0000->0400, 0400->0800, 0800-1200, 1200->1600, 1600->2000 and
2000->2400. Each time a call is made to the logger it ensures that it is
writing to the correct logfile for the current watch. If the file exists
the record is appended, if the file does not exist it is created.
The advantage of this system is that you always know which logfile to
look at and you dont need to worry about rollover. Is there any chance
of log4j being able to offer this facility please?
Regards,
Andrew Marlow
----
There is an emerald here the size of a plover's egg!
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
******************************************************************************"
The data and information (collectively called Information) herein is the sole property of ICAP. The Information is confidential, may be legally privileged and is intended solely for the use of the individual or entity to whom it is addressed. Unauthorised disclosure, copying or distribution of the Information is strictly prohibited and the recipient of the Information shall not redistribute the Information in any form to a third party. If you received this Information in error please tell us by reply (or telephone the sender) and delete all copies on your system.
References in this Information to ICAP are references to ICAP plc, a company incorporated in England with registered number 3611426 whose registered office is 2 Broadgate, London, EC2M 7UR and where the context requires, includes its subsidiary and associated undertakings. As applicable, certain companies within the ICAP group are authorised and regulated by the Financial Services Authority. Any investment research sent from ICAP will provide an impartial and objective assessment of the securities, companies or other matters that are the subject of their research and our Conflicts of Interest Management Policy regarding investment research can be viewed by requesting a copy from your usual contact at ICAP. Please visit www.icap.com for further regulatory information including details regarding the European eCommerce Directive.
*******************************************************************************"
We have taken precautions to minimise the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. "
*******************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Enh rqst: a variation on DailyRollingFileAppender
Posted by James Stauffer <st...@gmail.com>.
I wrote an appender that always uses the formatted name.
http://stauffer.james.googlepages.com/DateFormatFileAppender.java
On 3/23/07, Andrew Marlow <An...@icap.com> wrote:
> guys,
>
> I am using DailyRollingFileAppender to have an AM and PM log for each
> day. This isn't quite what I want but is close enough for now. What I
> would really like is an appender that writes directly to the target
> file, rather than it writing it to a different file and rolling that
> file over at a certain time. It's the rolling over that I don't like. I
> have had some weird problems where log4j sometimes complains that it
> cannot do the rollover at startup.
>
> Here is an example of how a logger worked that I was using before I
> started using log4j.
>
> The logfile name was of the form <prefix>yyyymmdd-w.txt where w is a
> watch number. The day is divided into 6 watches of 4 hours each, i.e.
> 0000->0400, 0400->0800, 0800-1200, 1200->1600, 1600->2000 and
> 2000->2400. Each time a call is made to the logger it ensures that it is
> writing to the correct logfile for the current watch. If the file exists
> the record is appended, if the file does not exist it is created.
>
> The advantage of this system is that you always know which logfile to
> look at and you dont need to worry about rollover. Is there any chance
> of log4j being able to offer this facility please?
>
> Regards,
>
> Andrew Marlow
> ----
> There is an emerald here the size of a plover's egg!
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please http://www.expita.com/nomime.html
>
>
> ******************************************************************************"
> The data and information (collectively called Information) herein is the sole property of ICAP. The Information is confidential, may be legally privileged and is intended solely for the use of the individual or entity to whom it is addressed. Unauthorised disclosure, copying or distribution of the Information is strictly prohibited and the recipient of the Information shall not redistribute the Information in any form to a third party. If you received this Information in error please tell us by reply (or telephone the sender) and delete all copies on your system.
>
> References in this Information to ICAP are references to ICAP plc, a company incorporated in England with registered number 3611426 whose registered office is 2 Broadgate, London, EC2M 7UR and where the context requires, includes its subsidiary and associated undertakings. As applicable, certain companies within the ICAP group are authorised and regulated by the Financial Services Authority. Any investment research sent from ICAP will provide an impartial and objective assessment of the securities, companies or other matters that are the subject of their research and our Conflicts of Interest Management Policy regarding investment research can be viewed by requesting a copy from your usual contact at ICAP. Please visit www.icap.com for further regulatory information including details regarding the European eCommerce Directive.
>
> *******************************************************************************"
> We have taken precautions to minimise the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. "
> *******************************************************************************
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
James 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: Enh rqst: a variation on DailyRollingFileAppender
Posted by James Stauffer <st...@gmail.com>.
Can you give details so I can determine if my appender has similiar problems?
On 3/23/07, Curt Arnold <ca...@apache.org> wrote:
>
> On Mar 23, 2007, at 1:12 PM, James Stauffer wrote:
>
> > What problem are there? I am using my DateFormatFileAppender
> > extensively in production (web app) and haven't noticed any issues.
> >
>
> The comment only applied to org.apache.log4j.RollingFileAppender and
> org.apache.log4j.DailyRollingFileAppender. I did not mean to make
> any statement on your DateFormatFileAppender.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
James 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: Enh rqst: a variation on DailyRollingFileAppender
Posted by Curt Arnold <ca...@apache.org>.
On Mar 23, 2007, at 1:12 PM, James Stauffer wrote:
> What problem are there? I am using my DateFormatFileAppender
> extensively in production (web app) and haven't noticed any issues.
>
The comment only applied to org.apache.log4j.RollingFileAppender and
org.apache.log4j.DailyRollingFileAppender. I did not mean to make
any statement on your DateFormatFileAppender.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Enh rqst: a variation on DailyRollingFileAppender
Posted by James Stauffer <st...@gmail.com>.
What problem are there? I am using my DateFormatFileAppender
extensively in production (web app) and haven't noticed any issues.
On 3/23/07, Curt Arnold <ca...@apache.org> wrote:
> The renaming and close then reopen logic in the rolling file
> appenders are problematic. There was some discussion and some code
> on MultiFileAppender back in October that was trying to address
> problems like having distinct log files per thread, but could also
> address some of the same issues as the RollingFileAppenders but
> without ever renaming files. However, I got distracted and haven't
> been able to get back to it. Search the archives if you are
> interested in the back story.
--
James 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: Enh rqst: a variation on DailyRollingFileAppender
Posted by Curt Arnold <ca...@apache.org>.
On Mar 23, 2007, at 10:02 AM, Andrew Marlow wrote:
> guys,
>
> I am using DailyRollingFileAppender to have an AM and PM log for each
> day. This isn't quite what I want but is close enough for now. What I
> would really like is an appender that writes directly to the target
> file, rather than it writing it to a different file and rolling that
> file over at a certain time. It's the rolling over that I don't like.
The renaming and close then reopen logic in the rolling file
appenders are problematic. There was some discussion and some code
on MultiFileAppender back in October that was trying to address
problems like having distinct log files per thread, but could also
address some of the same issues as the RollingFileAppenders but
without ever renaming files. However, I got distracted and haven't
been able to get back to it. Search the archives if you are
interested in the back story.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org