Skip to content

Commit

Permalink
logging configuration file should be taken from georchestra datadir
Browse files Browse the repository at this point in the history
fixes #272

reinstated from 1ec55be, has been lost in fa284b7
  • Loading branch information
landryb committed Jan 15, 2024
1 parent 0524cfc commit 2193cf8
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion services/src/main/java/org/fao/geonet/api/site/LogUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,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
Expand Down

0 comments on commit 2193cf8

Please sign in to comment.