if (null == logLevel) logLevel = "DEBUG";
Priority priority = Priority.getPriorityForName(logLevel);
appLogger.setPriority(priority);
final PatternFormatter appformatter = new PatternFormatter(prop
.getProperty("logs.pattern.application"));
LogTarget[] appLoggerTargets = new LogTarget[writeToFile ? 2 : 1];
appLoggerTargets[0] = new WriterTarget(new PrintWriter(System.out),
appformatter);
if (writeToFile) {
// open file target in append mode
final File appfile = new File(prop.getProperty("logs.dir")
+ File.separator + IConst.LOG.APPLICATION_LOG_NAME);
appLoggerTargets[1] = new RotatingFileTarget(true,
appformatter, new RotateStrategyByDate(),
new UniqueFileStrategy(appfile, ".yyyy-MM-dd", ".log"));
}
//Set log targets of logger
appLogger.setLogTargets(appLoggerTargets);
//*************************** create and configure audit logger
auditLogger = Hierarchy.getDefaultHierarchy().getLoggerFor(
IConst.LOG.AUDIT_LOG_NAME);
auditLogger.setPriority(Priority.INFO);
final PatternFormatter auditformatter = new PatternFormatter(prop
.getProperty("logs.pattern.audit"));
LogTarget[] auditLoggerTargets = new LogTarget[writeToFile ? 2 : 1];
// create JDBC target
InitialContext ic = new InitialContext();