Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Log4j With Tomcat

    I have been trying to get my application to log using the log4j jar. It works fine in Dev Mode, but when I deploy it to tomcat the log files denoted by the configuration don't even seem to appear.

    The following log4j.properties file is in my war directory for my app:
    Code:
    log4j.rootLogger=ALL, main, error
    
    log4j.appender.main=org.apache.log4j.RollingFileAppender
    log4j.appender.main.maxFileSize=100KB
    log4j.appender.main.maxBackupIndex=5
    log4j.appender.main.File=ramsi.log
    log4j.appender.main.threshold=debug
    log4j.appender.main.layout=org.apache.log4j.PatternLayout
    log4j.appender.main.layout.ConversionPattern=%d{HH:mm:ss MM-dd-yyyy} %5p - %m%n
    
    log4j.appender.error=org.apache.log4j.RollingFileAppender
    log4j.appender.error.maxFileSize=100KB
    log4j.appender.error.maxBackupIndex=5
    log4j.appender.error.File=error.log
    log4j.appender.error.threshold=error
    log4j.appender.error.layout=org.apache.log4j.PatternLayout
    log4j.appender.error.layout.ConversionPattern=%d{HH:mm:ss MM-dd-yyyy} %5p - %m%n
    Just to get it working I have a simple class with static log methods only accessing the rootLogger:

    Code:
    public class MyLogger {
    	
    	private static Logger LOGGER = Logger.getRootLogger();
    
            static public void doInfo(String className, String message) {
    		LOGGER.info(className + " - " + message);
    	}
    }
    On server side calls I simply have statements such as:

    Code:
    MyLogger.doInfo(UserServiceImpl.class.getName(), "Getting User information for " + temp.getName());
    Are there settings within the Tomcat environment to allow application specific use of log4j, or am I simply going about this wrong?

    #2
    Not really smartgwt related, best to post in the apache forums. But to help you along

    1) Properties file in your classpath or loaded correctly?
    2) Lib correctly placed in the lib directory?
    3) no logs in the root directory at all?

    Comment

    Working...
    X