You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Carl Mosca <ca...@gmail.com> on 2007/10/12 16:29:27 UTC

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

TIA,

-- 
Carl J. Mosca

Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Johnny,

Johnny Kewl wrote:
> If you ever figure out why the command line works but the System
> properties don't... let me know

It's probably because, by the time your System.setProperty code runs,
the logger has already been set up. What you need to do is re-initialize
the logging system. I'm not sure how to do that, but I'm sure that's
what's missing.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHD6BT9CaO5/Lv0PARAnx/AKCyKRd/GJ/0hmXbgCrjhPxwuT5TqQCbB/y2
9heetuveamSLS/4G11ylaGI=
=0PbE
-----END PGP SIGNATURE-----

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


Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool application server
---------------------------------------------------------------------------
> ----- Original Message ----- 
> From: "Johnny Kewl" <jo...@kewlstuff.co.za>
> To: "Tomcat Users List" <us...@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" <de...@hanik.com>
>> To: "Tomcat Users List" <us...@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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Carl Mosca <ca...@gmail.com>.
I really appreciate the timeliness of all the responses and the theory
behind how and when logging is configured and initialized has been explained
really well.

However I'm not so sure I have explained where I actually am very well.  I
have been able to configure Java logging via the command line and within the
app I wrote which utilizes embedded Tomcat and get desired output.

The output I am not getting is from the either of the two web applications
(which are registered wars).

The part I am not following is if I am getting output from the logging
(which utilizes java.util.logging ) in the application itself and the hosted
web applications are also using java.util.logging, why am I not getting
output from these?

If the configuration is ignored because the JVM has already been
initialized, I would think the configuration set via the Java Control Panel
would be utilized.

I suspect there's something simple I am not doing when I register these
apps.



> All the above is correct.  See the API doc for
> java.util.logging.LogManager .  The static initializer for that class
> uses either an instanced of itself or an instance of the class named on
> the aforementioned system property.  Thus, you need to set
> java.util.logging.manager prior to initializing the JVM.
>

RE: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Johnny Kewl [mailto:john@kewlstuff.co.za] 
> Subject: Re: embedded Tomcat (5.5.23) application logging 
> (java.util.logging)
> 
> 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.

All the above is correct.  See the API doc for
java.util.logging.LogManager.  The static initializer for that class
uses either an instanced of itself or an instance of the class named on
the aforementioned system property.  Thus, you need to set
java.util.logging.manager prior to initializing the JVM.

Possible solutions:

1) Make sure the system property is set on the command line for the
launcher.

2) Write your own launcher that sets the property then initializes a JVM
via JNI (thereby sacrificing platform independence).

3) Start the embedded Tomcat in a child JVM, so its system properties
can be set beforehand.  Use java.lang.ProcessBuilder or
java.lang.Runtime#exec.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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


Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool application server
---------------------------------------------------------------------------
----- Original Message ----- 
From: "Johnny Kewl" <jo...@kewlstuff.co.za>
To: "Tomcat Users List" <us...@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" <de...@hanik.com>
> To: "Tomcat Users List" <us...@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 ;)


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


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


Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool application server
---------------------------------------------------------------------------
----- Original Message ----- 
From: "Filip Hanik - Dev Lists" <de...@hanik.com>
To: "Tomcat Users List" <us...@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???

Thanks...





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


Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Carl Mosca <ca...@gmail.com>.
Is there anything that has to be done after the individual wars (context)
are registered?

On 10/12/07, Carl Mosca <ca...@gmail.com> wrote:
>
> I had my logging.properties files mixed up.
>
> Now I am back where I started: I have logging from the hosting app but not
> either of the two apps I am hosting.
>
> The logging from the app works both when I code the logging properties and
> when I supply them from the command line.
>
> What I am wondering is (and if so how) is the setup for logging different
> for the hosted apps?  These are seemingly ignored.  I can take the same two
> war files and put them on a Tomcat server and the logging works just fine.
>
>
>


-- 
Carl J. Mosca

Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Carl Mosca <ca...@gmail.com>.
I had my logging.properties files mixed up.

Now I am back where I started: I have logging from the hosting app but not
either of the two apps I am hosting.

The logging from the app works both when I code the logging properties and
when I supply them from the command line.

What I am wondering is (and if so how) is the setup for logging different
for the hosted apps?  These are seemingly ignored.  I can take the same two
war files and put them on a Tomcat server and the logging works just fine.

Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Carl Mosca <ca...@gmail.com>.
I'm missing something else.  I tried this last night (but couldn't recall
what I bumped into).

Where is the log handler expected to be?

I get this message:

Can't load log handler "org.apache.juli.FileHandler "

I think that's in commons-logging.jar (which should be available).

Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
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" 
> <de...@hanik.com>
> To: "Tomcat Users List" <us...@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" <ca...@gmail.com>
>>> To: <us...@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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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


Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.

----- Original Message ----- 
From: "Filip Hanik - Dev Lists" <de...@hanik.com>
To: "Tomcat Users List" <us...@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" <ca...@gmail.com>
>> To: <us...@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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Johnny Kewl wrote:
>
> ----- Original Message ----- From: "Carl Mosca" <ca...@gmail.com>
> To: <us...@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

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


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


Re: embedded Tomcat (5.5.23) application logging (java.util.logging)

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Carl Mosca" <ca...@gmail.com>
To: <us...@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....

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

>
> TIA,
>
> -- 
> Carl J. Mosca
> 


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


RE: Override BOOTSTRAP classloader with endorsed directory

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: ypomonh [mailto:ypomonh@freemail.gr] 
> Subject: Override BOOTSTRAP classloader with endorsed directory
> 
> This is a newer version of the API than the one shipped
> with JDK 6, so in order to avoid loading the older library
> from the bootstrap loader, I put the new JAX-WS JARs in
> <java-home>/lib/endorsed.

You didn't bother to tell us what Tomcat version you're using or what
platform you're running on, but the Tomcat 6 startup scripts set the
java.endorsed.dirs system property to ${CATALINA_HOME}/common/endorsed,
thereby overriding the default JDK endorsed path.  Place your jar there,
not in ${JAVA_HOME}/lib/endorsed, to make it effective.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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


Re: Override BOOTSTRAP classloader with endorsed directory

Posted by David Delbecq <de...@oma.be>.
Tomcat ignores classpath from JVM and creates it's own one, including
endorsed libraries. If you want to inject specific library at the
endorsed level there is an endorsed/lib folder part of tomcat distribution.
ypomonh a écrit :
> I'm trying to write a servlet that use the latest version of JAX-WS API.
>
> This is a newer version of the API than the one shipped with JDK 6, so
> in order to avoid loading the older library from the bootstrap loader,
> I put the new JAX-WS JARs in <java-home>/lib/endorsed.
>
> Still when the servlet runs I get an error message that indicates that
> the required libs are loaded from the bootstrap classloader. It is
> like the endorsed directory is completely ignored by Tomcat :-(
>
>
> If I am correct and Tomcat ignores the endorsed directory mechanism,
> this means that I cannot override ANY classes that are shipped with
> the JDK, even if I place their JARs in any of the folders that are
> required by the Tomcat specific classloaders...
>
>
> ---------------------------------------------------------------------
> 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


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


Override BOOTSTRAP classloader with endorsed directory

Posted by ypomonh <yp...@freemail.gr>.
I'm trying to write a servlet that use the latest version of JAX-WS API.

This is a newer version of the API than the one shipped with JDK 6, so 
in order to avoid loading the older library from the bootstrap loader, I 
put the new JAX-WS JARs in <java-home>/lib/endorsed.

Still when the servlet runs I get an error message that indicates that 
the required libs are loaded from the bootstrap classloader. It is like 
the endorsed directory is completely ignored by Tomcat :-(


If I am correct and Tomcat ignores the endorsed directory mechanism, 
this means that I cannot override ANY classes that are shipped with the 
JDK, even if I place their JARs in any of the folders that are required 
by the Tomcat specific classloaders...


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