JBoss AS6.1 will not use log4j appenders - probably a bug? -


i want use log4j appenders in jboss 6.1 deployment. having trouble getting work, wrote test code , noted org.apache.log4j.logger.getlogger(string) returning object of type org.jboss.logmanager.log4j.bridgelogger.

so figured had 2 options: (1) try getlogger call return apache log4j type rather jboss bridgelogger, or (2) accept jboss doing sort of bridging , use log4j appenders have written need use.

so trying first of options: logger.getlogger() delegates logmanager.getlogger(string), does:

return getloggerrepository().getlogger(string); 

the repositoryselector static in logmanager , set this:

hierarchy h = new hierarchy(new rootlogger((level) level.debug)); repositoryselector = new defaultrepositoryselector(h); 

but logmanager has setrepositoryselector, conclusion came in jboss startup process calling setrepositoryselector. test called setrepositoryselector test logging code (setting ti defaultrepositoryselector static initializer of logmanager does), , checked type of logger returned - , it's still of type org.jboss.logmanager.log4j.bridgelogger!!

so moving on second option: want able use log4j appenders - deploy/jboss-logging.xml file has lot of commented out log4j appenders, must supported guess. therefore put 1 in follows:

<log4j-appender name="mytempfile" class="org.apache.log4j.rollingfileappender">     <error-manager>         <only-once/>     </error-manager>      <level name="debug"/>      <properties>         <property name="file">${jboss.server.home.dir}/log/serverx.log</property>         <property name="maximumfilesize">20480000</property>         <property name="maxbackupindex">5</property>     </properties>      <formatter>         <pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/>     </formatter>  </log4j-appender> <!-- tried <logger category="com.myco">    <level name="debug"/>    <handlers>       <handler-ref name="mytempfile"/>    </handlers> </logger> --> ... <root-logger>     <!-- set root logger priority via system property, default value. -->     <level name="${jboss.server.log.threshold:debug}"/>     <handlers>         <handler-ref name="mytempfile"/>         <handler-ref name="console"/>         <handler-ref name="file"/>     </handlers> </root-logger> 

with change, not not serverx.log file, not written server.log (server.log populated without above change).

i have read lot jboss-deployment-structure.xml , excluding log4j dependencies not understand enough being discussed know if relevant issue. suspect not relevant.

i tried deploying patch sounded relevant: https://issues.jboss.org/browse/jbas-8791 no difference.

anyone?

thanks, paul

in order use own log4j.xml in case application's log4j.jar not kept inside ear or war, have following things.

  1. set environment variable : -dlog4j.configuration=log4j.xml
  2. you have comment given line in <jboss_home>\server\default\deployers\jboss-logging.deployer\meta-inf\logmanager-jboss-beans.xml.

    <bean name="jbosslog4jrepostioryselector" class="org.jboss.logmanager.log4j.bridgerepositoryselector" />

hope work you


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -