akashchamp commented on code in PR #4321:
URL: https://github.com/apache/logging-log4j2/pull/4321#discussion_r4083667737
##########
log4j-api-test/src/test/java/org/apache/logging/log4j/util/ProviderUtilTest.java:
##########
@@ -56,13 +57,16 @@ void setup() {
}
@Test
- void should_have_a_fallback_provider() {
+ void
should_log_diagnostic_and_use_simple_provider_when_no_provider_is_available() {
final PropertiesUtil properties = new PropertiesUtil(new Properties());
assertThat(ProviderUtil.selectProvider(properties, NO_PROVIDERS,
statusLogger))
.as("check selected provider")
- .isNotNull();
- // An error for the absence of providers
- assertHasErrorOrWarning(statusLogger);
+ .isInstanceOf(SimpleProvider.class);
+ assertThat(statusLogger.getEntries())
+ .contains(" ERROR Log4j API could not find a logging
provider.\n"
+ + "Log4j API will use Simple Logger by default.\n"
+ + "See
https://logging.apache.org/log4j/2.x/manual/installation.html "
Review Comment:
Done, thanks.
##########
log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java:
##########
@@ -245,7 +245,10 @@ static Provider selectProvider(
final Comparator<Provider> comparator =
Comparator.comparing(Provider::getPriority);
switch (providers.size()) {
case 0:
- statusLogger.error("Log4j API could not find a logging
provider.");
+ statusLogger.error("Log4j API could not find a logging
provider.\n"
+ + "Log4j API will use Simple Logger by default.\n"
+ + "See
https://logging.apache.org/log4j/2.x/manual/installation.html "
Review Comment:
Done, thanks.
##########
src/site/antora/modules/ROOT/pages/manual/installation.adoc:
##########
@@ -186,6 +186,8 @@ xref:manual/status-logger.adoc[Status Logger] to avoid its
unintentional usages:
----
2024-10-03T11:53:34.281462230Z main ERROR Log4j API could not find a logging
provider.
+Log4j API will use Simple Logger by default.
+See https://logging.apache.org/log4j/2.x/manual/installation.html for
instructions on how to configure Log4j API.
Review Comment:
Done, thanks.
##########
src/changelog/.2.x.x/3415_improve_missing_provider_diagnostic.xml:
##########
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns="https://logging.apache.org/xml/ns"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ https://logging.apache.org/xml/ns
+ https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
+ type="changed">
+ <issue id="3415"
link="https://github.com/apache/logging-log4j2/issues/3415"/>
Review Comment:
Done, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]