[prev in list] [next in list] [prev in thread] [next in thread]
List: log4j-user
Subject: Logger question
From: "Satrasala, Sudhakar" <Sudhakar_Satrasala () adp ! com>
Date: 2003-07-23 21:54:45
[Download RAW message or body]
Hi,
I have 3 loggers in my application. Each logger has it's own FileAppender.
Can I log specific messages to the attached appenders, without setting a
level/priority.
The code looks like this:
Logger log = Logger.getLogger("LogAppTest");
Logger log1 = Logger.getLogger("LogAppTest1");
Logger log2 = Logger.getLogger("LogAppTest2");
FileAppender append = new FileAppender(new
SimpleLayout(),"C:/Logs/output.txt",false);
FileAppender append1 = new FileAppender(new
SimpleLayout(),"C:/Logs/output1.txt",false);
FileAppender append2 = new FileAppender(new
SimpleLayout(),"C:/Logs/output2.txt",false);
log.addAppender(append);
log1.addAppender(append1);
log2.addAppender(append2);
log.setAdditivity(false);
log1.setAdditivity(false);
log2.setAdditivity(false);
log.info("Hello World Info");
log.warn("Warning occurred");
log1.info("Hello World Info 2");
log2.info("Hello World Info 3");
When I run the code, all the log messages show up in all the files. But the
first file should have only 2 messages, the 2nd file should have only 1
message and the 3rd file should have only 1 message. Is it possible to
achieve this result without using the filter/level options?
Sudhakar
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic