tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Logging - including host name in log file?
Date Fri, 02 Dec 2011 20:04:36 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jerry,

On 12/2/11 12:46 PM, Jerry Malcolm wrote:
> Ok, I'm digging into this.  Slowly but surely.... Just to
> confirm...
> 
> So if I have, say 2 hosts, each with 3 web apps, and I want a
> different log file for each web app on each host, I need to define
> 6 of the following:
> 
> 10host1webapp1.org.apache.juli.FileHandler.level = FINE 
> 10host1webapp1.org.apache.juli.FileHandler.directory =
> ${catalina.base}/logs 
> 10host1webapp1.org.apache.juli.FileHandler.prefix = Host1App1.

Yes, although the format of the property base doesn't need to be that
complex. You could do this:

Host1App1.level=FINE
Host1App1.directory=...
Host1App1.prefix=Host1App1.

Tomcat has those odd property names so they will be unlikely to
conflict with anything you might want to define yourself.

The magic happens here, when you actually configure Tomcat's logger(s):

> 
> And then define 6 of the following:
> 
> org.apache.catalina.core.ContainerBase.[Catalina].[host1].[/webapp1].level
>
> 
= INFO
> org.apache.catalina.core.ContainerBase.[Catalina].[host1].[/webapp1].handlers
>
> 
= 10host1webapp1.org.apache.juli.FileHandler

You could instead do:

org.apache.catalina.core.ContainerBase.[Catalina].[host1].[/webapp1].handlers=Host1App1

> and I put all of this in /conf/logging.properties

Yes: this will tell Tomcat that, when your webapp uses
ServletContext.log(...) that the output should go to those loggers
listed in the "handlers" property for that particular webapp.

> All of this is required in order to get separate log files per
> webapp per host, right?

- From ServletContext.log(..), yes.

Again, if your webapp is logging in some other way, then Tomcat's
configuration does not apply at all. It's fairly common for webapps to
use their own logging mechanism rather than logging to the servlet
container, so I wouldn't be surprised if you have more work to do.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7ZL1QACgkQ9CaO5/Lv0PCOtACgrrhT1KS0QjOOF+Swh+jGqfZS
bGYAn3sg6wcPwg9HtLrXDcHkMFxXIz3W
=LSuQ
-----END PGP SIGNATURE-----

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


Mime
View raw message