in plugins/org.apache.karaf.eik.app/src/main/java/org/apache/karaf/main/BootstrapLogManager.java [45:90]
public static synchronized Handler getDefaultHandler () {
if (handler != null) {
return handler;
}
String filename;
File log;
Properties props = new Properties();
filename = configProps.getProperty(KARAF_BOOTSTRAP_LOG);
if (filename != null) {
log = new File(filename);
} else {
// Make a best effort to log to the default file appender configured for log4j
FileInputStream fis = null;
try {
fis = new FileInputStream(System.getProperty("karaf.base") + "../etc/org.ops4j.pax.logging.cfg");
props.load(fis);
} catch (IOException e) {
props.setProperty("log4j.appender.out.file", "${karaf.data}/log/karaf.log");
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
if (props.getProperty("log4j.appender.out.file") == null) {
// manage if the log4j.appender.out.file property is not present in
// the etc/org.ops4j.pax.logging.cfg file
props.setProperty("log4j.appender.out.file", "${karaf.data}/log/karaf.log");
}
filename = PropertyUtils.substVars(props.getProperty("log4j.appender.out.file"),"log4j.appender.out.file", null, null);
log = new File(filename);
}
try {
handler = new BootstrapLogManager.SimpleFileHandler(log);
} catch (IOException e) {
e.printStackTrace();
}
return handler;
}