You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by throwsCode <do...@yahoo.com> on 2011/06/23 00:09:32 UTC

JULI prefix not recognized?

Hi all;

I sure that is going to turnout to be a stupid question but I've played with
it for two days and made no progress.  I can create a JULI handler as long
as I don't apply a prefix, here is the logging.properties file (keeping it
as simple as possible):

THIS WORKS FINE ----
-----------------------------------------------------------------------------------
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${user.home}
org.apache.juli.FileHandler.prefix = localhost.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter
-----------------------------------------------------------------------------------

THIS FAILS ----
-----------------------------------------------------------------------------------
handlers = 1pae.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
.handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
1pae.org.apache.juli.FileHandler.level = FINE
1pae.org.apache.juli.FileHandler.directory = ${user.home}
1pae.org.apache.juli.FileHandler.prefix = localhost.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter
-----------------------------------------------------------------------------------

THE FOLLOWING ERROR OCCURS ON TOMCAT STARTUP:
-----------------------------------------------------------------------------------
Can't load log handler "1pae.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 1pae.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 1pae.org.apache.juli.FileHandler
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.util.logging.LogManager$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
	at java.util.logging.LogManager.initializeGlobalHandlers(Unknown Source)
	at java.util.logging.LogManager.access$900(Unknown Source)
	at java.util.logging.LogManager$RootLogger.addHandler(Unknown Source)
	at java.util.logging.LogManager$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
	at java.util.logging.LogManager.addLogger(Unknown Source)
	at java.util.logging.LogManager$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.util.logging.LogManager.<clinit>(Unknown Source)
	at java.util.logging.Logger.getLogger(Unknown Source)
	at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:71)
	at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:178)
	at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:171)
	at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:243)
	at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:298)
	at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:55)

The tomcat-juli.jar is available as demonstrated in the first example that
works.  Why is the prefix not being recognized?

Your assistance is greatly appreciated.

TC
-- 
View this message in context: http://old.nabble.com/JULI-prefix-not-recognized--tp31907205p31907205.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JULI prefix not recognized?

Posted by throwsCode <do...@yahoo.com>.
Thanks Konstantin:

I appreciate all the great information.  I'm going to look into log4j while
I'm involved with logging.  Hopefully by the end there will be a clear
winner between java.util.logging, JULI, and log4j, based on our needs.
 
Much Thanks.

TC




Konstantin Kolinko wrote:
> 
> 2011/6/24 throwsCode <do...@yahoo.com>:
>>
>> Hi Konstantin:
>>
>> I added the following argument to the Apache Tomcat Server Run
>> Configuration:
>>
>> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
>>
>> It worked just as you suggested it would; however, it requires the
>> argument
>> be placed in the VM arguments section.  I have many small clients that on
>> occassion share VMs with other Tomcat Servers.  Is there a way to do the
>> same without the Runtime Argument?
>>
> 
> Embedding?
> 
> I am afraid that there is no other way.
> 
> This property configures java.util.logging implementation used by VM.
> 
> IIRC in java.util.logging there exists a method that allows to reset
> logging configuration,  but I think it only allows to reconfigure
> handlers, and does not support replacing LogManager at runtime.
> 
> You can look into JRE sources  to see at what time the value of
> "java.util.logging.manager" property is being read.
> 
> 
> (*) You may have better luck by configuring Tomcat to use log4j (see
> relevant section in our logging.html).  With log4j you can go without
> ClassLoaderLogManager and without logging.properties, but there is one
> caveat:
>    - Tomcat (using commons-logging) and webapps that use
> commons-logging will detect presence of log4j and use it instead of
> java.util.logging
>    - Any web-applications that use java.util.logging will try to use
> default LogManager implementation, and will suffer from PermGen memory
> leaks during redeployments and restarts. Because default LogManager
> from JRE will keep their classes in memory.
> 
> The (*) is theory. I have not tested it in practice.
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/JULI-prefix-not-recognized--tp31907205p31916749.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JULI prefix not recognized?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/6/24 throwsCode <do...@yahoo.com>:
>
> Hi Konstantin:
>
> I added the following argument to the Apache Tomcat Server Run
> Configuration:
>
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
>
> It worked just as you suggested it would; however, it requires the argument
> be placed in the VM arguments section.  I have many small clients that on
> occassion share VMs with other Tomcat Servers.  Is there a way to do the
> same without the Runtime Argument?
>

Embedding?

I am afraid that there is no other way.

This property configures java.util.logging implementation used by VM.

IIRC in java.util.logging there exists a method that allows to reset
logging configuration,  but I think it only allows to reconfigure
handlers, and does not support replacing LogManager at runtime.

You can look into JRE sources  to see at what time the value of
"java.util.logging.manager" property is being read.


(*) You may have better luck by configuring Tomcat to use log4j (see
relevant section in our logging.html).  With log4j you can go without
ClassLoaderLogManager and without logging.properties, but there is one
caveat:
   - Tomcat (using commons-logging) and webapps that use
commons-logging will detect presence of log4j and use it instead of
java.util.logging
   - Any web-applications that use java.util.logging will try to use
default LogManager implementation, and will suffer from PermGen memory
leaks during redeployments and restarts. Because default LogManager
from JRE will keep their classes in memory.

The (*) is theory. I have not tested it in practice.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JULI prefix not recognized?

Posted by throwsCode <do...@yahoo.com>.
Hi Konstantin:

