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
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.
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.