File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes How to configure a separate log file(Log4j) for a specific application in JBoss? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to configure a separate log file(Log4j) for a specific application in JBoss?" Watch "How to configure a separate log file(Log4j) for a specific application in JBoss?" New topic
Author

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

M K Rayapudi
Ranch Hand

Joined: Feb 19, 2007
Posts: 158
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


R6i
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40059
    
  28
Moved to JBoss forum at the poster's request.
kunu patil
Greenhorn

Joined: Sep 24, 2007
Posts: 20
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

Joined: May 14, 2008
Posts: 5845
    
    7

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


JBoss In Action
J.C. Bustamante
Greenhorn

Joined: Jul 20, 2009
Posts: 22
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

Joined: Feb 19, 2007
Posts: 158
kunu patil:
Peter Johnson:
J.C. Bustamante:
thank you one and all for the response,

I will go through the links suggested


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to configure a separate log file(Log4j) for a specific application in JBoss?