-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

Mark Thomas wrote:
> André Warnier wrote:
>> I have another point to add : maybe I understand this wrong, but it
>> seems that with the current implementation, a webapp is able to decide
>> where and how it logs, no matter what the overall server configuration
>> says.  And that seems to me like the tail wagging the dog.
>> But again, maybe I just don't understand how it works. I admit I don't.
> 
> I think this is the root of the issue. Each web application is free to use
> any logging framework it likes. Tomcat has no control over the logging
> framework - if any - that a web application may use.

I'd like to point out that when you are configuring logging for Tomcat,
you're configuring /logging for Tomcat/, not for your applications. Yes,
Tomcat does perform some logging on behalf of the application (things
like auto-redeployment notices, webapp startup info, libraries loading,
etc.) but Tomcat does not dictate any of the application-specific logs
that you create.

I'll give you an analogy with Apache httpd and maybe you can see what I
mean.

Let's say you have a PHP-based application running on Apache httpd. In
httpd.conf, you have something like

AccessLog /var/log/apache/access.log common

This will log all HTTP accesses to the access.log file. Simple.

On the other hand, your application may maintain its own log file in
/var/log/myphpapp/errors.log. In that case, there is no way at all for
an administrator to configure logging for your application using httpd.conf.

The same is true for configuring application versus server logging in
TC: logging.properties (and friends) configure the logging for the
application server, and the application is free to do whatever it wants
for application-specific logging.

I think this logging issue is really big for folks moving from servers
like httpd where logging is typically very simple (log errors or
accesses, etc.). For those of us who have used Java-based logging
systems in the past, this is a piece of cake.

For instance, I have used log4j for years and years. log4j requires a
log4j.properties file (or you can do it programmatically, but that
sucks) for configuration. It's pretty simple: you define an appender
(basically a message log target), give it a file name and a log level
and then, in your code, you simply write to it. That's it.

The complexity comes in when you want multiple appenders at different
levels and you want different parts of your code (say, all org.apache.*
stuff goes to one logger and com.mycompany.* goes to another). It's not
really any harder to understand... it's just more of the same kind of
configuration. And, the plus side is that your code doesn't get any more
complex.

Since each application can be configured differently (from inside the
application, that is), you have to ignore them when you're talking about
server logging. TC simply isn't going to say "hey, webappX, your log
file is /here/". The application itself makes that decision.

Configuring Tomcat logging is usually easy: if you accept the default
configuration, you get catalina.out (stdout), plus some daily-rolled
files that are all defined in logging.properties. The logging.properties
file contains configuration and documentation that are helpful if you're
willing to read through it and connect point A (the named logger like
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/webappname])
to the configured logger that includes a filename.

The stock logging.properties contains configuration for, say, the
'manager' application. Want to create a new logger for your new
application? Simply copy that configuration and modify the appropriate
parts (one of them being the name of the logger itself, which is
3manager.org.apache.juli.FileHandler for me, and could probably have
been given a more pronounceable name, but captures exactly what that
logger is for).

I hope that helps a bit more.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkj3cQ0ACgkQ9CaO5/Lv0PAEpQCgtfdK7sSQ/KUgC13XucfGWZIX
avgAn1qSCVodcDv2cDTu+EHlZjdabGsp
=VQvK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to