This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Jboss and Log4j" Watch "Jboss and Log4j" New topic
Author

Jboss and Log4j

Miguel Flecha
Ranch Hand

Joined: Jun 23, 2004
Posts: 85
Hi all.
I'm trying to use Log4j with Jboss.
I read that log4j.xml properties file must be in server/all/conf, so I put it there. Now I have a couple of questios:

- do I have to add a line like this (DOMConfigurator.configure("log4j.xml") in my program?

-where does it place the log file?

-is this log4j.xml file correct?:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="appender" class="org.apache.log4j.FileAppender">
<param name="File" value="salida.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
</layout>
</appender>

<root>
<priority value ="debug"/>
<appender-ref ref="appender"/>
</root>
</log4j:configuration>

Thanks in advance
Regards from Spain
Jeff Shelley
Ranch Hand

Joined: May 21, 2003
Posts: 70
whic version of jboss are you running? you shouldn't need to write any code for configuration.

the log file will go in server/${whichever-configuration-you-are-running}/log/

Also, the log4j.xml that my jboss came with (3.2.3/tomcat-4.1.24) was a good starting point for my logging. I've never used the all configuration, just the default, so my log4j.xml is in the
${jboss-folder}/server/default/conf/ directory.
if you never changed which configuration to run, that's where you'll find the log4j.xml. this is assuming you're running jboss 3.2.3.


It's almost Friday
Jeff Garrison
Greenhorn

Joined: Apr 09, 2004
Posts: 3
This should do it for you. . .I had the same problem a few mos. back.
I documented my results. Hope it helps.

http://www.garrisonpchelp.com/docs/log4jxml.html

Regards,

-Jeff Garrison
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jboss and Log4j