---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool application server
---------------------------------------------------------------------------
----- Original Message ----- From: "Johnny Kewl" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Saturday, October 13, 2007 7:05 AM
Subject: Re: embedded Tomcat (5.5.23) application logging (java.util.logging)


----- Original Message ----- From: "Filip Hanik - Dev Lists" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, October 12, 2007 9:44 PM
Subject: Re: embedded Tomcat (5.5.23) application logging (java.util.logging)


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

Hi Filip... maybe you can help me here...
Its actually not that I'm starting TC then doing the System.setProperty.... I do props first. I'm using the 6.0.13 code and when I search it for "java.util.logging.manager" ... ie to see where it actualy reads this property, I can find it anywhere.

For example in ClassLoaderLogManager... there is the this line for getting the prop to the config file... String configFileStr = System.getProperty("java.util.logging.config.file");

BUT there seems to be no similar line to read this property...
System.setProperty("java.util.logging.manager", "org.apache.juli.ClassLoaderLogManager");

So the problem seems to be that nowhere does the TC code read this property?????? Its like I got a missing class... or theres a precompiled class that must be included.... I dont understand this???

I think this is the problem... guessing here
This "java.util.logging.manager" is part of Java, not Tomcat...
So on the command line "as Java starts" it inits this...
So I think even if this property is set as the 1st line in your code, its too late.
The app has started and so Command line options are missed.
TC then calls this.... Logger.getLogger... and finds no ClassLoaderLogManager set.

The console must be set in TC somewhere because that still works... it seems that when
ClassLoaderLogManager is not set, no log files will be recorded...
I think one has to tell java.util.logging.Logger to use ClassLoaderLogManager directly in the embedded program...

Hopefully a Guru helps the original user here...

... and as I said before, all I did in the end was trap the console output, display it in the app and if I want a LOG file, I'll just write it out to one... it just gets too complicated, trying to figure out how TC redirects streams, and manages log options in an embedded app... If it does work then it also redirects standard output, so if you get the logs going then I think you can kiss displaying messages directly to the user, through the app goodbye... I dont know... I just avoid TC's logging.

Good Luck.... Thats my best shot... I officially give up ;)

Ah... I think I'm onto it...
Have a look at this link...
http://www.vsj.co.uk/java/display.asp?id=319

Have a look at this section....
// set default logger and realm
FileLogger fileLog = new FileLogger();
fileLog.setDirectory(".");
fileLog.setPrefix("vsjMbedTC5");
fileLog.setSuffix(".log");
fileLog.setTimestamp(true);
mbedTC5.setLogger(fileLog);

See.... the guy is setting up a simple logger... which I think does mean the
System.setProperty("java.util.logging.manager", "org.apache.juli.ClassLoaderLogManager");
property is in fact useless in an embedded app

Ok now I  officially give up ;)



---------------------------------------------------------------------
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