You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Lydia P <ly...@attglobal.net> on 2003/02/11 15:15:31 UTC
log4j and WSAD 5.0 anomalies and problems
Has anyone successfully got log4j running under the Websphere Studio
Application Developer v 5.0?
I had to migrate my WSAD 4.03 application to WSAD 5.0, which has a
totally different tree structure, but WSAD 5.0
is supposed to recognize and retain WSAD 4.03 structures.
I am not seeing log4j initialize in the console, yet, I see the class
loggers append to the console....the weird
thing is that I have them in the properties file logging to files - yet
no files are being created.
Maybe I dont fully understand how WSAD works with commons-logging and
log4j? I didnt think I had
to use a log4j initializing servlet which is mentioned in web.xml to
make it work - theoretically, my class
files should never have to change when I change logging tools?
Here is my setup:
I have commons-logging.jar and log4j-1.2.7.jar under the WEB-INF/lib
directory.
My commons-logging.properties file in the /WEB-INF/classes directory :
# commons logging config - use Log4J
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog
My log4j.properties file in the /WEB-INF/classes directory :
# log4j configuration file
# DEBUG, INFO, WARN, ERROR and FATAL
# Create three appenders, one called listout, one called stdout and
another called R
log4j.logger.com.com.ibm.lansys.actions=DEBUG, listout, stdout, R
log4j.logger.org.apache=DEBUG, listout ,stdout, R
# Create root (default) appender -default DEBUG and higher msgs go to
the console
log4j.rootCategory=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p %c [%t] (%F:%L) - %m%n
# sListAction writes to listout logfile
log4j.category.com.ibm.lansys.actions.SubsegListAction=DEBUG,listout
log4j.appender.listout=org.apache.log4j.FileAppender
log4j.appender.listout.File=d:\\wsad5\\logs\\listout.log
log4j.appender.listout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.listout.layout.ConversionPattern=%5p %d{MMM dd yyyy
HH:mm} (%F:%L) - %m%n
# R writes to example.log, clears the log every 100kb
#log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=d:\\wsad5\\logs\\dailyrolling.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
# Layout Pattern for the example.log file
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%5p %d{MMM dd yyyy HH:mm}
(%F:%L) - %m%n
Much thanks for any help you can give me!
Lydia P.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: log4j and WSAD 5.0 anomalies and problems
Posted by Ceki Gülcü <ce...@qos.ch>.
The culprit is the following code from
org.apache.commons.logging.impl.Log4JCategoryLog
private void initialize() {
Category root=Category.getRoot();
Enumeration appenders=root.getAllAppenders();
if( appenders==null || ! appenders.hasMoreElements() ) {
// No config, set some defaults ( consistent with
// commons-logging patterns ).
ConsoleAppender app=new ConsoleAppender(new PatternLayout(
LAYOUT ),
ConsoleAppender.SYSTEM_ERR
);
app.setName("commons-logging");
root.addAppender( app );
root.setPriority( Priority.INFO );
}
initialized=true;
}
As you can see it sets the level (a.k.a. priority) of root logger (a.k.a.
category) to INFO.
This problem has been reported as bug #13201 to commons-logging.
You may want to comment/vote on this bug at
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13201
At 10:58 11.02.2003 -0500, you wrote:
>This is totally weird......
>Check out the following test code:
>try {
> if (log.isDebugEnabled()) {
> log.debug("About to log something"
> +log.isDebugEnabled());
>
> }
>
> }catch(IllegalStateException e) {
> log.error("Something bad has happened: " + e);
> }
>
> log.info("Just Testing a log message with priority set to
> DEBUG ="+log.isDebugEnabled());
> log.info("Just testing a log message with priority set to INFO =
> "+ log.isInfoEnabled());
> log.warn("Just testing a log message with priority set to WARN = "
> + log.isWarnEnabled());
> log.error("Just testing a log message with priority set to ERROR =
> " + log.isErrorEnabled());
> log.fatal("Just testing a log message with priority set to FATAL =
> "+ log.isFatalEnabled());
>
>And here is what the console tells me:
>2/11/03 10:51:10:235 EST] 7ffa7525 SubsegListAct I
>com.ibm.lansys.actions.SubsegListAction Just Testing a log message with
>priority set to DEBUG =false
>[2/11/03 10:51:10:235 EST] 7ffa7525 SubsegListAct I
>com.ibm.lansys.actions.SubsegListAction Just testing a log message with
>priority set to INFO = true
>[2/11/03 10:51:10:235 EST] 7ffa7525 SubsegListAct W
>com.ibm.lansys.actions.SubsegListAction Just testing a log message with
>priority set to WARN = true
>[2/11/03 10:51:10:245 EST] 7ffa7525 SubsegListAct E
>com.ibm.lansys.actions.SubsegListAction Just testing a log message with
>priority set to ERROR = true
>[2/11/03 10:51:10:255 EST] 7ffa7525 SubsegListAct F
>com.ibm.lansys.actions.SubsegListAction Just testing a log message with
>priority set to FATAL = true
>
>
>So , now I know that my DEBUG is NOT enabled........but I do not know
>why. It appears to me that log4j isnt even
>being called anywhere......simply because 1) i tried changing
>ConversionPattern and so no changes on the console and 2) nothing is still
>being written to file.
>
>Please, help, this is making me crazy!
>Thanks, Lydia
>
>
>Lydia P wrote:
>
>>Has anyone successfully got log4j running under the Websphere Studio
>>Application Developer v 5.0?
>>I had to migrate my WSAD 4.03 application to WSAD 5.0, which has a
>>totally different tree structure, but WSAD 5.0
>>is supposed to recognize and retain WSAD 4.03 structures.
>>
>>I am not seeing log4j initialize in the console, yet, I see the class
>>loggers append to the console....the weird
>>thing is that I have them in the properties file logging to files - yet
>>no files are being created.
>>
>>Maybe I dont fully understand how WSAD works with commons-logging and
>>log4j? I didnt think I had
>>to use a log4j initializing servlet which is mentioned in web.xml to make
>>it work - theoretically, my class
>>files should never have to change when I change logging tools?
>>
>>Here is my setup:
>>I have commons-logging.jar and log4j-1.2.7.jar under the WEB-INF/lib
>>directory.
>>My commons-logging.properties file in the /WEB-INF/classes directory :
>># commons logging config - use Log4J
>>org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog
>>
>>
>>My log4j.properties file in the /WEB-INF/classes directory :
>>
>># log4j configuration file
>># DEBUG, INFO, WARN, ERROR and FATAL
>># Create three appenders, one called listout, one called stdout and
>>another called R
>>log4j.logger.com.com.ibm.lansys.actions=DEBUG, listout, stdout, R
>>log4j.logger.org.apache=DEBUG, listout ,stdout, R
>>
>># Create root (default) appender -default DEBUG and higher msgs go to the
>>console
>>log4j.rootCategory=DEBUG, stdout
>>log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>>log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>>log4j.appender.stdout.layout.ConversionPattern=%5p %c [%t] (%F:%L) - %m%n
>>
>># sListAction writes to listout logfile
>>log4j.category.com.ibm.lansys.actions.SubsegListAction=DEBUG,listout
>>log4j.appender.listout=org.apache.log4j.FileAppender
>>log4j.appender.listout.File=d:\\wsad5\\logs\\listout.log
>>log4j.appender.listout.layout=org.apache.log4j.PatternLayout
>># Pattern to output the caller's file name and line number.
>>log4j.appender.listout.layout.ConversionPattern=%5p %d{MMM dd yyyy HH:mm}
>>(%F:%L) - %m%n
>>
>># R writes to example.log, clears the log every 100kb
>>#log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
>>log4j.appender.R=org.apache.log4j.RollingFileAppender
>>log4j.appender.R.File=d:\\wsad5\\logs\\dailyrolling.log
>>log4j.appender.R.MaxFileSize=100KB
>># Keep one backup file
>>log4j.appender.R.MaxBackupIndex=1
>># Layout Pattern for the example.log file
>>log4j.appender.R.layout=org.apache.log4j.PatternLayout
>>log4j.appender.R.layout.ConversionPattern=%5p %d{MMM dd yyyy HH:mm}
>>(%F:%L) - %m%n
>>
>>
>>Much thanks for any help you can give me!
>>Lydia P.
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
--
Ceki
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: log4j and WSAD 5.0 anomalies and problems
Posted by Lydia P <ly...@attglobal.net>.
This is totally weird......
Check out the following test code:
try {
if (log.isDebugEnabled()) {
log.debug("About to log something"
+log.isDebugEnabled());
}
}catch(IllegalStateException e) {
log.error("Something bad has happened: " + e);
}
log.info("Just Testing a log message with priority set
to DEBUG ="+log.isDebugEnabled());
log.info("Just testing a log message with priority set to INFO =
"+ log.isInfoEnabled());
log.warn("Just testing a log message with priority set to WARN =
" + log.isWarnEnabled());
log.error("Just testing a log message with priority set to ERROR
= " + log.isErrorEnabled());
log.fatal("Just testing a log message with priority set to FATAL
= "+ log.isFatalEnabled());
And here is what the console tells me:
2/11/03 10:51:10:235 EST] 7ffa7525 SubsegListAct I
com.ibm.lansys.actions.SubsegListAction Just Testing a log message with
priority set to DEBUG =false
[2/11/03 10:51:10:235 EST] 7ffa7525 SubsegListAct I
com.ibm.lansys.actions.SubsegListAction Just testing a log message with
priority set to INFO = true
[2/11/03 10:51:10:235 EST] 7ffa7525 SubsegListAct W
com.ibm.lansys.actions.SubsegListAction Just testing a log message with
priority set to WARN = true
[2/11/03 10:51:10:245 EST] 7ffa7525 SubsegListAct E
com.ibm.lansys.actions.SubsegListAction Just testing a log message with
priority set to ERROR = true
[2/11/03 10:51:10:255 EST] 7ffa7525 SubsegListAct F
com.ibm.lansys.actions.SubsegListAction Just testing a log message with
priority set to FATAL = true
So , now I know that my DEBUG is NOT enabled........but I do not know
why. It appears to me that log4j isnt even
being called anywhere......simply because 1) i tried changing
ConversionPattern and so no changes on the console and 2) nothing is
still being written to file.
Please, help, this is making me crazy!
Thanks, Lydia
Lydia P wrote:
> Has anyone successfully got log4j running under the Websphere Studio
> Application Developer v 5.0?
> I had to migrate my WSAD 4.03 application to WSAD 5.0, which has a
> totally different tree structure, but WSAD 5.0
> is supposed to recognize and retain WSAD 4.03 structures.
>
> I am not seeing log4j initialize in the console, yet, I see the class
> loggers append to the console....the weird
> thing is that I have them in the properties file logging to files -
> yet no files are being created.
>
> Maybe I dont fully understand how WSAD works with commons-logging and
> log4j? I didnt think I had
> to use a log4j initializing servlet which is mentioned in web.xml to
> make it work - theoretically, my class
> files should never have to change when I change logging tools?
>
> Here is my setup:
> I have commons-logging.jar and log4j-1.2.7.jar under the WEB-INF/lib
> directory.
> My commons-logging.properties file in the /WEB-INF/classes directory :
> # commons logging config - use Log4J
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog
>
>
> My log4j.properties file in the /WEB-INF/classes directory :
>
> # log4j configuration file
> # DEBUG, INFO, WARN, ERROR and FATAL
> # Create three appenders, one called listout, one called stdout and
> another called R
> log4j.logger.com.com.ibm.lansys.actions=DEBUG, listout, stdout, R
> log4j.logger.org.apache=DEBUG, listout ,stdout, R
>
> # Create root (default) appender -default DEBUG and higher msgs go to
> the console
> log4j.rootCategory=DEBUG, stdout
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%5p %c [%t] (%F:%L) - %m%n
>
> # sListAction writes to listout logfile
> log4j.category.com.ibm.lansys.actions.SubsegListAction=DEBUG,listout
> log4j.appender.listout=org.apache.log4j.FileAppender
> log4j.appender.listout.File=d:\\wsad5\\logs\\listout.log
> log4j.appender.listout.layout=org.apache.log4j.PatternLayout
> # Pattern to output the caller's file name and line number.
> log4j.appender.listout.layout.ConversionPattern=%5p %d{MMM dd yyyy
> HH:mm} (%F:%L) - %m%n
>
> # R writes to example.log, clears the log every 100kb
> #log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=d:\\wsad5\\logs\\dailyrolling.log
> log4j.appender.R.MaxFileSize=100KB
> # Keep one backup file
> log4j.appender.R.MaxBackupIndex=1
> # Layout Pattern for the example.log file
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%5p %d{MMM dd yyyy HH:mm}
> (%F:%L) - %m%n
>
>
> Much thanks for any help you can give me!
> Lydia P.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org