Log4j requires its own logging universe in the default setup. The easiest way to do this in a servlet container is to put the log4j jar in
WEB-INF/lib of each web application you have. You can put a log4j.properties or a log4j.xml in WEB-INF/classes for default configuration initialization. There are more advanced (and complex) ways of using Log4j such as this:
http://qos.ch/containers/sc.html
Contrary to what "Mr. Tomcat" wrote saying that the j2sdk1.4.x logging and Log4j had no significant functional differences, you might want to read up on the docs for log4j and see for youself that log4j is infinitely more powerful than the j2sdk1.4.x logging and is compatible with
Java 1.1+. Log4j-1.3 will provide even more power and will be compatible with jdk1.2+. Either way, the way you define loggers in your code is really no different between the two logging frameworks. In fact, all you'd have to do to switch between the two for most cases would be to switch the import statement from "import org.apache.log4j.Logger;" to "import java.util.logging.Logger;" and vice-versa. See the following for details:
http://qos.ch/logging/thinkAgain.html
I'm not going to detail all the features. That has already been done. If you want to get a fast start, the main contributor to Log4j wrote a book about it. I suggest grabbing a copy to get up to speed quickly:
http://qos.ch/log4jBook.html
of course there is free documentation here:
http://jakarta.apache.org/log4j/docs/documentation.html
Jake
At 03:59 PM 10/22/2002 -0700, you wrote:
I am planning on using log4j within several tomcat based applications. My question is, where is the best place to install log4j.jar?Shoud I place it in $TOMCAT_HOME/common/lib and also place the log4j.properties file in the same directory, or should I place a copy of log4j.jar in the WEB-INF/lib directory of each application and maintain a separate log4j.properties files for each application? Thaks, CC ---------- This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. -- To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>
