in src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java [1047:1099]
public void start() {
logger.info("activateOptions");
active = true;
Runnable runnable = new Runnable() {
public void run() {
initialize();
while (reader == null) {
logger.info("attempting to load file: " + getFileURL());
try {
reader = new InputStreamReader(new URL(getFileURL()).openStream(), "UTF-8");
} catch (FileNotFoundException fnfe) {
logger.info("file not available - will try again");
synchronized (this) {
try {
wait(MISSING_FILE_RETRY_MILLIS);
} catch (InterruptedException ie) {
}
}
} catch (IOException ioe) {
logger.warn("unable to load file", ioe);
return;
}
}
try {
BufferedReader bufferedReader = new BufferedReader(reader);
createPattern();
do {
process(bufferedReader);
try {
synchronized (this) {
wait(waitMillis);
}
} catch (InterruptedException ie) {
}
if (tailing) {
logger.debug("tailing file");
}
} while (tailing);
} catch (IOException ioe) {
//io exception - probably shut down
logger.info("stream closed");
}
logger.debug("processing " + path + " complete");
shutdown();
}
};
if (useCurrentThread) {
runnable.run();
} else {
new Thread(runnable, "LogFilePatternReceiver-" + getName()).start();
}
}