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 pe...@coopfed.qc.ca on 2003/04/01 18:25:22 UTC

RE : log4j and WSAD 5.0 anomalies and problems - Final Anwser

Hi,
I got the similar problem of you and I finally discover what is the problem.
First I use wsad 5.0 and use the express server that is built in wsad 5.0.
So your problem is not using log4j but log4j with commons-loggins.jar.

When you call private static Log log = LogFactory.getLog(LoginAction.class);
The log factory class loader check if you have a factory that is load.

During initialisation, wsad load it's own factory that come from a upper
class loader.
The path for me is there C:\Program Files\IBM\WebSphere
Studio\runtimes\express_v5\lib
And the package is ws-commons-logging.jar

If you open this package you will see that it's exist a file call
commons-logging.properties.
This file is the file that websphere use for logging. Wsad wont use the file
in your webinf/classes folder.

So you have to open this file and you will see this
org.apache.commons.logging.LogFactory=com.ibm.ws.commons.logging.TrLogFactor
y

This is the factory that websphere use.
So comment this line and had this one
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategory
Log
Now it would work like is write in the book of Chuck Cavaness. 

Maybe there's another way to do this but for me it's work and if I go on
another application server I would not have to change my code.

Hope this help and any comments are welcome.

Eric Pelletier
Pelletiere@coopfed.qc.ca

-----Message d'origine-----
De : Lydia P [mailto:lydiap@attglobal.net] 
Envoyé : 11 février, 2003 09:16
À : log4j-user@jakarta.apache.org
Objet : 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.Log4JCategory
Log 


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.



Re: RE : log4j and WSAD 5.0 anomalies and problems - Final Anwser

Posted by Syed Farid Ahmad <sf...@yahoo.com>.
Hi,

Instead of changing file in ws-commons-logging.jar, I copied the commons-
logging.properties  to the source/ folder.

My commons-logging.properties contained:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog

When installing the applicatoin on the WSAD server, I changed the classloader 
policy to PARENT_LAST and WAR class loader policy to APPLICATION. 

Thanks,
Farid






---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org