tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rüdiger Herrmann <rherrm...@eclipsesource.com>
Subject Re: How to configure logging in embedded Tomcat?
Date Fri, 24 Jun 2011 19:58:11 GMT
In the meanwhile, I found a way to work around the problem. Just for the record:

Tomcat uses plain JDK logging, so one can obtain a logger with
Logger#getLogger() and change its settings before Tomcat obtains a
reference. As loggers are held in WeakReferences, you only need to
make sure that they are not GC'ed. (Note: I use embedded Tomcat in
tests and thus can affort to hold on some Logger instances, this is
probably not a good idea for production evironments)

The code could look like this:
  static final List<Logger> loggerHolder = new LinkedList<Logger>();

  Logger logger = Logger.getLogger( "name.of.Logger" );
  loggerHolder.add( logger );
  logger.setLevel( Level.SEVERE );

On Tue, Jun 14, 2011 at 18:15, Rüdiger Herrmann
<rherrmann@eclipsesource.com> wrote:
> ups, sorry. I am using version 7.
>
> On Tue, Jun 14, 2011 at 18:03, Mark Thomas <markt@apache.org> wrote:
>> On 14/06/2011 16:24, Rüdiger Herrmann wrote:
>>> Hi all,
>>>
>>> I am running Tomcat embedded and just can't figure out how to
>>> programmatically configure the logging of the engine itself.
>>> Ideally I would redirect logging to a custom implementation, but
>>> changing the log level (to off) would already help.
>>> The LogFactory doesn't seem to offer such functionality (?) and
>>> manipulating the underlying java.util.logging.Logger didn't help
>>> either.
>>> Any insights?
>>
>> Without you telling us the Tomcat version you are using, insight is
>> unlikely.
>>
>> Mark
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
>
> --
> --
> EclipseSource
> http://eclipsesource.com
> Tel: 0721 - 66 47 33 - 0
> Fax: 0721 - 66 47 33 29
>
> Innoopract Informationssysteme GmbH
> Stephanienstrasse 20, 76133 Karlsruhe, Germany
> General Manager: Jochen Krause
> Registered Office: Karlsruhe, Commercial Register Mannheim HRB 107883
>

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


Mime
View raw message