Commit 7b9f0c43 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '516-log4j-configuration-should-be-exposed-to-the-user' into 'master'

Resolve "log4j configuration should be exposed to the user"

Closes #516

See merge request !424
parents 789b9044 e48bb59e
Pipeline #6614 failed with stage
in 14 minutes and 57 seconds
......@@ -337,7 +337,7 @@ public class PermanentDatabaseLevelCacheTest extends AnnotationTestFunctions {
cache.invalidateByQuery(query, invalidType);
while (cache.getRefreshExecutingTasksSize() + cache.getRefreshPendingQueueSize() > 0) {
while (cache.databaseCacheIsBusy()) {
Thread.sleep(10);
}
assertEquals(1, getFatals().size());
......
package lcsb.mapviewer.bean.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
......@@ -10,6 +14,7 @@ import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.common.IProgressUpdater;
......@@ -69,6 +74,7 @@ public class StartupBean {
*/
@PostConstruct
public void init() {
loadCustomLog4jProperties();
logger.debug("Application startup script starts");
ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext()
.getContext();
......@@ -81,6 +87,24 @@ public class StartupBean {
logger.debug("Application startup script ends");
}
private void loadCustomLog4jProperties() {
String filename = "/etc/minerva/log4j.properties";
File file = new File(filename);
if (file.exists()) {
try {
Properties props = new Properties();
InputStream configStream = new FileInputStream(file);
props.load(configStream);
configStream.close();
PropertyConfigurator.configure(props);
logger.info("log4j configuration loaded from: " + filename);
} catch (Exception e) {
logger.error("Problem with loading log4j configuration: " + filename);
}
}
}
private void setSessionLength() {
try {
String sessionLength = configurationService.getConfigurationValue(ConfigurationElementType.SESSION_LENGTH);
......
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