0 Replies Latest reply on Aug 22, 2013 4:26 PM by klind

    logback in JBoss 7.2.0

    klind Newbie

      Hi, I had logback working in 7.1.1, and now upgraded to 7.2.0, but I can't get logback to work.

       

      jboss-deployment-structure.xml

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
                <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
                <deployment>
                          <exclusions>
                                    <module name="org.apache.commons.logging" />
                                    <!-- Exclude slf4j-jboss-logmanager, we want to use logback that we added as a module -->
                                    <module name="org.slf4j.impl" />
                                    <module name="org.apache.log4j" />
                          </exclusions>
                          <dependencies>
                              <!-- add our own modules -->
                                    <module name="ch.qos.logback" />
                                    <module name="com.farheap.jsi" />
                          </dependencies>
                </deployment>
      
                <sub-deployment name="jsi-dashboard.war">
                          <exclusions>
                                    <module name="org.apache.commons.logging" />
                                    <module name="org.slf4j.impl" />
                                    <module name="org.apache.log4j" />
                          </exclusions>
                          <dependencies>
                                    <module name="ch.qos.logback" />
                                    <module name="com.farheap.jsi" />
                          </dependencies>
                </sub-deployment>
      </jboss-deployment-structure>
      

       

      logback.xml

       

      <configuration scan="true" scanPeriod="30 seconds" debug="true" >
                <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
                          <target>System.out</target>
                          <encoder>
                                    <pattern>[%p] %d [%c{1}] - %m%n</pattern>
                          </encoder>
                </appender>
      
                <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
                          <file>../standalone/log/jsi.log</file>
                          <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                                    <fileNamePattern>../standalone/log/jsi.roll.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
                                    <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                                              <maxFileSize>100MB</maxFileSize>
                                    </timeBasedFileNamingAndTriggeringPolicy>
                                    <maxHistory>30</maxHistory>
                          </rollingPolicy>
                          <append>true</append>
                          <encoder>
                                    <pattern>[%p] %d [%c] - %m%n</pattern>
                          </encoder>
                </appender>
         
      <logger name="com.farheap.jsi" level="DEBUG" />
      <logger name="org.springframework" level="ERROR" />
      <logger name="org.hibernate" level="ERROR" />
      <logger name="org.jboss" level="ERROR" />
      <logger name="org.apache.click" level="ERROR" />
      
      <root level="DEBUG">
                <appender-ref ref="CONSOLE"/>
                <appender-ref ref="FILE"/>
      </root>
      
      </configuration>
      

       

      From standalone.bat.

       

      Set LOGBACK_CONF_FILE=-Dlogback.configurationFile=%JBOSS_HOME%/modules/com/farheap/jsi/main/logback.xml
      
      :RESTART
      "%JAVA%" %JAVA_OPTS% ^
       "-Dorg.jboss.boot.log.file=%JBOSS_LOG_DIR%\server.log" ^
       "-Dlogging.configuration=file:%JBOSS_CONFIG_DIR%/logging.properties" ^
          -jar "%JBOSS_HOME%\jboss-modules.jar" ^
          -mp "%JBOSS_MODULEPATH%" ^
          -jaxpmodule "javax.xml.jaxp-provider" ^
           org.jboss.as.standalone ^
          -Djboss.home.dir="%JBOSS_HOME%" ^
          %LOGBACK_CONF_FILE% ^
          %SERVER_OPTS%
      
      

       

      Added new modules

       

      jboss-as-7.2.0.Final\modules\com\farheap\jsi\main
           - ..index
           - logback.xml
           - module.xml
      
      jboss-as-7.2.0.Final\modules\ch\qos\logback\main
           - logback-classic-1.0.9.jar
           - logback-classic-1.0.9.jar.index
           - logback-core-1.0.9.jar
           - logback-core-1.0.9.jar.index
           - module.xml
      

       

       

      But it looks like the logback.xml file is not pickedup.