Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JBoss and Log4j

 
Roby Kappa
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 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>

Any idea?
Thanks
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"BobMessina"

Please check your private message for a message from JavaRanch.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by BobMessina:
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...)

You can use your own log4j.xml in the war file.

Originally posted by BobMessina:
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 haven't personally tried the %L option in log4j. But i guess, for the line number of the java code to be outputted, the classes should be compiled with -g option. Have you done that?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic