in src/main/java/org/apache/log4j/rolling/RollingFileAppender.java [120:191]
public void activateOptions() {
if (rollingPolicy == null) {
LogLog.warn(
"Please set a rolling policy for the RollingFileAppender named '"
+ getName() + "'");
return;
}
//
// if no explicit triggering policy and rolling policy is both.
//
if (
(triggeringPolicy == null) && rollingPolicy instanceof TriggeringPolicy) {
triggeringPolicy = (TriggeringPolicy) rollingPolicy;
}
if (triggeringPolicy == null) {
LogLog.warn(
"Please set a TriggeringPolicy for the RollingFileAppender named '"
+ getName() + "'");
return;
}
Exception exception = null;
synchronized (this) {
triggeringPolicy.activateOptions();
rollingPolicy.activateOptions();
try {
RolloverDescription rollover =
rollingPolicy.initialize(getFile(), getAppend());
if (rollover != null) {
Action syncAction = rollover.getSynchronous();
if (syncAction != null) {
syncAction.execute();
}
setFile(rollover.getActiveFileName());
setAppend(rollover.getAppend());
lastRolloverAsyncAction = rollover.getAsynchronous();
if (lastRolloverAsyncAction != null) {
Thread runner = new Thread(lastRolloverAsyncAction);
runner.start();
}
}
File activeFile = new File(getFile());
if (getAppend()) {
fileLength = activeFile.length();
} else {
fileLength = 0;
}
super.activateOptions();
} catch (Exception ex) {
exception = ex;
}
}
if (exception != null) {
LogLog.warn(
"Exception while initializing RollingFileAppender named '" + getName()
+ "'", exception);
}
}