You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rüdiger Herrmann <rh...@eclipsesource.com> on 2011/06/14 17:24:46 UTC

How to configure logging in embedded Tomcat?

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?

TIA
Rüdiger

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


Re: How to configure logging in embedded Tomcat?

Posted by Rüdiger Herrmann <rh...@eclipsesource.com>.
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
<rh...@eclipsesource.com> wrote:
> ups, sorry. I am using version 7.
>
> On Tue, Jun 14, 2011 at 18:03, Mark Thomas <ma...@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


Re: How to configure logging in embedded Tomcat?

Posted by Rüdiger Herrmann <rh...@eclipsesource.com>.
ups, sorry. I am using version 7.

On Tue, Jun 14, 2011 at 18:03, Mark Thomas <ma...@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


Re: How to configure logging in embedded Tomcat?

Posted by Mark Thomas <ma...@apache.org>.
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