Repository: logging-log4j2
Updated Branches:
  refs/heads/master 05ef4b32d -> 873166368


Testing https://issues.apache.org/jira/browse/LOG4J2-1967

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/87316636
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/87316636
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/87316636

Branch: refs/heads/master
Commit: 8731663683732977953b02b7eed8a39f330c43fd
Parents: 05ef4b3
Author: Gary Gregory <[email protected]>
Authored: Thu Jul 6 01:21:47 2017 -0700
Committer: Gary Gregory <[email protected]>
Committed: Thu Jul 6 01:21:47 2017 -0700

----------------------------------------------------------------------
 .../RollingFileAppenderReconfigureTest.java     | 36 ++++++++++++++++++
 ...rReconfigureUndefinedSystemPropertyTest.java | 36 ++++++++++++++++++
 .../logging/log4j/junit/LoggerContextRule.java  |  4 ++
 ...lling-file-appender-reconfigure.original.xml | 39 ++++++++++++++++++++
 .../rolling-file-appender-reconfigure.xml       | 39 ++++++++++++++++++++
 5 files changed, 154 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87316636/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java
new file mode 100644
index 0000000..8c4657a
--- /dev/null
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.logging.log4j.core.appender.rolling;
+
+import org.apache.logging.log4j.junit.LoggerContextRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Tests https://issues.apache.org/jira/browse/LOG4J2-1967
+ */
+public class RollingFileAppenderReconfigureTest {
+
+    @Rule
+    public final LoggerContextRule loggerContextRule = new 
LoggerContextRule("src/test/rolling-file-appender-reconfigure.xml");  
+    
+    @Test
+    public void testReconfigure() {
+        loggerContextRule.reconfigure();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87316636/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java
new file mode 100644
index 0000000..31a21b1
--- /dev/null
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingFileAppenderReconfigureUndefinedSystemPropertyTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.logging.log4j.core.appender.rolling;
+
+import org.apache.logging.log4j.junit.LoggerContextRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Tests https://issues.apache.org/jira/browse/LOG4J2-1967
+ */
+public class RollingFileAppenderReconfigureUndefinedSystemPropertyTest {
+
+    @Rule
+    public final LoggerContextRule loggerContextRule = new 
LoggerContextRule("src/test/rolling-file-appender-reconfigure.original.xml");  
+    
+    @Test
+    public void testReconfigure() {
+        loggerContextRule.reconfigure();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87316636/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
index 1f1a95e..6e275af 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
@@ -272,6 +272,10 @@ public class LoggerContextRule implements TestRule {
         return loggerContext.getRootLogger();
     }
 
+    public void reconfigure() {
+        loggerContext.reconfigure();
+    }
+    
     @Override
     public String toString() {
         final StringBuilder builder = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87316636/log4j-core/src/test/resources/rolling-file-appender-reconfigure.original.xml
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/resources/rolling-file-appender-reconfigure.original.xml 
b/log4j-core/src/test/resources/rolling-file-appender-reconfigure.original.xml
new file mode 100644
index 0000000..0649572
--- /dev/null
+++ 
b/log4j-core/src/test/resources/rolling-file-appender-reconfigure.original.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="debug" monitorInterval="10">
+  <Properties>
+    <Property name="logFilePath">${sys:logfile}</Property>
+  </Properties>
+  <Appenders>
+    <Console name="CONSOLE" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] 
%c{1} - %msg%n" />
+    </Console>
+    <RollingFile name="LOG_FILE" fileName="${logFilePath}.log" 
filePattern="${logFilePath}.%i.log"
+      immediateFlush="true">
+      <PatternLayout 
pattern="[%d{yyyyMMdd.HH:mm:ss.SSS}:%-5level][%-17t][%-30c][%m]%n" />
+      <Policies>
+        <SizeBasedTriggeringPolicy size="100MB" />
+      </Policies>
+      <DefaultRolloverStrategy max="1000" />
+    </RollingFile>
+    <RollingFile name="ERROR_FILE" fileName="${logFilePath}.error.log" 
filePattern="${logFilePath}.error.%i.log"
+      immediateFlush="true">
+      <PatternLayout 
pattern="[%d{yyyyMMdd.HH:mm:ss.SSS}:%-5level][%-17t][%-30c{2}][%m]%n" />
+      <Policies>
+        <SizeBasedTriggeringPolicy size="100MB" />
+      </Policies>
+      <DefaultRolloverStrategy max="1000" />
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Logger name="a" level="warn" additivity="false" />
+    <Logger name="b" level="warn" additivity="false" />
+    <Logger name="c" level="warn" additivity="false" />
+    <Logger name="d" level="warn" additivity="false" />
+    <Logger name="e" level="warn" additivity="false" />
+
+    <Root level="debug" additivity="false">
+      <AppenderRef ref="LOG_FILE" level="debug" />
+      <AppenderRef ref="ERROR_FILE" level="error" />
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87316636/log4j-core/src/test/resources/rolling-file-appender-reconfigure.xml
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/resources/rolling-file-appender-reconfigure.xml 
b/log4j-core/src/test/resources/rolling-file-appender-reconfigure.xml
new file mode 100644
index 0000000..08f5385
--- /dev/null
+++ b/log4j-core/src/test/resources/rolling-file-appender-reconfigure.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="debug" monitorInterval="10">
+  <Properties>
+    <Property name="logFilePath">target/log4j-1967</Property>
+  </Properties>
+  <Appenders>
+    <Console name="CONSOLE" target="SYSTEM_OUT">
+      <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] 
%c{1} - %msg%n" />
+    </Console>
+    <RollingFile name="LOG_FILE" fileName="${logFilePath}.log" 
filePattern="${logFilePath}.%i.log"
+      immediateFlush="true">
+      <PatternLayout 
pattern="[%d{yyyyMMdd.HH:mm:ss.SSS}:%-5level][%-17t][%-30c][%m]%n" />
+      <Policies>
+        <SizeBasedTriggeringPolicy size="100MB" />
+      </Policies>
+      <DefaultRolloverStrategy max="1000" />
+    </RollingFile>
+    <RollingFile name="ERROR_FILE" fileName="${logFilePath}.error.log" 
filePattern="${logFilePath}.error.%i.log"
+      immediateFlush="true">
+      <PatternLayout 
pattern="[%d{yyyyMMdd.HH:mm:ss.SSS}:%-5level][%-17t][%-30c{2}][%m]%n" />
+      <Policies>
+        <SizeBasedTriggeringPolicy size="100MB" />
+      </Policies>
+      <DefaultRolloverStrategy max="1000" />
+    </RollingFile>
+  </Appenders>
+  <Loggers>
+    <Logger name="a" level="warn" additivity="false" />
+    <Logger name="b" level="warn" additivity="false" />
+    <Logger name="c" level="warn" additivity="false" />
+    <Logger name="d" level="warn" additivity="false" />
+    <Logger name="e" level="warn" additivity="false" />
+
+    <Root level="debug" additivity="false">
+      <AppenderRef ref="LOG_FILE" level="debug" />
+      <AppenderRef ref="ERROR_FILE" level="error" />
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file

Reply via email to