Hi Pid,
Thanks for your response. Please forgive my initial response. After
reading so much about how JCL isnt working correctly under Tomcat I was
getting frustrated. Having to spend 2 days getting it to work without
success is for every programmer frustrating.
I found this website: http://tomcat.apache.org/tomcat-6.0-doc/logging.html
It states that you need to activate it by building something first. This
means it isnt enabled be default.
I even found a website where a person stated that anybody using JCL with
tomcat are just plain stupid. Here is the link:
http://www.bileblog.org/?p=259
These blogs/forums also indicate problems with tomcat and JCL:
http://www.oreillynet.com/onjava/blog/2006/08/tomcat_5x_commons_logging_and.html
http://java2.5341.com/msg/96959.html
http://commons.apache.org/logging/commons-logging-1.1/troubleshooting.html#Apache_Tomcat
If so many people are having problems then this must be an error on
Tomcat's behalf. Also If I use the exact same lib files in the exact
same place and the same configuration file but I replace
protected final Log log = LogFactory.getLog( class ) (JCL)
with
protected final Logger logger = Logger.getLogger( class ) (Log4j)
it should produce the same logging but it doesnt. When I use JCL no
logging occures except to the system output but this is because tomcat
uses java.util.Logging and that defaults output to the System.out
I hope someone can help out in getting JCL with tomcat and log4j to work.
Thanks in advance,
Martyn
Pid schreef:
Martyn Hiemstra wrote:
Hi All,
I have been working with tomcat and log4j for a while and it worked
perfectly. Now I have updated all my web apps to use commons logging. I
have discovered that the Tomcat developers have absolutly no idea how to
do something right when it comes to commons logging and I am curious to
why.
Non-specific insults are likely to generate attention, but unlikely to
encourage help. Never-the-less, I will attempt to assist.
I tried tomcat 5.028 and commons logging. I discovered that tomcat used
it's own commons-logging-api.jar file and it was impossible to override
this commons logging file.
commons-logging-api is not the same as commons-logging
I am running tomcat 6 now and I have discovered that tomcat 6 uses
commons logging without log4j enabled.
log4j is 'enabled' when you configure it and supply the jar file.
I have log4j.jar and commons-logging-1.1.jar in my webapp\WEB-INF\lib
directory and I put my log4j.properties file in the
webapp\WEB-INF\classes ditrectory so this should be correct.
Sounds just like the configuration I am using, successfully I might add.
If I create a FileAppender like this:
log4j.appender.fileout=org.apache.log4j.RollingFileAppender
log4j.appender.fileout.File=/tmp/myLog.log
log4j.appender.fileout.MaxFileSize=1024KB
log4j.appender.fileout.MaxBackupIndex=1
log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
log4j.appender.fileout.layout.conversionPattern=[%-6p] %-13d{ABSOLUTE}
%-26C{1} %-4L %m%n
I have discovered that the /tmp/myLog.log is created but nothing is
outputed to this file.
From the obvious questions department:
* have you set a logging level that will permit log messages to be
written to the file?
* what attributes are set in your application context configuration?
I am curious, why have the tomcat developers disabled something that is
so commonly used?
It's not disabled, you are probably doing something wrong. Log4J works
perfectly well if it's configured correctly.
p
Thanks in advance,
Martyn
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]