This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes logging with log4j under JBoss4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "logging with log4j under JBoss4" Watch "logging with log4j under JBoss4" New topic
Author

logging with log4j under JBoss4

Andreas Groscurth
Greenhorn

Joined: Mar 08, 2004
Posts: 12
Hi,

i'd like to use log4j.xml to log a web application in a seperate file

According to JBOSS the following has to be added to the log4j.xml


which I did (with my .war file)

in the application i tried :

and printed out some error messages.

JBoss logs normal on the console and in the server.log. It also creates the app1.log file but without any content

What is wrong.. why does it log not in the file but anywhere else ?
THANKS
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9930
    
159

Did you add a new log4j.xml file in your war file or did you edit the log4j.xml file in the %JBOSS_HOME%/server/default/conf folder?


[My Blog] [JavaRanch Journal]
Andreas Groscurth
Greenhorn

Joined: Mar 08, 2004
Posts: 12
I edit the log4j.xml in the Jboss directory. I dont have any log4j file in my war
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9930
    
159

<filter class="org.jboss.logging.filter.TCLFilter">
<param name="AcceptOnMatch" value="true"/>
<param name="DeployURL" value="app1.ear"/>
</filter>


Any specific reason, you are adding this filter? Also is the DeployURL value correct?
Andreas Groscurth
Greenhorn

Joined: Mar 08, 2004
Posts: 12
the reason is... it was written so on the Jboss side.

the value is correct (in my case its jabba.war).

otherwise without the filter - how does jboss know only to logg when my application is used. Without the filter it logs everything ?!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9930
    
159

Originally posted by Andreas Groscurth:
otherwise without the filter - how does jboss know only to logg when my application is used. Without the filter it logs everything ?!


I do it this way:


Note that i have removed the App1Log appender reference from the root. Also i have introduced a category element which says that anything logged from org.myApp (which is the package hierarchy of your application) package (and its sub-packages) classes will be directed to the App1Log appender which points to the app1.log file
 
wood burning stoves
 
subject: logging with log4j under JBoss4
 
Similar Threads
Logging into different files based on parameters
log4j: Why aren't my debug statements showing?
JBoss and Log4j
Log4j Issue
Where are my log4j logs getting written to?