Enable logging for JBOSS class loading

允我心安 提交于 2019-12-04 22:11:03

问题


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.


回答1:


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>
    



回答2:


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>  



回答3:


You can also enable logs in command prompt or pass as parameters to the JBoss server using IDE as:

set "JAVA_OPTS=%JAVA_OPTS% -Xms2048m -Xmx4096m -XX:MaxPermSize=256m 
-Dorg.jboss.resolver.warning=true -Dorg.apache.camel.jmx.disabled=true 
-Djboss.server.log.threshold=DEBUG -Dsun.rmi.dgc.client.gcInterval=3600000 
-Dsun.rmi.dgc.server.gcInterval=3600000" 

Here we are also increasing the memory since writing debug results in a file/console increases memory consumption. Sometimes if we do not increase the memory, it causes a permGem error.



来源:https://stackoverflow.com/questions/6690000/enable-logging-for-jboss-class-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!