• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to configure a separate log file(Log4j) for a specific application in JBoss?

 
M K Rayapudi
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to configure a separate log file(Log4j) for a specific application in JBoss?

I have modified jboss-service.xml as follows:

I have created a file D:\Servers\jboss-4.0.5.GA\server\default\conf\routing_log4j.xml

What I am expecting is only log specific to my application will be written to my log file , but a lot of log is getting generated in my log file (routing.txt)
Where I am doing mistake, Please help in this regard
Thank you
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to JBoss forum at the poster's request.
 
kunu patil
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You will have to put log4j.jar file in your application's WAR file. Make sure that the version of log4j.jar is same as that of log4.jar available on JBoss server's lib directory. This is required, as JBoss uses log4j itself to generate it's own logs.

In fact, every Web Application requires a log4j.jar file in it's WAR so that application specific logs can be generated in separate log files.

Hope it works.

Regards
Kunal
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, in 4.0.x you do not want to place the log4j.jar file in your WARs lib directory, it will lead to conflicts.

Here is a post from Jaikiran on how to accomplish application-level logging in 4.2.2, not sure how well it would work in 4.0.5: http://community.jboss.org/message/198691#198690
 
J.C. Bustamante
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi M. K.,

I found that the following link was very useful in helping isolate a different log file for my web application. Basically, you would have to add your own log4J configuration (xml or properties) file in your web application, and then code a Custom RepositorySelector which would retrieve the log4J configuration from your web application, and route the logging to your own file defined in the appender that you have configured. The log file should only have logs that are specific to your web application. Please see the link below.

http://community.jboss.org/wiki/log4jrepositoryselector

Hope this helps,

Juan
 
M K Rayapudi
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kunu patil:
Peter Johnson:
J.C. Bustamante:
thank you one and all for the response,

I will go through the links suggested


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic