}
PatternLayout layout = new PatternLayout(pattern);
layout.activateOptions();
RollingFileAppender newAppender = null;
try {
newAppender = new RollingFileAppender(layout, logFile, true);
} catch (IOException e) {
logFatal(e, Debug.class.getName());
}
if (newAppender != null) {
if (backupIdx > 0) {
newAppender.setMaxBackupIndex(backupIdx);
}
if (maxSize > 0) {
newAppender.setMaximumFileSize(maxSize);
}
newAppender.setThreshold(Level.DEBUG);
newAppender.activateOptions();
newAppender.setName(name);
}
return newAppender;
}