Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable logging for JBOSS class loading

How do we enable logging to debug class loading issues in JBoss 5.x. If it is under JBOSS_HOME/server/xxxxx/conf to configure jboss-log4j.xml, should we need to add any piece of code or is there any other way to enable tracing.

like image 542
Hareesh Ram Avatar asked Jul 14 '11 07:07

Hareesh Ram


People also ask

What are the logging services provided by the JBoss server?

By default, JBoss produces output to both the console and a log file ( log/server. log ). There are 5 basic log levels used: DEBUG , INFO , WARN , ERROR and FATAL .

How do I change the logging level in JBoss?

Note: You need not restart the site for JBoss to pick up these changes. To change log levels as a root user, perform the following: To enable debug logging, run the following command: /subsystem=logging/root-logger=ROOT:change-root-log-level(level=DEBUG)

What is JBoss logging?

JBoss Logging is a logging facade which can bind to different log managers allowing your applications to be log manager agnostic.


2 Answers

You can turn on logging in two places:

  1. In JVM - you should just pass the extra switch -verbose:class. You can put these switch in your run.conf file in JAVA_OPTS variable definition.

  2. Turn logging in jboss-log4j.xml file. You should place in the file such definition:

    <category name="org.jboss.classloader">
       <priority value="DEBUG"/>
    </category>
    
like image 117
Lukasz Stelmach Avatar answered Sep 19 '22 11:09

Lukasz Stelmach


It worked for me. I did add like below.

<appender name="CLASSLOADING" class="org.jboss.logging.appender.RollingFileAppender">     
  <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>     
  <param name="File" value= "${jboss.server.log.dir}/classloading.log"/>     
  <param name="Append" value="false"/>    
  <param name="MaxFileSize" value="5000KB"/>    
  <param name="MaxBackupIndex" value="10"/>     
  <layout class="org.apache.log4j.PatternLayout">    
    <param name="ConversionPattern" value="%d %m%n"/>    
  </layout> 
</appender>   

<category name="org.jboss.classloading">
  <priority value="TRACE"/>    
  <appender-ref ref="CLASSLOADING"/> 
</category>  
like image 30
Hareesh Ram Avatar answered Sep 19 '22 11:09

Hareesh Ram