Hi,
I have a problem with DEBUG messages being printed in the SystemOut.log file.
we have migrated from WSAD version 4 to WSAD 5.1 and we are encountering that
commons-logging does not consider
the level assigned in the log4j.properties.It seems that It is reading the
log4j.properties that I provided
since i kept a pattern to print and it prints in the pattern specified but
somehow ignores the priority.
Even the code written to use the commons-logging is not pretty too..
the java classes which are getting logfactory and using that log instance are
not having any problems.
We have a common utility class called Debug.java and the referring classes for
example: MyTestDAO.java
are invoking the methods on the Debug.java to do the logging are ignoring the
log4j.properties priorities.
Attached is the Debug.java, and the MyTestDAO.java and log4j.properties
Environment:-WSAD 5.1(WebSphere Studio Application Developer) WAS (WebSphere
Application Server) 5.1
jar file :- commons-logging-1.0.4.jar
we have commons-logging.properties with the following entry :-
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory
any help would be appreciated,
Thanks,
<<log4j.properties.txt>> <<Debug.java.txt>> <<MyTestDAO.java.txt>>
log4j.rootLogger=WARN, A1, R
# Build Test
# Filter log messages from org.apache packages
log4j.logger.org.apache=WARN
log4j.logger.us.il.common.util.Debug=WARN
############################################################
# A1 is the ConsoleAppender that outputs to the Console
# file called error.log.
############################################################
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=[DAP] %-5p %c - %m
#%-5p %c{1} - %m
############################################################
# R is the RollingFileAppender that outputs to an error log
# file called dap.log.
############################################################
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=c:/test.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{ISO8601} %-5p %c{1} - %m%n
############################################################
# S is the FileAppender that outputs the scheduler log
# file called scheduler.log
############################################################
log4j.appender.S=org.apache.log4j.FileAppender
log4j.appender.S.File=c:/scheduler.log
log4j.appender.S.append=false
#log4j.appender.S.layout=org.apache.log4j.HTMLLayout
#log4j.appender.S.layout.LocationInfo=false
#log4j.appender.S.layout.Title=Scheduler Log
log4j.appender.S.layout=org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern=%d %-5p %m%n
package common.util;
/**********************************************************************************************
*
*
*
*
********************************************************************************************/
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class Debug
{
private static final Log log = LogFactory.getLog(Debug.class);
//
////////////////////////////////////////////////////////////////////
// DO NOT USE THIS CLASS use org.apache.commons.logging.Log instead
public static void println (String aMsg)
{
if (log.isDebugEnabled())
log.debug(aMsg);
}
////////////////////////////////////////////////////////////////////
// DO NOT USE THIS CLASS use org.apache.commons.logging.Log instead
public static void println (Object aObject)
{
if (log.isDebugEnabled())
log.debug(" "+ aObject);
}
////////////////////////////////////////////////////////////////////
// DO NOT USE THIS CLASS use org.apache.commons.logging.Log instead
public static void print (String aMessage)
{
if (log.isDebugEnabled())
log.debug(aMessage);
}
}import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import common.util.Debug;
public abstract class AbstractDAOImpl {
private static Log log = LogFactory.getLog(FQCN);
protected void executeSql(String sqlString) throws DAOSysException,
DAODBUpdateException {
Debug.println ("AbstractDAO " + sqlString);
}
}---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]