I finally got around to this again. I changed the rollover time to be in
seconds so I should get a new log with each execution. When I run the app,
I get a new log, but the rolled over file is not created. I cannot find a
file with my matching DatePattern. Below is my Properties file.
log4j.rootLogger=WARN, R
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=LOG0:MyLogFile.log
log4j.appender.R.DatePattern='.'yyyy-MM-dd-mm-ss
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %d{yyyy-MMM-dd HH:mm:ss.SSS} -
%m%n
log4j.appender.R.ImmediateFlush=true
log4j.logger.com.company.myfile=INFO
Anyone have any suggestions?
Thanks.
Marc
Marc Farrow wrote:
>
> I haven't done this because my brain is too one-dimensional today. Great
> suggestion.
>
> Thanks.
>
> Marc
>
>
>
> Matt Brown-20 wrote:
>>
>>
>> Just a suggestion, but if this is a development server, and the
>> application is already getting re-deployed more than daily, why not
>> experiment with a smaller rollover time (daily or hourly)? Just to make
>> sure that DailyRollingAppender isn't somehow borked in your combination
>> of OS / app server / application.
>>
>> -----Original Message-----
>> From: Marc Farrow [mailto:[email protected]]
>> Sent: Monday, May 11, 2009 8:34 AM
>> To: [email protected]
>> Subject: Re: DailyRollingAppender - How does it know when to rollover?
>>
>>
>> I checked the log file for my container (Tomcat) and there were no error
>> messages that I could see for any rollover messages. However, I guess I
>> am going to have to wait til next month to verify. Since my container is
>> Tomcat and my container gets restarted fairly often (multiple times a day
>> because this is a our development server), could this affect the rollover
>> logic?
>>
>> Thank you,
>>
>> Marc
>>
>>
>>
>> Paul Smith-2 wrote:
>>>
>>> the first logging event _after_ the time period computed should roll
>>> the file over, however if there is any failure (perhaps because
>>> another process has the file handle open, a common problem on
>>> Windows), the rollover can fail, and you'll need to wait to the next
>>> window (another month).
>>>
>>> When the failure occurs, it does log to StdErr (from the source code
>>> to DailyRollingFileAppender):
>>>
>>> protected void subAppend(LoggingEvent event) {
>>> long n = System.currentTimeMillis();
>>> if (n >= nextCheck) {
>>> now.setTime(n);
>>> nextCheck = rc.getNextCheckMillis(now);
>>> try {
>>> rollOver();
>>> }
>>> catch(IOException ioe) {
>>> if (ioe instanceof InterruptedIOException) {
>>> Thread.currentThread().interrupt();
>>> }
>>> LogLog.error("rollOver() failed.", ioe);
>>> }
>>> }
>>> super.subAppend(event);
>>> }
>>>
>>> It tries it's best to continue logging until next roll over period.
>>>
>>> Paul
>>>
>>> On 11/05/2009, at 9:31 PM, Marc Farrow wrote:
>>>
>>>>
>>>> This is a fairly simple question. Does anyone that maintains or
>>>> create LOG4J read these posts anymore?
>>>>
>>>> Thanks.
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to
>>>> -rollover--tp23390773p23481523.html
>>>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>
>>> Paul Smith
>>> Production Engineering Manager
>>>
>>> Aconex
>>> The easy way to save time and money on your project
>>>
>>> 696 Bourke Street, Melbourne,
>>> VIC 3000, Australia
>>> Tel: +61 3 9240 0200 Fax: +61 3 9240 0299
>>> Email: [email protected] www.aconex.com
>>>
>>> This email and any attachments are intended solely for the addressee.
>>> The contents may be privileged, confidential and/or subject to
>>> copyright or other applicable law. No confidentiality or privilege is
>>> lost by an erroneous transmission. If you have received this e-mail in
>>> error, please let us know by reply e-mail and delete or destroy this
>>> mail and all copies. If you are not the intended recipient of this
>>> message you must not disseminate, copy or take any action in reliance
>>> on it. The sender takes no responsibility for the effect of this
>>> message upon the recipient's computer system.
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23482416.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23615059.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]