I added the following argument to the Apache Tomcat Server Run
Configuration:

-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

It worked just as you suggested it would; however, it requires the argument
be placed in the VM arguments section.  I have many small clients that on
occassion share VMs with other Tomcat Servers.  Is there a way to do the
same without the Runtime Argument?

Thanks much.

TC





Konstantin Kolinko wrote:
> 
> 2011/6/23 throwsCode <do...@yahoo.com>:
>>
>> I sure that is going to turnout to be a stupid question but I've played
>> with
>> it for two days and made no progress.  I can create a JULI handler as
>> long
>> as I don't apply a prefix, here is the logging.properties file (keeping
>> it
>> as simple as possible):
>>
> 
>> Can't load log handler "1pae.org.apache.juli.FileHandler"
>> java.lang.ClassNotFoundException: 1pae.org.apache.juli.FileHandler
>> java.lang.ClassNotFoundException: 1pae.org.apache.juli.FileHandler
> (...)
>>        at java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
>>        at java.util.logging.LogManager.initializeGlobalHandlers(Unknown
>> Source)
> 
> You are using wrong LogManager.
> You need to use org.apache.juli.ClassLoaderLogManager and not the default
> one.
> 
> See how catalina.sh does it.
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/JULI-prefix-not-recognized--tp31907205p31915598.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JULI prefix not recognized?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/6/23 throwsCode <do...@yahoo.com>:
>
> I sure that is going to turnout to be a stupid question but I've played with
> it for two days and made no progress.  I can create a JULI handler as long
> as I don't apply a prefix, here is the logging.properties file (keeping it
> as simple as possible):
>

> Can't load log handler "1pae.org.apache.juli.FileHandler"
> java.lang.ClassNotFoundException: 1pae.org.apache.juli.FileHandler
> java.lang.ClassNotFoundException: 1pae.org.apache.juli.FileHandler
(...)
>        at java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
>        at java.util.logging.LogManager.initializeGlobalHandlers(Unknown Source)

You are using wrong LogManager.
You need to use org.apache.juli.ClassLoaderLogManager and not the default one.

See how catalina.sh does it.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JULI prefix not recognized?

Posted by throwsCode <do...@yahoo.com>.
Thanks Konstantin:

I thought the JULI Classes automatically replaced the java.util.logging
Classes with the same name.  Thanks for catching that, I'll checkout
catalina.sh and try to figure this out.

TC



throwsCode wrote:
> 
> Hi all;
> 
> I sure that is going to turnout to be a stupid question but I've played
> with it for two days and made no progress.  I can create a JULI handler as
> long as I don't apply a prefix, here is the logging.properties file
> (keeping it as simple as possible):
> 
> THIS WORKS FINE ----
> -----------------------------------------------------------------------------------
> handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
> .handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
> org.apache.juli.FileHandler.level = FINE
> org.apache.juli.FileHandler.directory = ${user.home}
> org.apache.juli.FileHandler.prefix = localhost.
> java.util.logging.ConsoleHandler.level = FINE
> java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
> -----------------------------------------------------------------------------------
> 
> THIS FAILS ----
> -----------------------------------------------------------------------------------
> handlers = 1pae.org.apache.juli.FileHandler,
> java.util.logging.ConsoleHandler
> .handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
> 1pae.org.apache.juli.FileHandler.level = FINE
> 1pae.org.apache.juli.FileHandler.directory = ${user.home}
> 1pae.org.apache.juli.FileHandler.prefix = localhost.
> java.util.logging.ConsoleHandler.level = FINE
> java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
> -----------------------------------------------------------------------------------
> 
> THE FOLLOWING ERROR OCCURS ON TOMCAT STARTUP:
> -----------------------------------------------------------------------------------
> Can't load log handler "1pae.org.apache.juli.FileHandler"
> java.lang.ClassNotFoundException: 1pae.org.apache.juli.FileHandler
> java.lang.ClassNotFoundException: 1pae.org.apache.juli.FileHandler
> 	at java.net.URLClassLoader$1.run(Unknown Source)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(Unknown Source)
> 	at java.lang.ClassLoader.loadClass(Unknown Source)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> 	at java.lang.ClassLoader.loadClass(Unknown Source)
> 	at java.util.logging.LogManager$3.run(Unknown Source)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
> 	at java.util.logging.LogManager.initializeGlobalHandlers(Unknown Source)
> 	at java.util.logging.LogManager.access$900(Unknown Source)
> 	at java.util.logging.LogManager$RootLogger.addHandler(Unknown Source)
> 	at java.util.logging.LogManager$3.run(Unknown Source)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.util.logging.LogManager.loadLoggerHandlers(Unknown Source)
> 	at java.util.logging.LogManager.addLogger(Unknown Source)
> 	at java.util.logging.LogManager$1.run(Unknown Source)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.util.logging.LogManager.<clinit>(Unknown Source)
> 	at java.util.logging.Logger.getLogger(Unknown Source)
> 	at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:71)
> 	at
> org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:178)
> 	at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:171)
> 	at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:243)
> 	at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:298)
> 	at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:55)
> 
> The tomcat-juli.jar is available as demonstrated in the first example that
> works.  Why is the prefix not being recognized?
> 
> Your assistance is greatly appreciated.
> 
> TC
> 

-- 
View this message in context: http://old.nabble.com/JULI-prefix-not-recognized--tp31907205p31907973.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org