Two Laptop Bag*
The moose likes JBoss/WildFly and the fly likes JBoss and Log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBoss and Log4j" Watch "JBoss and Log4j" New topic
Author

JBoss and Log4j

Roby Kappa
Greenhorn

Joined: Oct 28, 2007
Posts: 19
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

Joined: Jul 20, 2005
Posts: 9963
    
163

"BobMessina"

Please check your private message for a message from JavaRanch.


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9963
    
163

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBoss and Log4j
 
Similar Threads
log4j.xml for app log.
Jboss final start up message not comes up in console
invalid console appender .....
How to monitor log file in jboss for sending mails,when error or excetion found in log
RollingFileAppender not happening