in taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineTool.java [132:167]
private void initialiseLogging() {
LogManager.resetConfiguration();
if (System.getProperty("log4j.configuration") == null) {
try {
PropertyConfigurator.configure(CommandLineTool.class.getClassLoader()
.getResource("cl-log4j.properties").toURI().toURL());
} catch (MalformedURLException e) {
logger.error("There was a serious error reading the default logging configuration",
e);
} catch (URISyntaxException e) {
logger.error("There was a serious error reading the default logging configuration",
e);
}
} else {
PropertyConfigurator.configure(System.getProperty("log4j.configuration"));
}
if (commandLineOptions.hasLogFile()) {
RollingFileAppender appender;
try {
PatternLayout layout = new PatternLayout("%-5p %d{ISO8601} (%c:%L) - %m%n");
appender = new RollingFileAppender(layout, commandLineOptions.getLogFile());
appender.setMaxFileSize("1MB");
appender.setEncoding("UTF-8");
appender.setMaxBackupIndex(4);
// Let root logger decide level
appender.setThreshold(Level.ALL);
LogManager.getRootLogger().addAppender(appender);
} catch (IOException e) {
System.err.println("Could not log to " + commandLineOptions.getLogFile());
}
}
}