I have a problem that I have spent hours trying to find and answer for online, with no success.
To start with, here is my log4j.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- Rollover at midnight each day -->
<!-- The default pattern: Date Priority [Category] Message\n -->
<!-- A time/date based rolling appender for BPM Custom Agents -->
<!-- Rollover at midnight each day -->
<!-- The default pattern: Date Priority [Category] Message\n -->
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
There are 2 important appenders here, one is FILE, which gets all messages, regardless of source. The other is CUSTOM_AGENTS, which is only supposed to get messages from my custom java code, used in custom agents.
Using the classic foo package, assume this code:
public class CustomAgent {
public static void Main(String args) {
private static Logger log = Logger.getLogge(CustomAgent .class);
log.info("My custom agent code")
}
}
This will then print:
INFO[com.foo] My custom agent code
Into both files for the FILE and CUSTOM_AGENTS appenders. This good, this is what I'm after.
The problem is, I only want these com.foo messages in the CUSTOM_AGENTS log, yet I get ALL messages, from all packages, such as org.jboss.cache.TreeCache, org.hibernate.cfg.AnnotationBinder, etc, which defeats the purpose of this additional log.
I cannot for the life of me work out how to prevent them from going in though, and I would be really appreciative if anyone can point out the error of my ways.
Many thanks all