Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

logging with log4j under JBoss4

 
Greenhorn
Posts: 12
  • 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
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • 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
  • 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
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • 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
  • 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
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • 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
 
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!