Disable LogbackLoggingSystem's XML support when spring.xml.ignore=true

Closes gh-22106
pull/22113/head
Andy Wilkinson 4 years ago
parent 2dd4a9cb5e
commit d12b6b3a86

@ -49,6 +49,7 @@ import org.springframework.boot.logging.LoggingInitializationContext;
import org.springframework.boot.logging.LoggingSystem;
import org.springframework.boot.logging.LoggingSystemProperties;
import org.springframework.boot.logging.Slf4JLoggingSystem;
import org.springframework.core.SpringProperties;
import org.springframework.core.env.Environment;
import org.springframework.util.Assert;
import org.springframework.util.ResourceUtils;
@ -65,6 +66,9 @@ import org.springframework.util.StringUtils;
*/
public class LogbackLoggingSystem extends Slf4JLoggingSystem {
// Static final field to facilitate code removal by Graal
private static final boolean XML_ENABLED = !SpringProperties.getFlag("spring.xml.ignore");
private static final String CONFIGURATION_FILE_PROPERTY = "logback.configurationFile";
private static final LogLevels<Level> LEVELS = new LogLevels<>();
@ -172,7 +176,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
private void configureByResourceUrl(LoggingInitializationContext initializationContext, LoggerContext loggerContext,
URL url) throws JoranException {
if (url.toString().endsWith("xml")) {
if (XML_ENABLED && url.toString().endsWith("xml")) {
JoranConfigurator configurator = new SpringBootJoranConfigurator(initializationContext);
configurator.setContext(loggerContext);
configurator.doConfigure(url);

Loading…
Cancel
Save