Commit 34f9b583 authored by Daniel Eggert's avatar Daniel Eggert
Browse files

added username to logfile name to resolve possible permission problems

parent 2c7f4738
......@@ -16,6 +16,7 @@ import org.slf4j.impl.SimpleLogger;
*/
public class GmsProperties {
private static final String SYS_USERNAME_PROP_KEY = "user.name";
private static final String LOG_LEVEL_KEY = "module.log.level";
private static final String SIMPLE_LOG_PACKAGE_LEVEL_KEY = "org.slf4j.simpleLogger.log." + "de.potsdam.gfz.gms";
private static final String DEFAULT_MODULE_LOG_LEVEL = "info";
......@@ -66,9 +67,13 @@ public class GmsProperties {
* @param cls
*/
public static void setDefaultLoggerProperties(String loggerName, Properties props) {
// set log format
System.setProperty(SimpleLogger.SHOW_DATE_TIME_KEY, "true");
System.setProperty(SimpleLogger.DATE_TIME_FORMAT_KEY, "yyyy.MM.dd HH:mm:ss");
System.setProperty(SimpleLogger.LOG_FILE_KEY, loggerName + ".log");
// set log filename and append current username
String username = System.getProperty(SYS_USERNAME_PROP_KEY);
System.setProperty(SimpleLogger.LOG_FILE_KEY, loggerName + "-" + username + ".log");
// set default log level (for all 3rd party classes) to warning
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "warn");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment