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 "Marc.Farrow" <ma...@gmail.com> on 2009/05/05 18:14:22 UTC

DailyRollingAppender - How does it know when to rollover?

I am trying to use LOG4J on OpenVMS.  However, my logger is not rolling over
on OpenVMS.  So I want to know how the code is determining when the log file
should be rolled over.  Below I am posting my code and properties file.  The
same code works on windows (of course, I have different properties file that
loads on windows).  For completeness sake, I am posting both properties
files.


package com.name.webpublishing.webpublishing;
public class WebPublishingApp {
    public static Logger logger = getLogger();
    private static Logger getLogger() {
        try {
            String osName =
System.getProperty("os.name").toLowerCase().equals("openvms") ? "openvms" :
"windows";
            InputStream is =
WebPublishingApp.class.getClassLoader().getResourceAsStream("/com/name/webpublishing/webpublishing/log4j_"
+ osName + ".properties");
            Properties props = new Properties();
            props.load(is);
            PropertyConfigurator.configure(props);
            System.out.println("LOADED PROPERTIES!!!");
        } catch (IOException ignored) {
            if (SeflWebPublishingServlet.DEBUG) {
                ignored.printStackTrace();
            }
            // just use default
        }
        return Logger.getLogger(WebPublishingApp.class);
    }
}

openvms properties - log4j_openvms.properties
log4j.rootLogger=WARN, R
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=LOG0:WebPublishing.log
log4j.appender.R.DatePattern='.'yyyy-MM
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.sefl.webpublishing=DEBUG

windows properties - log4j_windows.properties
log4j.rootLogger=WARN, R
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=C:/WebStatic/webtmp/WebPublishing.log
log4j.appender.R.DatePattern='.'yyyy-MM
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.sefl.webpublishing=DEBUG
-- 
View this message in context: http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23390773.html
Sent from the Log4j - Users mailing list archive at Nabble.com.

RE: DailyRollingAppender - How does it know when to rollover?

Posted by Marc Farrow <ma...@gmail.com>.
LOG0: is a logical on OpenVMS (similiar to a 'symbiant' or whatever it is
called on Unix/Linux).  This is a valid directory structure on the O.S.  

I will check the privileges for the account which Tomcat is running under to
verify.



Matt Brown-20 wrote:
> 
> What is "LOGO:"?
> 
> And are you sure the user the application runs under has sufficient access
> to create/rename files in whichever directory it is attempting to write
> to? 
> 
> -----Original Message-----
> From: Marc Farrow [mailto:marc.farrow@gmail.com] 
> Sent: Tuesday, May 19, 2009 8:09 AM
> To: log4j-user@logging.apache.org
> Subject: RE: DailyRollingAppender - How does it know when to rollover?
> 
> 
> 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
> 
-- 
View this message in context: http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23615776.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: DailyRollingAppender - How does it know when to rollover?

Posted by Matt Brown <Ma...@citrixOnline.com>.
What is "LOGO:"?

And are you sure the user the application runs under has sufficient access to create/rename files in whichever directory it is attempting to write to? 

-----Original Message-----
From: Marc Farrow [mailto:marc.farrow@gmail.com] 
Sent: Tuesday, May 19, 2009 8:09 AM
To: log4j-user@logging.apache.org
Subject: RE: DailyRollingAppender - How does it know when to rollover?


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:marc.farrow@gmail.com]
>> Sent: Monday, May 11, 2009 8:34 AM
>> To: log4j-user@logging.apache.org
>> 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: 
>>>> log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>> 
>>> 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: psmith@aconex.com  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: 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
>> 
>> 
>> 
> 
> 

--
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: 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: DailyRollingAppender - How does it know when to rollover?

Posted by Marc Farrow <ma...@gmail.com>.
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:marc.farrow@gmail.com] 
>> Sent: Monday, May 11, 2009 8:34 AM
>> To: log4j-user@logging.apache.org
>> 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: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>> 
>>> 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: psmith@aconex.com  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: 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
>> 
>> 
>> 
> 
> 

