diff --git a/services/src/main/java/org/fao/geonet/api/site/LogUtils.java b/services/src/main/java/org/fao/geonet/api/site/LogUtils.java index 4c96a564e7..c7043a294e 100644 --- a/services/src/main/java/org/fao/geonet/api/site/LogUtils.java +++ b/services/src/main/java/org/fao/geonet/api/site/LogUtils.java @@ -75,9 +75,29 @@ public static void refreshLogConfiguration() { setting = settingOpt.get(); } + + String loggingConfigurationPath; + try { + loggingConfigurationPath = (String) ApplicationContextHolder.get().getBean("loggingConfigurationPath"); + CONFIG_LOG.info("Found loggingConfigurationPath='"+loggingConfigurationPath+"' in the bean configuration"); + } catch (BeansException e) { + loggingConfigurationPath = null; + } + // get log config from db settings String log4jProp = setting != null ? setting.getValue() : DEFAULT_LOG_FILE; - URL url = LogUtils.class.getResource("/" + log4jProp); + URL url ; + + if (loggingConfigurationPath != null) { + try { + url = Paths.get(loggingConfigurationPath, log4jProp).toUri().toURL(); + } catch (MalformedURLException e) { + url = LogUtils.class.getResource("/" + log4jProp); + } + } else { + url = LogUtils.class.getResource("/" + log4jProp); + } + try { if (url != null) { // refresh configuration