This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/main by this push:
new b8fb8c86d9 Remove redundant `log4j-jcl` annotations (#2163)
b8fb8c86d9 is described below
commit b8fb8c86d98402031b85e5b472af4d4c3b3e9a19
Author: Volkan Yazıcı <[email protected]>
AuthorDate: Wed Jan 10 14:07:29 2024 +0100
Remove redundant `log4j-jcl` annotations (#2163)
---
.../apache/logging/log4j/jcl/CallerInformationTest.java | 11 ++++-------
.../java/org/apache/logging/log4j/jcl/LoggerTest.java | 16 +++++++---------
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git
a/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/CallerInformationTest.java
b/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/CallerInformationTest.java
index 7bdbe3baf3..3580a3b837 100644
---
a/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/CallerInformationTest.java
+++
b/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/CallerInformationTest.java
@@ -16,20 +16,17 @@
*/
package org.apache.logging.log4j.jcl;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
-import org.apache.logging.log4j.test.junit.SetTestProperty;
-import org.apache.logging.log4j.test.junit.UsingStatusListener;
import org.junit.jupiter.api.Test;
-@UsingStatusListener
-@SetTestProperty(key = "log4j2.configurationFile", value =
"org/apache/logging/log4j/jcl/CallerInformationTest.xml")
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
public class CallerInformationTest {
@Test
diff --git
a/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java
b/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java
index 0c4fc4f3bf..e9c405342a 100644
--- a/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java
+++ b/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java
@@ -24,11 +24,9 @@ import org.apache.commons.logging.LogFactory;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
-import org.apache.logging.log4j.test.junit.UsingStatusListener;
import org.apache.logging.log4j.util.Strings;
import org.junit.jupiter.api.Test;
-@UsingStatusListener
class LoggerTest {
@Test
@@ -39,20 +37,20 @@ class LoggerTest {
@Test
@LoggerContextSource("LoggerTest.xml")
- void testLog(final LoggerContext loggerContext) {
+ void testLog(final LoggerContext context) {
final Log logger = LogFactory.getLog("LoggerTest");
logger.debug("Test message");
- verify(loggerContext, "o.a.l.l.j.LoggerTest Test message MDC{}" +
Strings.LINE_SEPARATOR);
+ verify(context, "o.a.l.l.j.LoggerTest Test message MDC{}" +
Strings.LINE_SEPARATOR);
logger.debug("Exception: ", new NullPointerException("Test"));
- verify(loggerContext, "o.a.l.l.j.LoggerTest Exception: MDC{}" +
Strings.LINE_SEPARATOR);
+ verify(context, "o.a.l.l.j.LoggerTest Exception: MDC{}" +
Strings.LINE_SEPARATOR);
logger.info("Info Message");
- verify(loggerContext, "o.a.l.l.j.LoggerTest Info Message MDC{}" +
Strings.LINE_SEPARATOR);
+ verify(context, "o.a.l.l.j.LoggerTest Info Message MDC{}" +
Strings.LINE_SEPARATOR);
logger.info("Info Message {}");
- verify(loggerContext, "o.a.l.l.j.LoggerTest Info Message {} MDC{}" +
Strings.LINE_SEPARATOR);
+ verify(context, "o.a.l.l.j.LoggerTest Info Message {} MDC{}" +
Strings.LINE_SEPARATOR);
}
- private static void verify(final LoggerContext loggerContext, final String
expected) {
- final ListAppender listApp =
loggerContext.getConfiguration().getAppender("List");
+ private static void verify(final LoggerContext context, final String
expected) {
+ final ListAppender listApp =
context.getConfiguration().getAppender("List");
final List<String> events = listApp.getMessages();
assertThat(events).hasSize(1).containsExactly(expected);
listApp.clear();