Skip to content

Commit

Permalink
Re-enable log4j2 JMX support
Browse files Browse the repository at this point in the history
  • Loading branch information
dizzzz committed Sep 30, 2024
1 parent 149fcd1 commit 7b3770f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions exist-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@
<user.timezone>Europe/Berlin</user.timezone>
<java.locale.providers>JRE,CLDR,SPI</java.locale.providers>
<log4j.configurationFile>${project.build.testOutputDirectory}/log4j2.xml</log4j.configurationFile>
<log4j2.disableJmx>false</log4j2.disableJmx>
</systemPropertyVariables>
</configuration>
</plugin>
Expand Down
5 changes: 4 additions & 1 deletion exist-start/src/main/java/org/exist/start/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
public class Main {
public static final String STANDARD_ENABLED_JETTY_CONFIGS = "standard.enabled-jetty-configs";
public static final String STANDALONE_ENABLED_JETTY_CONFIGS = "standalone.enabled-jetty-configs";
public static final String PROP_LOG4J_DISABLEJMX = "log4j2.disableJmx";

private static final int ERROR_CODE_GENERAL = 1;
private static final int ERROR_CODE_NO_JETTY_CONFIG = 7;
Expand Down Expand Up @@ -261,7 +262,6 @@ public void runEx(String[] args) throws StartException {
}

if (log4jConfigurationFile.isPresent() && Files.isReadable(log4jConfigurationFile.get())) {
// System.setProperty(PROP_LOG4J_CONFIGURATION_FILE, log4jConfigurationFile.get().toUri().toASCIIString());
System.setProperty(PROP_LOG4J_CONFIGURATION_FILE, log4jConfigurationFile.get().toAbsolutePath().toString());
}
}
Expand All @@ -271,6 +271,9 @@ public void runEx(String[] args) throws StartException {
System.setProperty(PROP_JUL_MANAGER, Optional.ofNullable(System.getProperty(PROP_JUL_MANAGER)).orElse("org.apache.logging.log4j.jul.LogManager"));
}

// Enable JXM support log4j since v2.24.0 [2024]
System.setProperty(PROP_LOG4J_DISABLEJMX, "false");

// clean up tempdir for Jetty...
try {
final Path tmpdir = Paths.get(System.getProperty(PROP_JAVA_TEMP_DIR)).toAbsolutePath();
Expand Down

0 comments on commit 7b3770f

Please sign in to comment.