Re: Log to different log files
Thursday, December 4, 2003 03:23 AM
i think you want to log your data into two different destinations based on the condition.
This you can do it by defining morethan one logger in your log4j related property file and use the respective logger for logging the data in respective scenarios.
say like u have defined two loggers log1, log2 in the property file.
define the output file name for log1 as c:/log1.log
and the output file name for log2 as c:/log2.log.
in the java class
protected final static Logger log1 = Logger.getLogger("log1");
protected final static Logger log2 = Logger.getLogger("log2");
when u use log1 object , logs will be written to log1.log file and if u use log2 object ,logs will be flushed to log2.log file.