You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
+65-59Lines changed: 65 additions & 59 deletions
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,8 @@
48
48
* {@link StatusLogger} is expected to be a standalone, self-sufficient component that the logging system can rely on for low-level logging purposes.
49
49
* <h3>Listeners</h3>
50
50
* <p>
51
-
* Each recorded event will first get buffered and used to notify the registered {@link StatusListener}s.
52
-
* Listener registry is always initialized with a <em>default listener</em>, which is a {@link StatusConsoleListener}.
51
+
* Each recorded event will first get buffered and then used to notify the registered {@link StatusListener}s.
52
+
* If none are available, the <em>fallback listener</em> of type {@link StatusConsoleListener} will be used.
53
53
* </p>
54
54
* <p>
55
55
* You can programmatically register listeners using {@link #registerListener(StatusListener)} method.
@@ -68,8 +68,8 @@
68
68
* Consider the following example:
69
69
* </p>
70
70
* <ol>
71
-
* <li>The default level is {@code ERROR}</li>
72
-
* <li>You have <Configuration status="WARN">} in your {@code log4j2.xml}</li>
71
+
* <li>The default level (of fallback listener) is {@code ERROR}</li>
72
+
* <li>You have {@code <Configuration status="WARN">} in your {@code log4j2.xml}</li>
73
73
* <li>Until your {@code log4j2.xml} configuration is read, the effective level will be {@code ERROR}</li>
74
74
* <li>Once your {@code log4j2.xml} configuration is read, the effective level will be {@code WARN} as you configured</li>
75
75
* </ol>
@@ -83,6 +83,7 @@
83
83
* <h3>Debug mode</h3>
84
84
* <p>
85
85
* When the {@value Constants#LOG4J2_DEBUG} system property is present, any level-related filtering will be skipped and all events will be notified to listeners.
86
+
* If no listeners are available, the <em>fallback listener</em> of type {@link StatusConsoleListener} will be used.
86
87
* </p>
87
88
*/
88
89
publicclassStatusLoggerextendsAbstractLogger {
@@ -127,45 +128,45 @@ public class StatusLogger extends AbstractLogger {
* The name of the system property that can be configured with a {@link java.time.format.DateTimeFormatter} pattern that will be passed to the default listener.
162
+
* The name of the system property that can be configured with a {@link java.time.format.DateTimeFormatter} pattern that will be used while formatting the created {@link StatusData}.
* The name of the system property that can be configured with a {@link java.time.format.DateTimeFormatter} pattern that will be passed to the default listener.
169
+
* The name of the system property that can be configured with a {@link java.time.format.DateTimeFormatter} pattern that will be used while formatting the created {@link StatusData}.
169
170
*
170
171
* @since 2.11.0
171
172
* @deprecated Use {@link #INSTANT_FORMAT_PROPERTY_NAME} instead.
@@ -193,7 +194,7 @@ public static final class Config {
193
194
194
195
privatefinalintbufferCapacity;
195
196
196
-
privatefinalLeveldefaultListenerLevel;
197
+
privatefinalLevelfallbackListenerLevel;
197
198
198
199
@Nullable
199
200
privatefinalDateTimeFormatterinstantFormatter;
@@ -204,21 +205,21 @@ public static final class Config {
204
205
*
205
206
* @param debugEnabled the value of the {@value DEBUG_PROPERTY_NAME} property
206
207
* @param bufferCapacity the value of the {@value BUFFER_CAPACITY_PROPERTY_NAME} property
207
-
* @param defaultListenerLevel the value of the {@value DEFAULT_LISTENER_LEVEL_PROPERTY_NAME} property
208
+
* @param fallbackListenerLevel the value of the {@value FALLBACK_LISTENER_LEVEL_PROPERTY_NAME} property
208
209
* @param instantFormatter the value of the {@value INSTANT_FORMAT_PROPERTY_NAME} property
209
210
*/
210
211
publicConfig(
211
212
booleandebugEnabled,
212
213
intbufferCapacity,
213
-
LeveldefaultListenerLevel,
214
+
LevelfallbackListenerLevel,
214
215
@NullableDateTimeFormatterinstantFormatter) {
215
216
this.debugEnabled = debugEnabled;
216
217
if (bufferCapacity < 0) {
217
218
thrownewIllegalArgumentException(
218
219
"was expecting a positive `bufferCapacity`, found: " + bufferCapacity);
* @deprecated Instead either use {@link #setDefaultListenerLevel(Level)}, or {@link #getListeners() get the specific listener} and change its {@link StatusListener#getStatusLevel() level}.
460
+
* @deprecated Instead either use {@link #setFallbackListenerLevel(Level)}, or {@link #getListeners() get the specific listener} and change its {@link StatusListener#getStatusLevel() level}.
460
461
*/
461
462
@Deprecated
462
463
publicvoidupdateListenerLevel(finalLevellevel) {
463
464
requireNonNull(level, "level");
464
-
setDefaultListenerLevel(level);
465
+
setFallbackListenerLevel(level);
465
466
}
466
467
467
468
/**
@@ -479,18 +480,16 @@ public Iterable<StatusListener> getListeners() {
479
480
}
480
481
481
482
/**
482
-
* Clears the event buffer and removes the <em>registered</em> (not the default one!) listeners.
483
+
* Clears the event buffer and removes the <em>registered</em> (not the fallback one!) listeners.
Copy file name to clipboardExpand all lines: log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractActionTest.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@
30
30
importorg.junitpioneer.jupiter.SetSystemProperty;
31
31
32
32
@SetSystemProperty(key = StatusLogger.BUFFER_CAPACITY_PROPERTY_NAME, value = "10")
33
-
@SetSystemProperty(key = StatusLogger.DEFAULT_LISTENER_LEVEL_PROPERTY_NAME, value = "WARN")
33
+
@SetSystemProperty(key = StatusLogger.FALLBACK_LISTENER_LEVEL_PROPERTY_NAME, value = "WARN")
0 commit comments