Hi All,
I encounter a strange behaviour. I'm using commons-logging and log4j. this
is what happened.
i have an application named heart, and a similar aplication named
md-smslogger. both using a similar log4j.properties placed at
WEB-INF/classes.
weird things happened, heart only logs to stdout (to catalina.out at tomcat
5.5 or to server.log at glassfish), heart uses spring and some of my libs,
both write logs to file as it should be. but codes at servlets only write to
stdout.
i m using this class to get the Log
public class Logging {
/** Creates a new instance of Logging */
public Logging() {
}
public static Log getLogger(Object caller) {
Log logger = getLogger(caller.getClass());
return logger;
}
public static Log getLogger(Class clazz) {
Log logger =
(clazz != null) ?
LogFactory.getLog(clazz) :
LogFactory.getLog("Ricochet Log");
return logger;
}
}
and use it in code like this
Log log = Logging.getLogger(this);
log.info("fetched : " + raw);
the log4j properties of heart is as follow :
log4j.rootLogger=INFO,STDOUT,HEARTFILE
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.ConversionPattern=%5p %d{HH:mm:ss} [%t] %c{1} -
%M%n%m%n
log4j.appender.HEARTFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.HEARTFILE.DatePattern=yyyy-MM-dd
log4j.appender.HEARTFILE.layout.ConversionPattern=%5p %d{HH:mm:ss} [%t]
%c{1} - %M%n%m%n
log4j.appender.HEARTFILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.HEARTFILE.File=/opt/gateway/logs/LegacyEngine.log
log4j.logger.com.mchange=INFO
help, where have i gone wrong ? I already tried using log4j directly at the
servlet classes but it didn't solve the problem.
--
-Andre-