-- 
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: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: DailyRollingAppender - How does it know when to rollover?

Posted by Marc Farrow <ma...@gmail.com>.
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:marc.farrow@gmail.com] 
> Sent: Monday, May 11, 2009 8:34 AM
> To: log4j-user@logging.apache.org
> 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: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>
>> 
>> 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: psmith@aconex.com  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: 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23483680.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: DailyRollingAppender - How does it know when to rollover?

Posted by Matt Brown <Ma...@citrixOnline.com>.
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:marc.farrow@gmail.com] 
Sent: Monday, May 11, 2009 8:34 AM
To: log4j-user@logging.apache.org
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: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
> 
> 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: psmith@aconex.com  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: 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: DailyRollingAppender - How does it know when to rollover?

Posted by Marc Farrow <ma...@gmail.com>.
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: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
> 
> 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: psmith@aconex.com  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: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: DailyRollingAppender - How does it know when to rollover?

Posted by Paul Smith <ps...@aconex.com>.
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: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>

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: psmith@aconex.com  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.





RE: DailyRollingAppender - How does it know when to rollover?

Posted by Marc Farrow <ma...@gmail.com>.
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: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: DailyRollingAppender - How does it know when to rollover?

Posted by Marc Farrow <ma...@gmail.com>.
Also, to give further information.  In Java, you cannot read the "created"
date on a file as only certain operating systems understand it (namely,
OpenVMS and Windows).  So, how does the logging engine know when to roll
over?  Is it looking inside the log file for date patterns?  Here a sample
of my logging file.


INFO 2009-Apr-10 07:57:49.976 - USERNAME published pdfFile.pdf from
C:/webstatic/source/ to TMP0.
INFO 2009-Apr-10 07:57:49.979 - USERNAME published pdfFile2.pdf from
C:/webstatic/source/ to TMP0.
INFO 2009-Apr-10 08:05:30.848 - USERNAME published pdfFile.pdf from
C:/webstatic/source/ to TMP0.
INFO 2009-Apr-10 08:05:30.851 - USERNAME published pdfFile2.pdf from
C:/webstatic/source/ to TMP0.
INFO 2009-Apr-10 09:32:16.503 - USERNAME published pdfFile.pdf from
C:/webstatic/source/ to TMP0.
INFO 2009-Apr-10 09:32:16.504 - USERNAME published pdfFile2.pdf from
C:/webstatic/source/ to TMP0.
INFO 2009-May-05 10:53:35.722 - USERNAME published pdfFile.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 10:53:35.723 - USERNAME published pdfFile2.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 11:39:05.754 - USERNAME published pdfFile.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 11:39:05.755 - USERNAME published pdfFile2.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 11:43:35.942 - USERNAME published pdfFile.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 11:43:35.942 - USERNAME published pdfFile2.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 11:45:10.191 - USERNAME published pdfFile.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 11:45:10.191 - USERNAME published pdfFile2.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 13:13:38.857 - USERNAME published pdfFile.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 13:13:38.858 - USERNAME published pdfFile2.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 13:14:26.627 - USERNAME published pdfFile.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 13:14:26.627 - USERNAME published pdfFile2.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 13:15:08.601 - USERNAME published pdfFile.pdf from
c:/webstatic/source to TMP0.
INFO 2009-May-05 13:15:08.602 - USERNAME published pdfFile2.pdf from
c:/webstatic/source to TMP0.




