tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <dmik...@gopivotal.com>
Subject Re: In Tomcat JULI, do the 'facility specific' loggers become per-webapp logger roots?
Date Wed, 09 Oct 2013 11:24:57 GMT
On Oct 8, 2013, at 11:03 PM, David Bullock <david.bullock@machaira.com.au> wrote:

> Please answer at Stackoverflow, and I'll report the results back to this
> list:
> 
> 
> http://stackoverflow.com/questions/19261727/in-tomcat-juli-do-the-facility-specific-loggers-become-per-webapp-logger-root

If you want to control your application's logging with the "org.apache.catalina.core.ContainerBase.[${engine}].[${host}].[${context}]"
options in "conf/logging.properties" then the application needs to use the Servlet logging
api.  See here for more details.

  http://tomcat.apache.org/tomcat-7.0-doc/logging.html#Servlets_logging_API

In general, I don't think most web application's will want to use this mechanism for logging
though.  Rather they'd use something more modern like Log4j or Logback (possibly through SLF4J)
which each have their own separate and more flexible way of being configured.

> 
> This intent behind this question is very similar to that asked in 2011:
> "How to externalize a webapp's logging.properties?", but it was never
> adequately answered:
> 
>  http://marc.info/?l=tomcat-user&m=131831958930163&w=2
> 
> 
> In general, I'm really grumpy when I have to unpack a WAR and fiddle with
> some files **each time** I deploy it.  If there is some more-general
> mechanism for allowing a deployer (remember those things called 'roles'
> from the EJB 1.0 spec, anyone?) to override configuration settings which
> have unfortunately been embedded in the WAR file, I'd **love** to know
> about it.  I haven't spotted anything about this in the Tomcat doco so far.

In general, I would suggest the VirtualWebappLoader.  With that you can add an external directory
like "/opt/app-1-config/" to the class path for a particular web application.  *If* the application
is loading it's configuration from the class path it will be able to load configuration files
from this location. 

   http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation

I don't think this will work for logging.properties, but that's a special case.  It would
work for other logging configurations like log4j.properties or logback.xml.  

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


Mime
View raw message