Bug 37078 - JULI, Remote, JMX
Summary: JULI, Remote, JMX
Status: RESOLVED WONTFIX
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: Unknown
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-13 16:58 UTC by Sebastian Davids
Modified: 2005-10-15 07:33 UTC (History)
0 users



Attachments
Test Servlet (1.25 KB, text/plain)
2005-10-13 17:00 UTC, Sebastian Davids
Details
Class to access the Logging MBean remotely (913 bytes, text/plain)
2005-10-13 17:01 UTC, Sebastian Davids
Details
{webapp.base}/WEB-INF/classes/logging.properties (1.05 KB, text/plain)
2005-10-13 17:02 UTC, Sebastian Davids
Details
{webapp.base}/WEB-INF/classes/logging.properties (701 bytes, text/plain)
2005-10-13 17:03 UTC, Sebastian Davids
Details
{catalina.base}/conf/logging.properties (2.81 KB, text/plain)
2005-10-13 17:04 UTC, Sebastian Davids
Details
{webapp.base}/WEB-INF/web.xml (707 bytes, text/plain)
2005-10-13 17:04 UTC, Sebastian Davids
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Davids 2005-10-13 16:58:52 UTC
I'm not sure if this is a known bug, a misconfiguration on my part or a "feature".

I use java.util.logging. I want to be able to change the Logger levels remotely
via JMX (JConsole).

As it seems one cannot use JULI and use the LoggingMXBean successfully at the
same time.

One can either set the Logger level remotely but not the Handler level (without
JULI) or one can set the Handler level but not the Logger level remotely (with
JULI).

To clarify: I do *not* want to change the handler levels remotely -- just the
Logger levels.

Example: Set Handler to FINE at deploy time and tune Logger level remotely via
JMX at runtime.

Use the attached files for the steps below.

@@ Without JULI - can set Logger level but not Handler level @@

Start Tomcat 5.5.12 with:

"-server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8081
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"

Open your browser and invoke the servlet; it's output:

Manager: null
Remote: true
Manager Class: class java.util.logging.LogManager
Logger through manager: true
Logger through bean: true
Logger level: null

Run CommandLineManagementConsole (or use JConsole and check if LoggerNames
contains "de.LogTestServlet"); it's output:

Logger through remote connection: true

@@ with JULI - can set Handler level but not Logger level @

Start Tomcat 5.5.12 with:

"-server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8081
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"

Open your browser and invoke the servlet; it's output:

Manager: org.apache.juli.ClassLoaderLogManager
Remote: true
Manager Class: class org.apache.juli.ClassLoaderLogManager
Logger through manager: true
Logger through bean: true
Logger level: FINE

Run CommandLineManagementConsole (or use JConsole and check if LoggerNames
contains "de.LogTestServlet"); it's output:

Logger through remote connection: false
Comment 1 Sebastian Davids 2005-10-13 17:00:10 UTC
Created attachment 16686 [details]
Test Servlet
Comment 2 Sebastian Davids 2005-10-13 17:01:32 UTC
Created attachment 16687 [details]
Class to access the Logging MBean remotely
Comment 3 Sebastian Davids 2005-10-13 17:02:21 UTC
Created attachment 16688 [details]
{webapp.base}/WEB-INF/classes/logging.properties
Comment 4 Sebastian Davids 2005-10-13 17:03:10 UTC
Created attachment 16689 [details]
{webapp.base}/WEB-INF/classes/logging.properties
Comment 5 Sebastian Davids 2005-10-13 17:04:02 UTC
Created attachment 16690 [details]
{catalina.base}/conf/logging.properties
Comment 6 Sebastian Davids 2005-10-13 17:04:38 UTC
Created attachment 16691 [details]
{webapp.base}/WEB-INF/web.xml
Comment 7 Sebastian Davids 2005-10-13 17:11:00 UTC
logging.properties files are either the default ones or adjusted from the one here:

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/logging.html

Controlling Log Levels remotely with JConsole:

http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html#LoggingControl

JMX command-line parameters for remote access:

http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#remote
Comment 8 Remy Maucherat 2005-10-14 17:33:25 UTC
This JMX feature cannot be made to work with non core loggers.
Why did you file a bug ? This is users@tomcat material ...
Comment 9 Sebastian Davids 2005-10-15 15:10:45 UTC
This feature can work with non core loggers.

Looking at the source I think it is a "feature" of your implementation -- so
WONT-FIX would be a better resolution .)

As I see it both getLogger(final String name) getLoggerNames() return the
Loggers registered under the calling Thread's Classloader.

A solution would be to iterate classLoaderLoggers and return the aggregate
(getLoggerNames) or search the aggregate for a logger (getLogger).

But I'm not into the details of the implementation yet.
Comment 10 Remy Maucherat 2005-10-15 15:14:20 UTC
Yes, and you know the classloader for which you want to change the logger how
exactly ? Forget it.

Obviously, everything about jul is completely pluggable, so you can write your
own log manager quite easily.
Comment 11 Sebastian Davids 2005-10-15 15:33:38 UTC
I know this is totally unrelated to this bug, but I don't want hunt through the
bug db for half an hour just to get in touch with you again :)

I just downloaded the source distribution from
http://apache.autinity.de/tomcat/tomcat-5/v5.5.12/src/apache-tomcat-5.5.12-src.zip

Unzipped it.

Went into the JULI "home" dir. And invoked ant there; the build failed because
it could not find "MANIFEST.MF" there.

Removing manifest="${build.home}/conf/MANIFEST.MF" from the build file fixed it;
probably either the line should be removed or a MANIFEST.MF should be supplied
with your source distribution.