• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 80653
476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to JBoss forum at the poster's request.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic