You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul Taylor <pa...@fastmail.fm> on 2004/09/27 21:11:24 UTC
using the Standard jdk 1.4 logging with Tomcat 5
Hi in a previous non Tomcat project I wrote some classes that used the
java.util.logging library that comes with java 1.4 quite successfully. I
am now trying to use the same classes with Toimcat 5.0 but it doesnt
like it. With the logging classes you can provide a configuration class
which you define with a property "java.util.logging.config.class", I put
the class in my WEB_INF\classes with all the other classes.
When I run with Tomcat i have a servlet that does the following to try
and initilse the logging
com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
System.getProperties().setProperty("java.util.logging.config.class",
"com.appserver.util.logging.LogProperties");
LogManager.getLogManager().readConfiguration();
it complains it cant find the class, when running readConfiguration(),
(The 1st two lines run ok). I think the problem is to do with Tomcat
classloader, with a simple Java application the classes would be
expected to be on the system classpath, but on Tomcat the system
classpath only contains bootstrap.jar.
I realise I could probably get things working using Apaches log4j
instead but it seems a bit silly to use that when there is a perfectly
adequate logger built into the language now.
Anyone done this ?
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: using the Standard jdk 1.4 logging with Tomcat 5
Posted by Remy Maucherat <re...@gmail.com>.
On Mon, 27 Sep 2004 20:11:24 +0100, Paul Taylor <pa...@fastmail.fm> wrote:
> Hi in a previous non Tomcat project I wrote some classes that used the
> java.util.logging library that comes with java 1.4 quite successfully. I
> am now trying to use the same classes with Toimcat 5.0 but it doesnt
> like it. With the logging classes you can provide a configuration class
> which you define with a property "java.util.logging.config.class", I put
> the class in my WEB_INF\classes with all the other classes.
>
> When I run with Tomcat i have a servlet that does the following to try
> and initilse the logging
>
> com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
> System.getProperties().setProperty("java.util.logging.config.class",
> "com.appserver.util.logging.LogProperties");
> LogManager.getLogManager().readConfiguration();
>
> it complains it cant find the class, when running readConfiguration(),
> (The 1st two lines run ok). I think the problem is to do with Tomcat
> classloader, with a simple Java application the classes would be
> expected to be on the system classpath, but on Tomcat the system
> classpath only contains bootstrap.jar.
>
> I realise I could probably get things working using Apaches log4j
> instead but it seems a bit silly to use that when there is a perfectly
> adequate logger built into the language now.
>
> Anyone done this ?
I doubt that this kind of logging configuration can be done in the
webapp, due to classloader visibility.
--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: using the Standard jdk 1.4 logging with Tomcat 5
Posted by Paul Taylor <pa...@fastmail.fm>.
Spoke to someone else who had the same problem.
As far as I can see this is a bug in Tomcat, it is unable to find the
custom formatter unless anyone knows different Ill raise this as a bug.
Paul Taylor wrote:
> Did you specify your own formatter in your properties file ?
>
> Ive changed my code from
>
> com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
>
> System.getProperties().setProperty("java.util.logging.config.class",
> "com.appserver.util.logging.LogProperties");
> LogManager.getLogManager().readConfiguration();
>
> to
>
> com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
>
> LogManager.getLogManager().readConfiguration(com.appserver.util.logging.LogProperties.getPropertiesAsStream());
>
>
>
>
> Now I dont get any errors and only messages for the LEVEL is set to
> the value I specify in my LogProperties class are displayed. However I
> also specify a Formatter to use for console output but Tomcat just
> seems to ignore it and uses its own default formatter.
>
>
> Jukka Uusisalo wrote:
>
>> Hi,
>>
>> I have used jdk 1.4 logging with tomcat 5.0.x without any
>> problems, but i have configured logging with
>> java.util.logging.config.file property and
>> config file.
>>
>> - Jukka -
>>
>> Paul Taylor wrote:
>>
>>> Hi in a previous non Tomcat project I wrote some classes that used
>>> the java.util.logging library that comes with java 1.4 quite
>>> successfully. I am now trying to use the same classes with Toimcat
>>> 5.0 but it doesnt like it. With the logging classes you can provide
>>> a configuration class which you define with a property
>>> "java.util.logging.config.class", I put the class in my
>>> WEB_INF\classes with all the other classes.
>>> When I run with Tomcat i have a servlet that does the following to
>>> try and initilse the logging
>>>
>>>
>>> com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
>>>
>>> System.getProperties().setProperty("java.util.logging.config.class",
>>> "com.appserver.util.logging.LogProperties");
>>> LogManager.getLogManager().readConfiguration();
>>>
>>> it complains it cant find the class, when running
>>> readConfiguration(), (The 1st two lines run ok). I think the problem
>>> is to do with Tomcat classloader, with a simple Java application the
>>> classes would be expected to be on the system classpath, but on
>>> Tomcat the system classpath only contains bootstrap.jar.
>>>
>>> I realise I could probably get things working using Apaches log4j
>>> instead but it seems a bit silly to use that when there is a
>>> perfectly adequate logger built into the language now.
>>>
>>> Anyone done this ?
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: using the Standard jdk 1.4 logging with Tomcat 5
Posted by Paul Taylor <pa...@fastmail.fm>.
Did you specify your own formatter in your properties file ?
Ive changed my code from
com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
System.getProperties().setProperty("java.util.logging.config.class", "com.appserver.util.logging.LogProperties");
LogManager.getLogManager().readConfiguration();
to
com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
LogManager.getLogManager().readConfiguration(com.appserver.util.logging.LogProperties.getPropertiesAsStream());
Now I dont get any errors and only messages for the LEVEL is set to the
value I specify in my LogProperties class are displayed. However I also
specify a Formatter to use for console output but Tomcat just seems to
ignore it and uses its own default formatter.
Jukka Uusisalo wrote:
> Hi,
>
> I have used jdk 1.4 logging with tomcat 5.0.x without any problems,
> but i have configured logging with java.util.logging.config.file
> property and
> config file.
>
> - Jukka -
>
> Paul Taylor wrote:
>
>> Hi in a previous non Tomcat project I wrote some classes that used
>> the java.util.logging library that comes with java 1.4 quite
>> successfully. I am now trying to use the same classes with Toimcat
>> 5.0 but it doesnt like it. With the logging classes you can provide a
>> configuration class which you define with a property
>> "java.util.logging.config.class", I put the class in my
>> WEB_INF\classes with all the other classes.
>> When I run with Tomcat i have a servlet that does the following to
>> try and initilse the logging
>>
>>
>> com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
>>
>> System.getProperties().setProperty("java.util.logging.config.class",
>> "com.appserver.util.logging.LogProperties");
>> LogManager.getLogManager().readConfiguration();
>>
>> it complains it cant find the class, when running
>> readConfiguration(), (The 1st two lines run ok). I think the problem
>> is to do with Tomcat classloader, with a simple Java application the
>> classes would be expected to be on the system classpath, but on
>> Tomcat the system classpath only contains bootstrap.jar.
>>
>> I realise I could probably get things working using Apaches log4j
>> instead but it seems a bit silly to use that when there is a
>> perfectly adequate logger built into the language now.
>>
>> Anyone done this ?
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: using the Standard jdk 1.4 logging with Tomcat 5
Posted by Jukka Uusisalo <ju...@dnainternet.net>.
Hi,
I have used jdk 1.4 logging with tomcat 5.0.x without any problems,
but i have configured logging with java.util.logging.config.file
property and
config file.
- Jukka -
Paul Taylor wrote:
> Hi in a previous non Tomcat project I wrote some classes that used the
> java.util.logging library that comes with java 1.4 quite successfully.
> I am now trying to use the same classes with Toimcat 5.0 but it doesnt
> like it. With the logging classes you can provide a configuration
> class which you define with a property
> "java.util.logging.config.class", I put the class in my
> WEB_INF\classes with all the other classes.
> When I run with Tomcat i have a servlet that does the following to try
> and initilse the logging
>
>
> com.appserver.util.logging.LogProperties.setLevelFromParametersFromPrefs();
>
> System.getProperties().setProperty("java.util.logging.config.class",
> "com.appserver.util.logging.LogProperties");
> LogManager.getLogManager().readConfiguration();
>
> it complains it cant find the class, when running readConfiguration(),
> (The 1st two lines run ok). I think the problem is to do with Tomcat
> classloader, with a simple Java application the classes would be
> expected to be on the system classpath, but on Tomcat the system
> classpath only contains bootstrap.jar.
>
> I realise I could probably get things working using Apaches log4j
> instead but it seems a bit silly to use that when there is a perfectly
> adequate logger built into the language now.
>
> Anyone done this ?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org