• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JBoss and Log4j

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"BobMessina"

Please check your private message for a message from JavaRanch.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic