Skip to content

Commit

Permalink
Merge pull request #277 from landryb/fix/272
Browse files Browse the repository at this point in the history
logging configuration file should be taken from georchestra datadir
  • Loading branch information
f-necas committed Jan 25, 2024
1 parent 14453f1 commit a1dbcee
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 @@ -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
Expand Down

0 comments on commit a1dbcee

Please sign in to comment.