this is an example
private static org.apache.juli.logging.Log log=
org.apache.juli.logging.LogFactory.getLog(
IntrospectionUtils.class );
as soon as that statement is executed, the logging gets initialized.
as you can see, it is a static field, so when you run Tomcat embedded,
before any classes are loaded (that would lead to initialization), you
must set those properties.
as you can see, the Embedded class also does this
public class Embedded extends StandardService implements Lifecycle {
private static Log log = LogFactory.getLog(Embedded.class);
meaning, if you have references to embedded in your "public static void
main(String[] args)" class, then it's too late to set the system
properties at that time
Filip
Johnny Kewl wrote:
----- Original Message ----- From: "Filip Hanik - Dev Lists"
<[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, October 12, 2007 8:02 PM
Subject: Re: embedded Tomcat (5.5.23) application logging
(java.util.logging)
Johnny Kewl wrote:
----- Original Message ----- From: "Carl Mosca" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Friday, October 12, 2007 4:29 PM
Subject: embedded Tomcat (5.5.23) application logging
(java.util.logging)
This was a recent related topic here but I did not understand the
issue to
quite the same as what I am seeing.
I've got an Tomcat embedded in an application and the two hosted web
applications are running OK.
Logging is working OK in the host application and from Tomcat
itself. I am
not getting any output from the hosted applications which are using
java.util.logging.
I get output from these applications when they run on Tomcat itself.
I am wondering if someone has an example of or can tell me where
embedded
Tomcat is expecting to find logging configuration files for hosted
applications using java.util.logging (or are there some properties
I need to
set up for each war/application).
In theory this should work
System.setProperty("catalina.base", appPath);
System.setProperty("catalina.home", appPath);
System.setProperty("java.util.logging.manager",
"org.apache.juli.ClassLoaderLogManager");
System.setProperty("java.util.logging.config.file",
propLogFile); //Points at logging.properties
Although it never has for me ;)
Why I dont know....
if someone else initiates the logger before you call
System.setProperty, then its too late for you to set them there. and
that is probably why, in most classes the logger is initialized as a
static field, during the class being loaded, and you have to make
sure that the classes that do that, don't get loaded before you call
System.setProperty
Thanks Filip... what would be very useful if you work on this area is
a little info on how TC
actually sets this up... at code level, this module read params, then
it call this, does that etc...
I'd like to try follow the code that does this and see where it
rejecting my input....
Thanks....
Filip
But if I put this on the command line...
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file="./build//conf//logging.properties"
-Dcatalina.home="./build" -Dcatalina.base="./build"
it does work....
If you ever figure out why the command line works but the System
properties dont... let me know
I have a feeling System.setProperty doesnt like windows file
notation... but I never got around to proving the theory.
Logging this way also steals the "standard error stream".
In the end I gave up on logging and just redirected the standard
error stream to my application and displayed that in a UI list...
that works well, but is
no good if you using log4j or whatever...
Good luck... cant say I'm too fond of tomcats logging...
you can still use log4j,
Filip
TIA,
--
Carl J. Mosca
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is a cool application server
---------------------------------------------------------------------------
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]