2 Replies Latest reply on Mar 23, 2013 3:00 PM by Sueleyman Vurucu

    Use Log4j appender as custom-handler in AS 7.1.1.Final

    Sueleyman Vurucu Expert

      H guys,

       

      I'm trying to configure a custom log4j appender in jboss logging subsystem. For that I configurae my appender as shown below;

       

      
      <log4j-appender name="WMSAppender" class="com.siemag.components.logging.DailyRollingFileAppenderExtended">
                      <properties>
                          <property name="File"> ${jboss.server.log.dir}/wms/WMSApplication.log </property>
                          <property name="Append">true</property>
                          <property name="DatePattern">.'yyyy-MM-dd</property>
                          <property name="pattern">"%d %-5p [%c] %m%n</property>
                      </properties>
                      <error-manager>
                          <only-once />
                      </error-manager>
                  </log4j-appender>
      

       

      But I get the exception shown below:

       

       

      13:06:28,679 ERROR [org.jboss.as.server] JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration
          at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.server.ServerService.boot(ServerService.java:266) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:155) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
      Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[85,4]
      Message: Unexpected element '{urn:jboss:domain:logging:1.1}log4j-appender'
          at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:108) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
          at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
          at org.jboss.as.logging.LoggingSubsystemParser.readElement(LoggingSubsystemParser.java:185)
          at org.jboss.as.logging.LoggingSubsystemParser.readElement(LoggingSubsystemParser.java:113)
          at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
          at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
          at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:894) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_1(StandaloneXml.java:330) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:127) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:100) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
          at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
          at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:133) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
          ... 3 more