J
John Smith
I want to create a new logger instance that will simultaniusly log to
another file. I was able to do that programatically.
So when I instantiate the logger like this:
----------------------------------------------------
Logger logger = Logger.getLogger("AnotherLogger");
----------------------------------------------------
it writes to a separate log file "AnotherLogFile.txt".
I do not like the idea to hard-code the appender instantiation.
---------------------------------------------------
Layout layout = new PatternLayout("%d %-5p %m%n");
RollingFileAppender rfa = new RollingFileAppender(layout,
"AnotherLogFile.txt");
rfa.setMaxFileSize(10MB);
rfa.setMaxBackupIndex(8);
Logger.getLogger("AnotherLogger").setAdditivity(false);
Logger.getLogger("AnotherLogger").addAppender(rfa);
another file. I was able to do that programatically.
So when I instantiate the logger like this:
----------------------------------------------------
Logger logger = Logger.getLogger("AnotherLogger");
----------------------------------------------------
it writes to a separate log file "AnotherLogFile.txt".
I do not like the idea to hard-code the appender instantiation.
---------------------------------------------------
Layout layout = new PatternLayout("%d %-5p %m%n");
RollingFileAppender rfa = new RollingFileAppender(layout,
"AnotherLogFile.txt");
rfa.setMaxFileSize(10MB);
rfa.setMaxBackupIndex(8);
Logger.getLogger("AnotherLogger").setAdditivity(false);
Logger.getLogger("AnotherLogger").addAppender(rfa);