logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: Default Initialization under Tomcat (5, 6)
Date Thu, 15 Jul 2010 20:20:41 GMT
On Thu, 15 Jul 2010 11:09:37 -0700
  Kevin Kruzich <kkruzich@mshift.com> wrote:
> 
> 
> Thanks Jake -- My /etc/tomcat6/catalina.properties:
> 
> common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
> 

That works too

> --but I'm unable to see where ${catalina.base} and ${catalina.home} are 
>defined. That isn't so immediately relevant though.
> 

These can be set in your environment as the following OS system properties....

CATALINA_BASE
CATALINA_HOME

The Tomcat scripts pick these up and uses them to set the following Java 
system properties....

catalina.base
catalina.home


The scripts will use defaults if you don't provide them.  And catalina.base 
will be set to the value of catalina.home if not not explicitly set to 
something else.

> At this point I have no preference as to whether the logging is server or 
>app. I just want *something* --and I had that *something* with tomcat5 
>without too much trouble. 

But what that "something" is is an important question which you have yet to 
answer.  Do you want to see logging from your own application or from Tomcat?  
What you have set up so far is sufficient for the former, but not the latter.

Keep in mind, this is *not* a Log4j question, but a Tomcat question.  From 
Log4j standpoint, auto-configuration is working.  I will give you a bit 
further advice here, but if you want more you need to re-read the introduction 
of the Tomcat Logging page, not just the Log4j specific instructions and/or 
contact the Tomcat user list.

> What's most important to me is that I can see 
>something running through syslog.
> 

"syslog" seems to imply you want Tomcat logging.  If you read a bit more 
closely, you'll understand why you see no logging from Tomcat.  
Specifically....

[begin quote]
By default, only java.util.logging is available for the logs generated  by
       the Tomcat internal loggers, as Tomcat uses a package renamed
commons
       logging implementation which is hardcoded to use
java.util.logging. Use of
       alternative logging frameworks requires building or downloading
the
       extras
  components which include a full
       commons-logging implementation. Instructions for configuring the
extras
       components to enable log4j to be used for Tomcat's internal
logging may be
       found below.

[end quote]

> This isn't working for me:
> 
> > /usr/share/tomcat6/lib/log4j.jar
> > /usr/share/tomcat6/lib/log4j.properties
> 

Actually, it is, from Log4j's perspective.  The logger repository is getting 
auto-configured using the log4j.properties you provided.  That you see no 
Tomcat logging is because you have not yet followed the instructions below.

> 
> ...and I wonder if these instructions are why. If these instructions require 
>precise applicaton then what do these instructions mean?
> 

You are going to have to be more precise about what exactly you don't 
understand about these instructions.  If you follow them, you will see Tomcat 
logging through Log4j.  I've done it and I know it works.  If you find these 
instructions a pain in the [you know what], I don't blame you.  But the cause 
of the pain has nothing to do with Log4j and everything to do with Tomcat.  If 
you have complaints, I encourage you to send them to the Tomcat team.

> >> http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j
> >>
> >> # Download Log4J (v1.2 or later) and place the log4j jar in
> >> $CATALINA_HOME/lib.
> >> # Build or download the additional logging components. See the extras
> >> components documentation for details.
> >> # Replace $CATALINA_HOME/bin/tomcat-juli.jar with
> >> output/extras/tomcat-juli.jar.
> >> # Place output/extras/tomcat-juli-adapters.jar in $CATALINA_HOME/lib.
> >> # Delete $CATALINA_BASE/conf/logging.properties to prevent
> >> java.util.logging generating zero length log files.
> >> # Start Tomcat
> 


Jake

> 
> 
> Jacob Kjome said the following on 7/15/10 10:40 AM:
>> Tomcat's catalina.properties contains...
>> 
>> common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
>> 
>> This means that, assuming that "/usr/share/tomcat6" is the path set for 
>> ${catalina.home}, the following should work fine...
>> 
>> /usr/share/tomcat6/lib/log4j.jar
>> /usr/share/tomcat6/lib/log4j.properties
>> 
>> 
>> That said, is you purpose application logging or server logging (or both)?
>> 
>> For application logging, this should be fine, though you'll share a 
>> logger repository with all apps under Tomcat (unless you include 
>> log4j.jar in WEB-INF/lib and log4j.properties or log4j.xml in 
>> WEB-INF/classes ....or you use a logger repository selector).
>> 
>> For server logging, you need to following the instructions you already 
>> referenced....
>> 
>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j
>> 
>> 
>> Jake
>> 
>> On Thu, 15 Jul 2010 10:20:59 -0700
>>  Kevin Kruzich <kkruzich@mshift.com> wrote:
>>>
>>> I was able to get log4j working with syslog without too much trouble
>>> using tomcat5. Yet with tomcat6 I'm having a heck of a time trying to
>>> figure out where log4j.properties should go.
>>>
>>> tomcat5:
>>>
>>> JAVA_OPTS="$JAVA_OPTS
>>> -Dcatalina.ext.dirs=$CATALINA_HOME/shared/lib:$CATALINA_HOME/common/lib"
>>>
>>> /var/lib/tomcat5/common/lib/log4j.jar
>>> /var/lib/tomcat5/common/classes/log4j.properties
>>>
>>> works great!
>>>
>>> ---
>>>
>>> tomcat6:
>>>
>>> tomcat    9995  0.5  1.2 649772 24900 ?        Sl   21:01   0:03
>>> /usr/bin/java -classpath
>>> :/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/bin/build-classpath:

>>> error: JVM_LIBDIR /usr/lib/jvm-exports/java-1.6.0 does not exist or is
>>> not a directory -Dcatalina.base=/usr/share/tomcat6
>>> -Dcatalina.home=/usr/share/tomcat6 -Djava.endorsed.dirs=
>>> -Djava.io.tmpdir=/var/cache/tomcat6/temp
>>> -Djava.util.logging.config.file=/usr/share/tomcat6/conf/logging.properties 
>>>
>>> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
>>> org.apache.catalina.startup.Bootstrap start
>>>
>>>
>>> /usr/share/tomcat6/lib/log4j.jar
>>> /usr/share/tomcat6/lib/log4j.properties
>>>
>>> (and many other locations)
>>>
>>> fails, fails...
>>>
>>> *?* Do I need a dir like /usr/share/tomcat6/common
>>>
>>> These instructions are over 8 years old so I imagine this section, in
>>> particular has changed quite a bit "Default Initialization under Tomcat"
>>>
>>>
>>> http://logging.apache.org/log4j/1.2/manual.html
>>>
>>>
>>> ---
>>>
>>> And lastly, there's this snippet on the Apache website -- is all this
>>> necessary?
>>>
>>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j
>>>
>>> # Download Log4J (v1.2 or later) and place the log4j jar in
>>> $CATALINA_HOME/lib.
>>> # Build or download the additional logging components. See the extras
>>> components documentation for details.
>>> # Replace $CATALINA_HOME/bin/tomcat-juli.jar with
>>> output/extras/tomcat-juli.jar.
>>> # Place output/extras/tomcat-juli-adapters.jar in $CATALINA_HOME/lib.
>>> # Delete $CATALINA_BASE/conf/logging.properties to prevent
>>> java.util.logging generating zero length log files.
>>> # Start Tomcat
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>
>>>
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
> 
> -- 
> 
> Kevin Kruzich - Network and Systems Administrator
> kkruzich@mshift.com
> 
> office: 510-933-5912
> mobile: 408-823-9549
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 


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


Mime
View raw message