jacky...@ifishbone.com wrote:
Dear Apache SoftwareFundation
Could I categorize catalina.out by virtual host ? Is any setting can do
that? I have been finding the answer for two weeks but still got nothing.
Could give me a answer and reply . Thank you very much.
Hi.
When asking such type of question (and in fact for just about any type of question),
please indicate clearly
- what version of Tomcat you are using
- what Java JVM version it runs under
- what platform it is running on (Linux ? Windows ? other ?)
It saves everyone a lot of time, which they can then spend better answering your real
question.
Let's suppose in the meantime, that this is a Linux platform (it is different
under Windows).
"catalina.out" is the logfile which, by default under Linux, receives the stdout and
stderr output of the Java JVM which runs Tomcat. In other words, it is "global", and not
"per virtual host".
Where "catalina.out" really ends up, is determined by the (tomcat_dir)/bin/catalina.sh
script, which itself may be (and generally is) run by a system startup script located in
/etc/init.d (under Linux).
This being said, what in the end arrives on the stdout and stderr of the Java JVM which
runs Tomcat, depends very much of your Tomcat logging configuration.
Unfortunately the Tomcat logging configuration, whilst it is very powerful and flexible,
is also horribly complicated (by the usual standards of application logging).
So, the good news is that you can probably achieve what you want; and the bad news is that
it needs some serious work and preliminary study of the documentation and configuration files.
Another bit of goods news is that there is quite a bit of on-line documentation available;
and another bit of bad news is that there is too much of it, and as a result it ends up
being somewhat confusing.
The final bit of good news is that provided you are working for a big enough organisation,
and provided that you are willing to spend the time needed to overcome the initial
learning curve, you can probably build a whole career on becoming your organisation's
Tomcat logging specialist.
A good place to start is here :
http://wiki.apache.org/tomcat/FAQ/Logging
and then this :
http://tomcat.apache.org/tomcat-7.0-doc/logging.html#Using_java.util.logging_%28default%29
and also, view the file : /etc/tomcat-x/conf/logging.properties
and look at what is happening for "localhost" (the "default virtual host" of
Tomcat)
and also view this page :
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Attributes
and in particular the "swallowOutput" attribute
So in fact it is a bit of a recursive process :
- setting the "swallowOutput" attribute to true, for all the web applications that run
within the virtual host, so that whatever these applications write via system.out and
system.err - which, mind you, they should not really be doing but they do anyway - ends up
in the web application logfile, instead of in the Java JVM's stdout and stderr logfile
- then set up your Tomcat logging configuration so that all the logging of the web
applications of a given virtual host end up in a logfile specific to this virtual host
- and then figure out a decent way of managing these virtual host logfiles over time,
which is not helped by the standard default way in which Tomcat handles logfiles
Good luck.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org