logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Farrow <marc.far...@gmail.com>
Subject RE: DailyRollingAppender - How does it know when to rollover?
Date Tue, 05 May 2009 17:48:54 GMT

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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message