I want to set up log4j so that all log meessages produced from classes under package com.foo.bar go to bar.log, and all the log meessages produced from classes under package com.bar.blatz go to blatz.log.
Questions
- How do I do this using log4j.xml?
- I know its possible using property files, but how do I do it using the XML configuration?
We can add appenders here. It will work if the application is using root logger. for example quartz Scheduler API.
This is based on my answer to a similar question:
If you add an appender-ref to the root element, it will also receive com.foo.bar etc messages. You can stop that by specifying 'additivity="false"' on the loggers.