tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Logging for Dummies in Tomcat 5.5/6.0
Date Fri, 20 Jun 2008 00:12:06 GMT
Hi. I'm back.

First of all, I appreciate the information received already as a 
response to my initial post, and I am thankful for it. I keep on reading 
and collecting the new stuff coming, and getting enlightened by it.
There is a lot of information there, which for a large part - in my 
opinion - is not in the current Tomcat published documentation, or not 
in a way that a person with occasional and superficial contact with 
Tomcat can find or understand.
But, together with the insights gained through this list, it slowly 
starts to click into place.

This discussion started (a couple of threads ago) with a request on 
logging configuration, made by a user - me - who could not make sense of 
the files on his system(s), either belonging to Tomcat or produced by 
it. It quickly degenerated into a slinging match mostly related to 
Tomcat packaging.

To attempt a summary of the discussions so far, it sems that there are 
two distinct groups : Tomcat developers, and Tomcat users, and that 
their views differ sometimes substantially on what a logging system 
should do, and what a documentation should contain and how it should be 
written.  That is probably normal, because each person is looking at it 
in a different way, in function of his needs.
The developers seem to be happy with the logging and its documentation 
as it is, and consider it clear, or at least accessible.  The users, as 
far as I can tell from the correspondence I receive, generally have a 
different opinion.

I believe that the difference of opinions rests basically on the 
following : at some point in time, the developers of Tomcat - who it 
should be remembered do this for free - decided that maintaining 
Tomcat's own logging mechanism wasn't really worth their time and 
efforts, considering that there existed already a couple of external 
libraries (packages?) which did the job better anyway. They thus split 
that part off, allowing them to concentrate on more interesting and 
rewarding parts of the code. And they have no intention of moving back. 
Them being the developers of a product offered free of charge, nobody 
can or should discuss their decision or blame them for it.

What I personally believe they forgot at that point, is that there are 
many users of Tomcat who are not pure Java or Tomcat developers; that 
these users, having acquired over time a reasonable understanding of how 
to use Tomcat - if not necessarily how it works inside - now suddenly 
are faced with the need to get acquainted with a whole bunch of things 
of which they do not have a clue (commons-logging, juli, log4j), which 
per se do not really interest them (because they are not mainly Java 
developers) and which by themselves require quite an investment in time 
in order to start understanding how they work.

 From a user point of view, how to express it better than comparing 
logging in Tomcat 4.1, with logging in Tomcat 5.5 :

- to create a logfile in Tomcat 4.1, the user inserted this in his 
server.xml or context.xml at the appropriate place :

         <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs" prefix="localhost_" suffix=".log"
                 timestamp="true"/>

Basically, that was it.  If you needed logging at another level, you 
just copied this section and pasted it wherever logically it seemed to 
fit.  It wasn't terribly flexible, and did not help immensely for 
debugging code, but that was not the main purpose, and for the main 
purpose of the vast majority of users, it sufficed.
One did not really need to understand how a Logger worked, and one could 
rather easily guess from the atributes what could be tweaked and how. 
Unless you really wanted to do something special, you did not even need 
to go to the documentation or to Tomcat's Users List.
And it was amazingly and elegantly simple.  There are really not a lot 
of software products where you can just get a new logfile at whatever 
level by dropping a simple paragraph in a configuration file.

- to create a logfile in Tomcat 5.5or 6.0 on the other hand, one starts 
instead with this (once one has found it) :

handlers = 1catalina.org.apache.juli.FileHandler, 
2localhost.org.apache.juli.FileHandler, 
3manager.org.apache.juli.FileHandler, 
4admin.org.apache.juli.FileHandler, 
5host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler, 
java.util.logging.ConsoleHandler

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.

...(edited for brevity, if you can believe that)...

and, to start understanding the above, one *must* at least read the page at
http://tomcat.apache.org/tomcat-5.5(6.0)-doc/logging.html
and even so, one is constantly reminded that, to /really/ understand 
what is going on, one should start by understanding Java logging, then 
follow up with juli and/or log4j.

I don't think I need to continue.  Mere Tomcat users will understand 
what I mean, and Tomcat developers can imagine what the average bloke 
using Tomcat occasionally, thinks when he stumbles upon this.
(And yes, it is from a particular packaging of Tomcat, but that's not 
the point here; the official one is not simpler).

Now above I am playing somewhat dumb, because since this thread started, 
I have already started to understand some aspects of the above.
But even with this increased understanding, my basic feeling about it 
remains that it looks like a gigantic overkill and waste of time 
compared to the needs - and time available for this - of most Tomcat users.
To look at it another way, by making this change, and for most simple 
cases, one has replaced 3 lines inserted in server.xml or context.xml, 
by hundreds of lines "all over the place" (I am counting the docs, 
because they are needed now, and they were not before).
I can imagine on the other hand that for developers this might be an 
immense improvement, but again that's not the point here.

I will continue to study it of course, because I have no choice if I 
want to twiddle ever so slightly with the logfiles and not bring down my 
production servers.  And I will end up understanding it, because I don't 
give up easily, as you may have noticed.

But, relief, this is my own last post on the subject, because I think 
that now, finally, I have gathered enough information - thanks to some 
people on this list, among which Mark, Chris (and even Chuck) - to allow 
me to start playing around with a modicum of understanding of what I'm 
playing with.

I would however like to ask a final question, or maybe make a suggestion :

Is it not possible for the Tomcat developers to take into account the 
needs of people like me, who have only a minimal understanding of the 
underlying beauties and refinements, but who nevertheless appreciate 
Tomcat very much as a tool, and to take a step back in our direction and 
make us really impressed and happy ?

It should be a technical piece of cake for programmers of your capacity, 
to continue to use commons-logging, juli, log4j or whatever you prefer 
as the underlying mechanism, and to make it directly available for 
people who want to get down to the gritty details, while providing the 
average user with an interface that hides away this complexity under a 
simple connecting element. Like for example this :

   <Logger className="org.apache.juli.FileHandler"
       directory="logs" prefix="localhost." suffix=".log"
       timestamp="yyyy-mm" rotate="true" level="FINE"/>

You can then tuck away the real underlying properties files wherever the 
system packagers won't find them, or even embed them in the code itself 
to make sure.

Understand me well : I am not harking back to the old times when life 
was simple, and I understand that Tomcat has gotten more complex and 
requires a correspondingly more powerful logging mechanism.

But I believe that the ultimate beauty of a complex piece of machinery, 
is when it can be presented as something so simple and neat that a child 
could use it.  I think of that each time I see my son play with his 
iPod, or my mother with her GPS car navigator.

André

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


Mime
View raw message