Marc Farrow wrote:
> 
> Yes, this is what I am wanting.
> 
> The original log file was created in April and now when items are written
> to file the log file still has not been rolled over.
> 
> Since the application is writing to the specified log file, then wouldn't
> that mean that these properties posted would be the ones being used?
> 
> Thanks.
> 
> 
> Matt Brown-20 wrote:
>> 
>> The date pattern that you have:
>> 
>>     log4j.appender.R.DatePattern='.'yyyy-MM
>> 
>> 
>> Will only roll the files over on a monthly basis. Just want to be sure
>> that this is what you intend?
>> 
>> If this is the intended behavior, I'd check to make sure that a different
>> log4j configuration file isn't being loaded from somewhere in the OpenVMS
>> environment. You can enable the -Dlog4j.debug system property to be able
>> to see which config file log4j is using. 
>> 
>> -----Original Message-----
>> From: Marc.Farrow [mailto:marc.farrow@gmail.com] 
>> Sent: Tuesday, May 05, 2009 12:14 PM
>> To: log4j-user@logging.apache.org
>> Subject: DailyRollingAppender - How does it know when to rollover?
>> 
>> 
>> I am trying to use LOG4J on OpenVMS.  However, my logger is not rolling
>> over on OpenVMS.  So I want to know how the code is determining when the
>> log file should be rolled over.  Below I am posting my code and
>> properties file.  The same code works on windows (of course, I have
>> different properties file that loads on windows).  For completeness sake,
>> I am posting both properties files.
>> 
>> 
>> package com.name.webpublishing.webpublishing;
>> public class WebPublishingApp {
>>     public static Logger logger = getLogger();
>>     private static Logger getLogger() {
>>         try {
>>             String osName =
>> System.getProperty("os.name").toLowerCase().equals("openvms") ? "openvms"
>> :
>> "windows";
>>             InputStream is =
>> WebPublishingApp.class.getClassLoader().getResourceAsStream("/com/name/webpublishing/webpublishing/log4j_"
>> + osName + ".properties");
>>             Properties props = new Properties();
>>             props.load(is);
>>             PropertyConfigurator.configure(props);
>>             System.out.println("LOADED PROPERTIES!!!");
>>         } catch (IOException ignored) {
>>             if (SeflWebPublishingServlet.DEBUG) {
>>                 ignored.printStackTrace();
>>             }
>>             // just use default
>>         }
>>         return Logger.getLogger(WebPublishingApp.class);
>>     }
>> }
>> 
>> openvms properties - log4j_openvms.properties log4j.rootLogger=WARN, R
>> log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
>> log4j.appender.R.File=LOG0:WebPublishing.log
>> log4j.appender.R.DatePattern='.'yyyy-MM
>> 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.sefl.webpublishing=DEBUG
>> 
>> windows properties - log4j_windows.properties log4j.rootLogger=WARN, R
>> log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
>> log4j.appender.R.File=C:/WebStatic/webtmp/WebPublishing.log
>> log4j.appender.R.DatePattern='.'yyyy-MM
>> 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.sefl.webpublishing=DEBUG
>> --
>> View this message in context:
>> http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23390773.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
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23392539.html
Sent from the Log4j - Users mailing list archive at Nabble.com.

RE: DailyRollingAppender - How does it know when to rollover?

Posted by Marc Farrow <ma...@gmail.com>.
Yes, this is what I am wanting.

The original log file was created in April and now when items are written to
file the log file still has not been rolled over.

Since the application is writing to the specified log file, then wouldn't
that mean that these properties posted would be the ones being used?

Thanks.


Matt Brown-20 wrote:
> 
> The date pattern that you have:
> 
>     log4j.appender.R.DatePattern='.'yyyy-MM
> 
> 
> Will only roll the files over on a monthly basis. Just want to be sure
> that this is what you intend?
> 
> If this is the intended behavior, I'd check to make sure that a different
> log4j configuration file isn't being loaded from somewhere in the OpenVMS
> environment. You can enable the -Dlog4j.debug system property to be able
> to see which config file log4j is using. 
> 
> -----Original Message-----
> From: Marc.Farrow [mailto:marc.farrow@gmail.com] 
> Sent: Tuesday, May 05, 2009 12:14 PM
> To: log4j-user@logging.apache.org
> Subject: DailyRollingAppender - How does it know when to rollover?
> 
> 
> I am trying to use LOG4J on OpenVMS.  However, my logger is not rolling
> over on OpenVMS.  So I want to know how the code is determining when the
> log file should be rolled over.  Below I am posting my code and properties
> file.  The same code works on windows (of course, I have different
> properties file that loads on windows).  For completeness sake, I am
> posting both properties files.
> 
> 
> package com.name.webpublishing.webpublishing;
> public class WebPublishingApp {
>     public static Logger logger = getLogger();
>     private static Logger getLogger() {
>         try {
>             String osName =
> System.getProperty("os.name").toLowerCase().equals("openvms") ? "openvms"
> :
> "windows";
>             InputStream is =
> WebPublishingApp.class.getClassLoader().getResourceAsStream("/com/name/webpublishing/webpublishing/log4j_"
> + osName + ".properties");
>             Properties props = new Properties();
>             props.load(is);
>             PropertyConfigurator.configure(props);
>             System.out.println("LOADED PROPERTIES!!!");
>         } catch (IOException ignored) {
>             if (SeflWebPublishingServlet.DEBUG) {
>                 ignored.printStackTrace();
>             }
>             // just use default
>         }
>         return Logger.getLogger(WebPublishingApp.class);
>     }
> }
> 
> openvms properties - log4j_openvms.properties log4j.rootLogger=WARN, R
> log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.R.File=LOG0:WebPublishing.log
> log4j.appender.R.DatePattern='.'yyyy-MM
> 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.sefl.webpublishing=DEBUG
> 
> windows properties - log4j_windows.properties log4j.rootLogger=WARN, R
> log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.R.File=C:/WebStatic/webtmp/WebPublishing.log
> log4j.appender.R.DatePattern='.'yyyy-MM
> 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.sefl.webpublishing=DEBUG
> --
> View this message in context:
> http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23390773.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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23392469.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: DailyRollingAppender - How does it know when to rollover?

Posted by Matt Brown <Ma...@citrixOnline.com>.
The date pattern that you have:

    log4j.appender.R.DatePattern='.'yyyy-MM


Will only roll the files over on a monthly basis. Just want to be sure that this is what you intend?

If this is the intended behavior, I'd check to make sure that a different log4j configuration file isn't being loaded from somewhere in the OpenVMS environment. You can enable the -Dlog4j.debug system property to be able to see which config file log4j is using. 

-----Original Message-----
From: Marc.Farrow [mailto:marc.farrow@gmail.com] 
Sent: Tuesday, May 05, 2009 12:14 PM
To: log4j-user@logging.apache.org
Subject: DailyRollingAppender - How does it know when to rollover?


I am trying to use LOG4J on OpenVMS.  However, my logger is not rolling over on OpenVMS.  So I want to know how the code is determining when the log file should be rolled over.  Below I am posting my code and properties file.  The same code works on windows (of course, I have different properties file that loads on windows).  For completeness sake, I am posting both properties files.


package com.name.webpublishing.webpublishing;
public class WebPublishingApp {
    public static Logger logger = getLogger();
    private static Logger getLogger() {
        try {
            String osName =
System.getProperty("os.name").toLowerCase().equals("openvms") ? "openvms" :
"windows";
            InputStream is =
WebPublishingApp.class.getClassLoader().getResourceAsStream("/com/name/webpublishing/webpublishing/log4j_"
+ osName + ".properties");
            Properties props = new Properties();
            props.load(is);
            PropertyConfigurator.configure(props);
            System.out.println("LOADED PROPERTIES!!!");
        } catch (IOException ignored) {
            if (SeflWebPublishingServlet.DEBUG) {
                ignored.printStackTrace();
            }
            // just use default
        }
        return Logger.getLogger(WebPublishingApp.class);
    }
}

openvms properties - log4j_openvms.properties log4j.rootLogger=WARN, R log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=LOG0:WebPublishing.log
log4j.appender.R.DatePattern='.'yyyy-MM
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.sefl.webpublishing=DEBUG

windows properties - log4j_windows.properties log4j.rootLogger=WARN, R log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=C:/WebStatic/webtmp/WebPublishing.log
log4j.appender.R.DatePattern='.'yyyy-MM
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.sefl.webpublishing=DEBUG
--
View this message in context: http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23390773.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