tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Logging for Dummies in Tomcat 5.5/6.0
Date Tue, 17 Jun 2008 15:34:02 GMT
Hi.

Following another couple of threads which were leading to not much, and 
where it seemed evident that there was a notable difference in 
competence and understanding between the protagonists, I would like to 
start a new one, targeted at Tomcat Logging Dummies like me, but where 
Tomcat gurus are of course gratefully welcome to enlighten us.

Here are the basic premises :
Assume that one is not a Java nor Tomcat expert, just someone who has to 
install a piece of software called Tomcat, because that is what his 
users would like to have, to run nice Java applications.
Assume that one has installed Tomcat 5.5 (or 6.0) on some system just by 
using the standard software package management system for his Operating 
System, and consequently finds himself with some Tomcat installation, 
whose settings and layout have been chosen by a real guru (in both 
Tomcat and in software packaging).
Assume that the Tomcat in question works fine, but that it writes 
logfiles all over the place (or all over time), and that one would like 
to understand where these logfiles come from, and either slightly change 
which logfiles are being produced, or add a specific logfile for a 
specific application, or something simple like that.
Assume that one has read the Tomcat logging page at
http://tomcat.apache.org/tomcat-6.0-doc/logging.html
and it's equivalent for Tomcat 5.5, and that one has even read the
commons-logging documentation at http://commons.apache.org/logging/
but that one admits that one is too dumb to really understand what is 
said there.
I believe also that it can be assumed that one does not know the 
difference between common-logging, juli, log4j or anything like it, and 
that one does not really care to know more about it than one absolutely 
needs to know in order to get a logfile.

The kind of things one would like to know are :

- where to start ?
In other words, here I have a Tomcat and it is working and it is writing 
logfiles, but I do not have a clue which kind of logging mechanism it is 
using, either directly or indirectly.  How do I find out ?

- how does it work ?
In other words : it would seem that the kind of logging adopted in 
Tomcat 5.5/6.0 is very powerful and flexible, allowing one to decide "at 
the top" which mechanism is being used, and then define either some 
overall generic logging settings for the whole Tomcat and valid for all 
components and applications, and/or refine this at just about each 
hierarchical level of Tomcat, Engine, Connector, Host, application and 
whatnot, at whatever level of detail one needs between CRASH and CHATTY. 
  Great.

Now, this was also pretty much what one could do in Tomcat 4, by using a 
<Logger> element at whichever level one deemed necessary.  And it was 
probably not perfect from a purist or developer point of view, but it 
was fairly simple to configure for the occasional Tomcat admin.
So, without going into many technical considerations about why it was 
changed, is there a simple set of analogies that one could use between 
an old and a new configuration, to achieve similar aims ?

My purpose is *not* to use the logging interface programmatically, since 
I have no access to any source code of any of the applications.  I would 
just assume they are doing the right thing so that I can re-direct their 
output to some file I choose, or to the intergalactic void if I so 
choose (like /dev/null), or just tell them to shut up via some setup 
parameter.  But, if it looks like one of them is misbehaving, I would 
like to know how to really squeeze the last logbyte out of it so that I 
can go and rub the user's nose in it, or bug the developer about fixing 
his code.

- how does one set up a really simple logging configuration, but one 
that will allow in the future some gradual tailoring and refinement 
without complete redesign ?

In other words, currently I have far too many logfiles and I don't know 
where they are coming from. I'd like to simplify initially, and then 
slowly and incrementally, as I get a better understanding of how it 
works, rebuild what I need in terms of details.
My basic purpose is to have logfiles that show me, in not too much 
detail, when Tomcat starts and stops, the important things that happen 
to it, and in case of an error, enough information to find out where it 
happened and why in general terms.

a) I have a Tomcat with one single host ("localhost") and 3 applications 
: a "manager", a "host-manager", and a custom application called 
"MyApp".  That's the way it came in the box.  Each of those at the 
moment produces a separate logfile, daily, to which one adds another set 
of daily "catalina" logs.
That's just a bit much.
I would like to have, for the whole of Tomcat :
- one monthly file that shows the equivalent of an Apache "error log"
- one monthly file that shows the equivalent of an Apache "access log"
and that's pretty much it.
So I need first to undo what's there, and then to put in what's needed.
How do I do that ?
(And I don't really care if this uses juli or log4j, just give me the 
simplest to configure considering the aims here and below).

b) when the above is achieved, then I'd like to re-introduce a separate 
access log for each Host.  How do I do that ?

c) when the above is achieved, then I'd like to re-introduce a separate 
log for just the "MyApp" application.  How do I do that ?

I think that would be a start.

It would be nice of course if any start of an answer to the above was 
made in such a way as providing, ultimately, the material for some kind 
of "How To" that could be posted to the Tomcat WiKi.

And no, the page at http://tomcat.apache.org/tomcat-6.0-doc/logging.html 
is not enough to answer the above.  It assumes from the reader a greater 
knowledge of Java and Tomcat than most Tomcat users have, and it 
presupposes, I guess, that the installed Tomcat has been built 
on-the-spot from the original Tomcat distribution; and I believe that 
this is not the case for the majority of subscribers to this "Tomcat 
users" list.


Thanks in advance,
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