I’ve got the following problem – This is my log4j config file:
log4j.rootLogger=info, stdout, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=logs/example.log
log4j.category.A3=, A3
log4j.appender.A3=org.apache.log4j.RollingFileAppender
log4j.appender.A3.File=logs/A3.log
And this is my java code:
final static private Logger loggerA3 = Logger.getLogger("A3");
loggerA3.info("abcd");
Now, the abcd string appears in both example.log and A3.log, but I only want it to appear in A3.log, what should I do?
Please add the following line in log4j config file
This will ensure that log is not appended to root logger