[
https://issues.apache.org/jira/browse/LOG4J2-2033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ralph Goers resolved LOG4J2-2033.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.9.1
Fixed in master. Please verify and close.
> Regression in ProviderUtil.hasProviders for 2.9.0
> -------------------------------------------------
>
> Key: LOG4J2-2033
> URL: https://issues.apache.org/jira/browse/LOG4J2-2033
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.9.0
> Reporter: Andre Burgoyne
> Assignee: Ralph Goers
> Fix For: 2.9.1
>
>
> With release of 2.9.0, log4j no longer finds it configuration when running in
> an ant task.
> {code:java}
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.util.ProviderUtil;
> import org.apache.tools.ant.BuildException;
> import org.apache.tools.ant.Task;
> public class AntTest extends Task {
> private static void logTest() {
> System.out.println("ProviderUtil.hasProviders() = " +
> ProviderUtil.hasProviders());
> System.out.println("LogManager.getContext() = " +
> LogManager.getContext());
> LogManager.getLogger(AntTest.class).warn("test warn");
> }
> public void execute() throws BuildException {
> logTest();
> }
> }
> {code}
> This code when run with a log4j2.properties in the class path works fine with
> version 2.8.2, but when linked with 2.9.0 it fails:
> {noformat}
> # using log4j-core-2.8.2.jar and log4j-api-2.8.2.jar
> [AntTest8] ProviderUtil.hasProviders() = true
> [AntTest8] LogManager.getContext() =
> org.apache.logging.log4j.core.LoggerContext@2d3379b4
> [AntTest8] 2017-09-05 14:57:41,854 WARN main [AntTest] test warn
> # using log4j-core-2.9.0.jar and log4j-api-2.9.0.jar
> [AntTest9] ProviderUtil.hasProviders() = false
> [AntTest9] ERROR StatusLogger Log4j2 could not find a logging
> implementation. Please add log4j-core to the classpath. Using SimpleLogger to
> log to the console...
> [AntTest9] LogManager.getContext() =
> org.apache.logging.log4j.simple.SimpleLoggerContext@e4487af
> {noformat}
> This may be related to this bug?
> https://issues.apache.org/jira/browse/LOG4J2-862
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)