How to enable DEBUG logging for JConsole or JVisualVM

Solution Verified - Updated -

Environment

Red Hat JBoss Enterprise Application Platform

Issue

  • How to enable DEBUG logging for jconsole
  • How to enable DEBUG logging for jvisualvm
  • Communication issue with JMX connecting to JBoss EAP domain / standalone mode

Resolution


Disclaimer: Links contained herein to an external website(s) are provided for convenience only. Red Hat has not reviewed the links and is not responsible for the content or its availability. The inclusion of any link to an external website does not imply endorsement by Red Hat of the website or their entities, products or services. You agree that Red Hat is not responsible or liable for any loss or expenses that may result due to your use of (or reliance on) the external site or content.


Enabling Debug on JConsole:
For JConsole, the following options can be taken to debug the issue:

  1. Use -debug option, as in:

    jconsole -debug <pid>
    
  2. Create a Java Util Logging (JUL) logging properties file for JConsole

    Example logging-jconsole.properties :

    handlers=java.util.logging.ConsoleHandler
    
    .level=INFO
    java.util.logging.ConsoleHandler.level=FINEST
    java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
    javax.management.level=FINEST
    javax.management.remote.level=FINEST
    

    The commad to use will be then:

    jconsole.sh -J-Djava.util.logging.config.file=logging-jconsole.properties
    
  3. Finally, if it's a security issue it is possible to monitor security access:

    jconsole -J-Djava.security.debug=all
    

When debugging issues on JConsole, the following properties can be passed to disable security are these:

-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false 

Enabling Debug on Visual VM:

For Visual VM, the same logging properties, described above, can be used and it can be enabled similarly:

jvisualvm -J-Djava.util.logging.config.file=logging-jconsole.properties

Windows Note
Note there is a bug where the jconsole.bat is not passing the command line arguments to jconsole.exe.
See this article for the workaround/fix : jconsole.bat is not passing command line arguments down to jconsole.exe in JBoss EAP 6.4

Diagnostic Steps

Attachments

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.