logger.finer("Did not found logging configuratin file: " + file);
}
}
// Find in classpath
FileUtil fileUtil = new FileUtil();
String fileInClasspath = "/xplanetconfigurator/util/logging/" + LoggingInitializer.FILE_NAME;
String fileContent = null;
logger.finer("Try to read logging configuration from file: '" + fileInClasspath + "'...");
try {
fileContent = fileUtil.getRessourceAsString(fileInClasspath);
} catch(Exception e) {
logger.warning("Could not read file from classpath. File: '" + fileInClasspath + "'");
}
String userHome = System.getProperty("user.home");
String defaultConfigFileLocation = userHome + File.separator + LoggingInitializer.FILE_NAME;
if(fileContent != null)
{
logger.finer("Reading file content to file: '" + defaultConfigFileLocation + "'...");
try {
fileUtil.printFile(defaultConfigFileLocation, fileContent);
return defaultConfigFileLocation;
} catch(Exception e) {
logger.warning("Failed to write file: '" + defaultConfigFileLocation + "'");
}
}
// Try to read from java.home/jre/lib
String javaHome = System.getProperty("java.home");
String fileInJavaHome =
javaHome + File.separator + "jre" + File.separator + "lib" + LoggingInitializer.FILE_NAME;
try {
fileContent = fileUtil.getFileAsString(new File(fileInJavaHome));
} catch(Exception e) {
logger.warning("Could not read file from classpath. File: '" + fileInClasspath + "'");
}
if(fileContent != null)
{
logger.finer("Reading file content to file: '" + defaultConfigFileLocation + "'...");
try {
fileUtil.printFile(defaultConfigFileLocation, fileContent);
return defaultConfigFileLocation;
} catch(Exception e) {
logger.warning("Failed to write file: '" + defaultConfigFileLocation + "'");
}
}