2 Replies Latest reply on Apr 20, 2008 10:30 AM by jaikiran

    Jboss and log4j

    roberto.k

      I'm trying to log my webapp with JBoss

      For a misterious reason, JBoss logging must be declared in jboss-log4j.xml (I don't understand why I can't use log4j.xml in my war, like any other AS in the world...)

      Then, I removed log4j.xml form my ear/war and I moved appenders in jboss-log4j.xml. And... There is a problem... ONLY for my classes, a question mark appears in place of line number:

      [14:04:46,226 INFO] it.web.controller.security.Login.execute(?) - Inizio
      Login

      This is the configuration:

      ....














      .....







      <appender-ref ref="CONSOLE" />

      <appender-ref ref="MY_APPENDER" />









      <appender-ref ref="CONSOLE"/>

      <appender-ref ref="FILE"/>



      Any idea?
      Thanks

        • 1. Re: Jboss and log4j
          roberto.k

          sorry... problem with the code

          ....
          <appender name="MY_APPENDER"
          class="org.jboss.logging.appender.DailyRollingFileAppender">
          
          <param name="File" value="${jboss.server.log.dir}/myloglog"/>
          
          <layout class="org.apache.log4j.PatternLayout">
          
          <param name="ConversionPattern" value="[%d{HH:mm:ss} %p] %c.%M(%L) - %m%n"
          />
          
          </layout>
          
          </appender>
          
          
          
          .....
          
          
          
          <category name="it.web" additivity="false">
          
          <priority value="debug" />
          
          <appender-ref ref="CONSOLE" />
          
          <appender-ref ref="MY_APPENDER" />
          
          </category>
          
          
          
          <root>
          
          <priority value="warn" />
          
          <appender-ref ref="CONSOLE"/>
          
          <appender-ref ref="FILE"/>
          
          </root>
          


          • 2. Re: Jboss and log4j
            jaikiran

             

            "roberto.k" wrote:


            For a misterious reason, JBoss logging must be declared in jboss-log4j.xml (I don't understand why I can't use log4j.xml in my war, like any other AS in the world...)


            Since you mention jboss-log4j.xml, i believe you are using JBoss-4.2.x. In which case, you can definitely use your own log4j.xml in the WAR.

            "roberto.k" wrote:

            Then, I removed log4j.xml form my ear/war and I moved appenders in jboss-log4j.xml. And... There is a problem... ONLY for my classes, a question mark appears in place of line number:

            [14:04:46,226 INFO] it.web.controller.security.Login.execute(?) - Inizio
            Login


            I don't know how the %L option of log4j works. But i guess, for the line number of a java class to be outputted, you have to compile the class using the -g option. Have you tried that?