File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logging with log4j under JBoss4

 
Andreas Groscurth
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Andreas Groscurth
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I edit the log4j.xml in the Jboss directory. I dont have any log4j file in my war
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic