4 Replies Latest reply on Nov 7, 2012 1:21 PM by James Perkins

    Custom log4j appender is not working after upgrade to 7.1.1 from 7.0.2

    Ashwini Gurucharan Newbie

      I have a custom appender which was working fine in 7.0.2, the same configuration in 7.1.1 does not show up any logs.

       

      I have excluded the following in the jboss-deployment-structure.xml

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

        <deployment>

          <exclusions>

             <module name="org.hibernate"/>

             <module name="org.codehaus.jackson.jackson-core-asl"/>

             <module name="org.apache.log4j"/>

             <module name="org.apache.commons.logging"/>

          </exclusions>

      </deployment>

      </jboss-deployment-structure>

       

       

      The WEB-INF/lib has the appender jar file. And the WEB-INF/classes/log4j.properties has the following entries -

       

      log4j.rootLogger=ERROR, C, fileappender, myAppender

       

      log4j.appender.C=org.apache.log4j.ConsoleAppender

      log4j.appender.C.layout=org.apache.log4j.PatternLayout

      log4j.appender.C.layout.ConversionPattern=%d{DATE} [%t] %-5p %x %C{1} : %m%n

       

      log4j.appender.myAppender=com.mypckg.Log4jAppender

      log4j.appender.myAppender.deviceVendor=XX

      log4j.appender.myAppender.deviceProduct=XXX

      log4j.appender.myAppender.deviceVersion=XX

      log4j.appender.myAppender.transportType=SYSLOG

      log4j.appender.myAppender.hostName=x.x.x.x.x

      log4j.appender.myAppender.port=514

      log4j.appender.myAppender.layout=org.apache.log4j.PatternLayout

      log4j.appender.myAppender.layout.ConversionPattern=%d{DATE} [%t] %-5p %x %C{1} : %m%n

       

       

      log4j.appender.fileappender=org.apache.log4j.RollingFileAppender

      #log4j.appender.fileappender.File=${catalina.home}/logs/app.log

      log4j.appender.fileappender.File=${jboss.server.log.dir}/app.log

      log4j.appender.fileappender.MaxFileSize=500KB

      log4j.appender.fileappender.MaxBackupIndex=3

      log4j.appender.fileappender.layout=org.apache.log4j.PatternLayout

      log4j.appender.fileappender.layout.ConversionPattern=%d{DATE} [%t] %-5p %x %C{1} : %m%n

       

       

      And I had updated the logging.properties file in the $JBOSS_HOME/standalone/configuration dir as -

       

      logger.handlers=FILE,CONSOLE,MyApp

       

      # Console handler configuration

      handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler

      handler.CONSOLE.properties=autoFlush

      handler.CONSOLE.level=${jboss.boot.server.log.console.level:INFO}

      handler.CONSOLE.autoFlush=true

      handler.CONSOLE.formatter=PATTERN

       

      handler.MyApp=com.mypckg.Log4jAppender

      handler.MyApp.level=DEBUG

      handler.MyApp.properties=deviceVendor,deviceProduct,deviceVersion,transportType,hostName,port

      handler.MyApp.deviceVendor=XX

      handler.MyApp.deviceProduct=XXX

      handler.MyApp.deviceVersion=XX

      handler.MyApp.transportType=SYSLOG

      handler.MyApp.hostName=x.x.x.x.x

      handler.MyApp.port=514

      handler.MyApp.formatter=PATTERN

       

      I am trying to redirect the server.log and app.log to the custom appender.

       

      Am I missing any configuration? Please let me know.

       

      Thanks,

      Ashwini