On 3/26/2013 9:20 AM, Stadelmann Josef wrote:
we have multiple applications deployed as war files into tomcat webapps.

each apps has its class directory among a lib directory

we use log4j-1.6 and so each web apps/web-inf/classes has its
log4j.properties file

what we do not understand is the order in which tomcat deployes the
several web apps and what we do even less understand is in which order
the various log4j.properties are parsed and used. OR are they just
parsed and not used, or later used or perhaps used, I tell you "it is a
mess!"

We can clearly see that it parses

1.      /catalian/lib/log4j.properties
2.      then it deploys /catalina/webapps/SpezplaFS -
a.      the logging is formatted with rules from
/catalian/lib/log4j.properties
b.      /SpezplaFS/WEB-INF/classes/log4j.properties is never parsed
c.      but therefore we can see that /catalian/lib/log4j.properties a
second time
3.      and our /catalina/webapps/axis2/WEB-INF/classes/log4j.properties
is never parsed
a.      but as you can see all modules and axis2.war itself is deployed
b.      why is it's own properties file not parsed
4.      svnkit-dav has not yet its own logging system

any hints welcome

  <<log4j-parsing.txt>>

In general, the list strips attachments. Fortunately yours made it through.

It appears that you're using Tomcat 6.0.26 (not 5.5.26) and JRE 1.6.0.30 on a Windows platform.

First order of business - time to upgrade both Tomcat and the JRE.

Second, read the following:

http://tomcat.apache.org/tomcat-6.0-doc/logging.html#Using_Log4j

Third, there is no guaranteed order for deploying web applications.

Fourth - a bit long . . . .

I just ran a quick test, using the log4j.properties file posted in the link I cited above. I found out the following:

The log4j output is different than what you've posted in your attachment. Here's an example of mine:

2013-03-26 10:05:26,889 [main] INFO
 org.apache.catalina.startup.HostConfig-
 Deploying configuration descriptor host-manager.xml

2013-03-26 10:05:27,079 [main] INFO
 org.apache.catalina.startup.HostConfig-
 Deploying configuration descriptor manager.xml

2013-03-26 10:05:27,135 [main] INFO
 org.apache.catalina.startup.HostConfig-
 Deploying web application archive RWeb.war

2013-03-26 10:05:27,841 [main] INFO
 org.apache.catalina.startup.HostConfig-
 Deploying web application directory docs

2013-03-26 10:05:27,862 [main] INFO
 org.apache.catalina.startup.HostConfig-
 Deploying web application directory examples

Here's a portion of yours:

INFO: Deploying web application archive svnkit-dav-1.7.8.war

26.03.2013 16:45:44 org.apache.catalina.startup.HostConfig
  deployDirectory

INFO: Deploying web application directory bck

26.03.2013 16:45:44 org.apache.catalina.startup.HostConfig
  deployDirectory

INFO: Deploying web application directory docs

26.03.2013 16:45:44 org.apache.catalina.startup.HostConfig
  deployDirectory

INFO: Deploying web application directory examples

Are you writing all of your output to console? It might help to post (inline, not as an attachment) your log4j.properties file.

I've word-wrapped and separated the lines. Note that with using the log4j.properties file from the example, I get a [main] in each log entry.

I have one test application (RWeb - demonstrates how to read file-based resources in a web application) that also uses log4j. It's configured with a log4j.xml file in WEB-INF/classes.

Its output is a bit different, and goes to its own file.

2013-03-26 10:05:27,834 INFO
  org.mdeggers.rweb.listeners.LogListener.contextInitialized:14 -
  Starting application logging

2013-03-26 10:10:57,575 INFO
  org.mdeggers.rweb.controllers.CCReader.processRequest:39 -
  Getting resources information from a POJO

2013-03-26 10:11:00,540 INFO
  org.mdeggers.rweb.controllers.PReader.processRequest:39 -
  Getting resources information from a POJO

One of the differences that you can see is that I include the line number in this logging example.

Another thing to try . . . log4j prefers the XML format over the properties format if it sees more than one log4j configuration file. You might try the following:

1. log4j.properties in %CATALINA_HOME%\lib
2. log4j.xml in each WEB-INF\classes

That way you can be sure the log4j.xml file takes precedence for your applications. However, according to the following reference:

http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

log4j and its configuration should be read from WEB-INF/lib and WEB-INF/classes before reading from the common classloader.

So, in summary:

1. Put the right information in your subject
2. Upgrade
3. Don't post attachments - add the information inline
4. No, context loading order is not guaranteed or enforced
5. Check your applications' log files to see what format is used
6. Try using XML for your application's log4j configuration (should not
   make a difference)
7. Post your Tomcat's log4j.properties file inline if the above doesn't
   resolve your issues
8. Tell the list if / when your issues are resolved (and how)

. . . . just my two cents.
/mde/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to