Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions server/embedded/src/org/labkey/embedded/LabKeyServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -92,6 +93,32 @@ public static void main(String[] args)

application.setDefaultProperties(new HashMap<>()
{{
// GitHub Issue 796: JSON logging stopped after Tomcat/Spring update
// Propagate log4j configuration to Spring Boot config, which is necessary with Spring Boot 4.x
String log4JConfig = System.getProperty("log4j.configurationFile");
if (log4JConfig != null)
{
String[] log4JConfigParts = log4JConfig.split(",");
if (log4JConfigParts.length > 0)
{
if ("log4j2.xml".equals(log4JConfigParts[0]))
{
// Assume this is the one packaged with our embedded build and on the classpath
put("logging.config", "classpath:log4j2.xml");
}
else
{
put("logging.config", log4JConfigParts[0]);
}
if (log4JConfigParts.length > 1)
{
put("logging.log4j2.config.override", String.join(",", Arrays.asList(log4JConfigParts).subList(1, log4JConfigParts.length)));
}
else
throw new IllegalArgumentException("log4j.configurationFile must be in the form log4j2.xml[,secondaryFile]");
}
}

put("server.tomcat.basedir", ".");
put("server.tomcat.accesslog.directory", logHome);

Expand Down