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

Reply via email to