Are you trying to, for instance, log only your code to the new log file? If so, you need to also add something like this:
<category name="my.package.name"> <priority value="DEBUG"/> <appender-ref ref="App1Log" /> </category>
And remove the < appender-ref ref="App1Log" > from within < root >
If you are attempting to prevent *any* logging to the console. remove the < appender-ref ref="CONSOLE" > line.
thanks for your answer peter.
the problem is that different web applications deployed on the jboss share same classes/libraries.
So if App1 and App2 both uses Library1, how to define in categorys that Library1 once has to log into App1Log file and another time in App2Log file.
Therefore the category system does not work for me :(
And actually I dont intend to remove ALL logs in the console - jboss system logs shall occur of course, but non of the web application logs....
is this then possible at all?
You are asking for log4j to somehow know when to log a message from a particular class to one log file in one circumstance and under another circumstance to log it to another log file. Sorry, but log4j just will not do that.
You can use a thread local, e.g. MDC and filter on that, assuming the library is going to be run from the same application's threads. Search for "MDC filter" in google.