Tomcat doesn't use log4j in v6 in its standard distribution. You have to build an adapter for that

Filip

On 08/13/2009 12:49 PM, Eric B. wrote:
Hi,

I'm trying to get Tomcat to log the output each context individually in its
own log file.

I tried using the swallowOutput in my<context>  object definition, but am
getting some really weird results from it.  My webapp uses log4j to do its
logging with its own log4j.xml file within the webapp, and all log4j's
output is
defined as using the org.apache.log4j.ConsoleAppender.

My context.xml file is:
conf/Catalina/localhost/ROOT.xml:
                 <Context debug="0" reloadable="true" distributable="true"
swallowOutput="true">

                         <ResourceLink name="jdbc/dame"
                         global="jdbc/eppe"
                     type="javax.sql.DataSource" />

             <ResourceLink name="mail/dame"
                            global="mail/dame"
                            type="javax.mail.Session" />

                 </Context>


${catalina.base}/conf/logging.properties:
handlers = 1catalina.org.apache.juli.FileHandler,
2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler,
4admin.org.apach\e.juli.FileHandler,
5host-manager.org.apache.juli.FileHandler,
6root.org.apache.juli.FileHandler,       java.util.logging.ConsoleHandler

6root.org.apache.juli.FileHandler.level = ALL
6root.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
6root.org.apache.juli.FileHandler.prefix = root.

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].level =
ALL
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].handlers =
6root.org.apache.juli.FileHandler



Based on that configuration (and swallowOutput documentation) I would expect
that all logging from my root context would therefor go through
6root.org.apache.juli.FileHandler log file.  However, I seem to only be
getting some logging captured in the root.log logfile.

It is extremely confusing; there doesn't seem to be any pattern.  Some
webapp logs go to root.log, other still are displayed on stdout, and
therefore in catalina.out.  Like I said, all log msgs in the webapp use the
same log4j ConsoleAppender.

I'm running Tomcat 6.0.18.  I searched through the changelog for 6.0.19 and
6.0.20 and don't see anything that relates to this, so I am wondering if
this is an issue that still exists.

Is my configuration wrong?

Thanks,

Eric




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




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

Reply via email to