Placing log4j's JAR into jre/lib/ext didn't cause the logs to appear. (I
should mention that the logs I'm trying to control with log4j are Tomcat's
internal logs, rather than web application logs.) The following command from
the command line outputs the log as expected, as does calling startup.bat,
or catalina.bat run:

java -cp "tomcathome\bin\bootstrap.jar"
-Dcatalina.base="path/to/catalina/base"
-Dcatalina.home="path/to/catalina/home"
org.apache.catalina.startup.Bootstrap start

The logs aren't created, however, when starting Tomcat from within an IDE
(Eclipse), in the following two cases:
- The Tomcat plugin that points to the same tomcathome as in the
command-line snippet above
- The main method of a class that uses the Bootstrap class, in the following
way:

Bootstrap bootstrap = new Bootstrap();
bootstrap.setCatalinaHome(System.getenv("CATALINA_HOME"));
bootstrap.setCatalinaBase(System.getenv("CATALINA_BASE"));
bootstrap.init(new String[] { "-config", "path/to/server.xml" });
bootstrap.start();




mgainty wrote:
> 
> Lightbulb-
> 
> to quote-
> http://www.slf4j.org/nlog4j/TROUBLESHOOT.html#noAppenders
> Log4j does not have a default logging target.
> 
> It is the user's responsibility to ensure that all categories can inherit
> an
> appender. This can be easily achieved by attaching an appender to the root
> category.
> 
> If you place log4j.jar in the jre/lib/ext
> 
> /**********COMMONS-LOGGING.PROPERTIES located on classpath
> (WEB-INF/CLASSES)
> *************/
> commons-logging.properties has these entries for Log4J
> org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF
> actory
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategory
> Log
> 
> /***********LOG4j.PROPERTIES located on classpath (WEB-INF/CLASSES)
> ***********/
> log4j.properties has these entries
> log4j.rootLogger = WARN, stdout
> 
> log4j.appender.stdout = org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.Threshold = WARN
> log4j.appender.stdout.Target   = System.out
> log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern = %d{ISO8601} %-5p [%F:%L]
> :
> %m%n
> 
> HTH
> M-
> 
> ----- Original Message -----
> From: "lightbulb432" <[EMAIL PROTECTED]>
> To: <users@tomcat.apache.org>
> Sent: Saturday, December 15, 2007 7:06 PM
> Subject: log4j when using Bootstrap not command-line startup
> 
> 
>>
>> I'm running Tomcat not from the command-line but from the Bootstrap
> class's
>> start() method. When I start it using the command-line, a logs/tomcat.log
> is
>> created in CATALINA_BASE, but not when I start from the Bootstrap class.
> In
>> fact, I get the "log4j:WARN Please initialize the log4j system properly."
>> log message in the output.
>>
>> What is the catalina.bat file doing differently that makes properly
>> initializes log4j? There are a few things relating to setting
>> java.util.logging properties, but that shouldn't make a difference
>> because
>> I'm using log4j. I'm using Tomcat 6 and following the directions at
>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html for log4j.
>>
>> I imagine I've followed those directions properly because the logs are
>> appearing when I run it from the command-line. And ideas of what might be
>> causing this, or what should I try next?
>>
>> Thanks.
>> --
>> View this message in context:
> http://www.nabble.com/log4j-when-using-Bootstrap-not-command-line-startup-tp
> 14356626p14356626.html
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/log4j-when-using-Bootstrap-not-command-line-startup-tp14356626p14359040.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to