You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2021/12/17 02:43:45 UTC
[logging-log4j2] branch release-2.x updated: Clear system property after test run.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/release-2.x by this push:
new 8f1e414 Clear system property after test run.
8f1e414 is described below
commit 8f1e4147af564d6a1a187048e23114bb4dd12802
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 16 21:43:39 2021 -0500
Clear system property after test run.
Remove unused method.
---
.../java/org/apache/log4j/Log4j1Constants.java | 23 ++++++++++++++++++++++
.../apache/log4j/config/SyslogAppenderTest.java | 21 +++++++++++++-------
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/log4j-1.2-api/src/test/java/org/apache/log4j/Log4j1Constants.java b/log4j-1.2-api/src/test/java/org/apache/log4j/Log4j1Constants.java
new file mode 100644
index 0000000..b4f180d
--- /dev/null
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/Log4j1Constants.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.log4j;
+
+public class Log4j1Constants {
+
+ public static final String DEFAULT_CONFIGURATION_KEY = "log4j.configuration";
+
+}
diff --git a/log4j-1.2-api/src/test/java/org/apache/log4j/config/SyslogAppenderTest.java b/log4j-1.2-api/src/test/java/org/apache/log4j/config/SyslogAppenderTest.java
index 61dadce..478f97b 100644
--- a/log4j-1.2-api/src/test/java/org/apache/log4j/config/SyslogAppenderTest.java
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/config/SyslogAppenderTest.java
@@ -16,21 +16,23 @@
*/
package org.apache.log4j.config;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.log4j.Log4j1Constants;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.net.mock.MockSyslogServer;
import org.apache.logging.log4j.core.net.mock.MockSyslogServerFactory;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import java.io.IOException;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
/**
* Class Description goes here.
@@ -42,7 +44,12 @@ public class SyslogAppenderTest {
@BeforeClass
public static void beforeClass() {
- System.setProperty("log4j.configuration", "target/test-classes/log4j1-syslog.xml");
+ System.setProperty(Log4j1Constants.DEFAULT_CONFIGURATION_KEY, "target/test-classes/log4j1-syslog.xml");
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ System.clearProperty(Log4j1Constants.DEFAULT_CONFIGURATION_KEY);
}
@Before