You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2013/04/08 00:07:42 UTC
svn commit: r1465483 - in /logging/log4j/log4j2/trunk/log4j-async/src:
main/java/org/apache/logging/log4j/async/
test/java/org/apache/logging/log4j/async/
test/java/org/apache/logging/log4j/async/appender/
test/java/org/apache/logging/log4j/async/confi...
Author: rgoers
Date: Sun Apr 7 22:07:42 2013
New Revision: 1465483
URL: http://svn.apache.org/r1465483
Log:
LOG4J2-195 - Move files generated by async tests to target directory. Add missing license headers
Added:
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderRolloverTest.java
Modified:
logging/log4j/log4j2/trunk/log4j-async/src/main/java/org/apache/logging/log4j/async/ClockFactory.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextSelectorTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerLocationTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/CachedClockTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/ClockFactoryTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/SystemClockTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderLocationTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderLocationTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/config/AsyncLoggerConfigTest.java
logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerConfigTest.xml
logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerLocationTest.xml
logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerTest.xml
logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderLocationTest.xml
logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderTest.xml
logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderLocationTest.xml
logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderTest.xml
Modified: logging/log4j/log4j2/trunk/log4j-async/src/main/java/org/apache/logging/log4j/async/ClockFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/main/java/org/apache/logging/log4j/async/ClockFactory.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/main/java/org/apache/logging/log4j/async/ClockFactory.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/main/java/org/apache/logging/log4j/async/ClockFactory.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async;
import org.apache.logging.log4j.status.StatusLogger;
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextSelectorTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextSelectorTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextSelectorTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextSelectorTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async;
import static org.junit.Assert.*;
@@ -13,7 +29,7 @@ public class AsyncLoggerContextSelectorT
public void testContextReturnsAsyncLoggerContext() {
AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
LoggerContext context = selector.getContext(null, null, false);
-
+
assertTrue(context instanceof AsyncLoggerContext);
}
@@ -21,7 +37,7 @@ public class AsyncLoggerContextSelectorT
public void testContext2ReturnsAsyncLoggerContext() {
AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
LoggerContext context = selector.getContext(null, null, false, null);
-
+
assertTrue(context instanceof AsyncLoggerContext);
}
@@ -29,7 +45,7 @@ public class AsyncLoggerContextSelectorT
public void testLoggerContextsReturnsAsyncLoggerContext() {
AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
List<LoggerContext> list = selector.getLoggerContexts();
-
+
assertEquals(1, list.size());
assertTrue(list.get(0) instanceof AsyncLoggerContext);
}
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerContextTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async;
import static org.junit.Assert.*;
@@ -15,7 +31,7 @@ public class AsyncLoggerContextTest {
Logger logger = new AsyncLoggerContext("a").newInstance(
new LoggerContext("a"), "a", null);
assertTrue(logger instanceof AsyncLogger);
-
+
((LifeCycle) LogManager.getContext()).stop(); // stop async thread
}
}
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerLocationTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerLocationTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerLocationTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerLocationTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async;
import static org.junit.Assert.*;
@@ -32,7 +48,7 @@ public class AsyncLoggerLocationTest {
@Test
public void testAsyncLogWritesToLog() throws Exception {
- File f = new File("AsyncLoggerLocationTest.log");
+ File f = new File("target", "AsyncLoggerLocationTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
Logger log = LogManager.getLogger("com.foo.Bar");
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/AsyncLoggerTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async;
import static org.junit.Assert.*;
@@ -32,7 +48,7 @@ public class AsyncLoggerTest {
@Test
public void testAsyncLogWritesToLog() throws Exception {
- File f = new File("AsyncLoggerTest.log");
+ File f = new File("target", "AsyncLoggerTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
Logger log = LogManager.getLogger("com.foo.Bar");
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/CachedClockTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/CachedClockTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/CachedClockTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/CachedClockTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async;
import static org.junit.Assert.*;
@@ -10,9 +26,9 @@ public class CachedClockTest {
public void testLessThan17Millis() {
long millis1 = CachedClock.instance().currentTimeMillis();
long sysMillis = System.currentTimeMillis();
-
+
long diff = sysMillis - millis1;
-
+
assertTrue("diff too large: " + diff, diff <= 16);
}
@@ -21,9 +37,9 @@ public class CachedClockTest {
Thread.sleep(100);
long millis1 = CachedClock.instance().currentTimeMillis();
long sysMillis = System.currentTimeMillis();
-
+
long diff = sysMillis - millis1;
-
+
assertTrue("diff too large: " + diff, diff <= 16);
}
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/ClockFactoryTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/ClockFactoryTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/ClockFactoryTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/ClockFactoryTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async;
import static org.junit.Assert.*;
@@ -54,7 +70,7 @@ public class ClockFactoryTest {
return 42;
}
}
-
+
@Test
public void testCustomClock() {
System.setProperty(ClockFactory.PROPERTY_NAME, MyClock.class.getName());
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/SystemClockTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/SystemClockTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/SystemClockTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/SystemClockTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async;
import static org.junit.Assert.*;
@@ -10,9 +26,9 @@ public class SystemClockTest {
public void testLessThan2Millis() {
long millis1 = new SystemClock().currentTimeMillis();
long sysMillis = System.currentTimeMillis();
-
+
long diff = sysMillis - millis1;
-
+
assertTrue("diff too large: " + diff, diff <= 1);
}
@@ -21,9 +37,9 @@ public class SystemClockTest {
Thread.sleep(100);
long millis1 = new SystemClock().currentTimeMillis();
long sysMillis = System.currentTimeMillis();
-
+
long diff = sysMillis - millis1;
-
+
assertTrue("diff too large: " + diff, diff <= 1);
}
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderLocationTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderLocationTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderLocationTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderLocationTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async.appender;
import static org.junit.Assert.*;
@@ -23,7 +39,7 @@ public class FastFileAppenderLocationTes
@Test
public void testLocationIncluded() throws Exception {
- File f = new File("FastFileAppenderLocationTest.log");
+ File f = new File("target", "FastFileAppenderLocationTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
Logger log = LogManager.getLogger("com.foo.Bar");
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastFileAppenderTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async.appender;
import static org.junit.Assert.*;
@@ -23,7 +39,7 @@ public class FastFileAppenderTest {
@Test
public void testFlushAtEndOfBatch() throws Exception {
- File f = new File("FastFileAppenderTest.log");
+ File f = new File("target", "FastFileAppenderTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
Logger log = LogManager.getLogger("com.foo.Bar");
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderLocationTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderLocationTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderLocationTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderLocationTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async.appender;
import static org.junit.Assert.*;
@@ -23,7 +39,7 @@ public class FastRollingFileAppenderLoca
@Test
public void testLocationIncluded() throws Exception {
- File f = new File("FastRollingFileAppenderLocationTest.log");
+ File f = new File("target", "FastRollingFileAppenderLocationTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
Logger log = LogManager.getLogger("com.foo.Bar");
Added: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderRolloverTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderRolloverTest.java?rev=1465483&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderRolloverTest.java (added)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderRolloverTest.java Sun Apr 7 22:07:42 2013
@@ -0,0 +1,92 @@
+/*
+ * 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.async.appender;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.Arrays;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LifeCycle;
+import org.apache.logging.log4j.core.config.XMLConfigurationFactory;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class FastRollingFileAppenderRolloverTest {
+
+ @BeforeClass
+ public static void beforeClass() {
+ System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
+ "FastRollingFileAppenderTest.xml");
+ }
+
+ @Test
+ public void testRollover() throws Exception {
+ File f = new File("target", "FastRollingFileAppenderTest.log");
+ // System.out.println(f.getAbsolutePath());
+ File after1 = new File("target", "afterRollover-1.log");
+ f.delete();
+ after1.delete();
+
+ Logger log = LogManager.getLogger("com.foo.Bar");
+ String msg = "First a short message that does not trigger rollover";
+ log.info(msg);
+ Thread.sleep(50);
+
+ BufferedReader reader = new BufferedReader(new FileReader(f));
+ String line1 = reader.readLine();
+ assertTrue(line1.contains(msg));
+ reader.close();
+
+ assertFalse("afterRollover-1.log not created yet", after1.exists());
+
+ String exceed = "Long message that exceeds rollover size... ";
+ char[] padding = new char[250];
+ Arrays.fill(padding, 'X');
+ exceed += new String(padding);
+ log.warn(exceed);
+ assertFalse("exceeded size but afterRollover-1.log not created yet", after1.exists());
+
+ String trigger = "This message triggers rollover.";
+ log.warn(trigger);
+
+ ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
+
+ assertTrue("afterRollover-1.log created", after1.exists());
+
+ reader = new BufferedReader(new FileReader(f));
+ String new1 = reader.readLine();
+ assertTrue("after rollover only new msg", new1.contains(trigger));
+ assertNull("No more lines", reader.readLine());
+ reader.close();
+ f.delete();
+
+ reader = new BufferedReader(new FileReader(after1));
+ String old1 = reader.readLine();
+ assertTrue("renamed file line 1", old1.contains(msg));
+ String old2 = reader.readLine();
+ assertTrue("renamed file line 2", old2.contains(exceed));
+ String line = reader.readLine();
+ // assertNull("No more lines", line);
+ reader.close();
+ after1.delete();
+ }
+}
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/appender/FastRollingFileAppenderTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async.appender;
import static org.junit.Assert.*;
@@ -23,7 +39,7 @@ public class FastRollingFileAppenderTest
@Test
public void testFlushAtEndOfBatch() throws Exception {
- File f = new File("FastRollingFileAppenderTest.log");
+ File f = new File("target", "FastRollingFileAppenderTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
Logger log = LogManager.getLogger("com.foo.Bar");
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/config/AsyncLoggerConfigTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/config/AsyncLoggerConfigTest.java?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/config/AsyncLoggerConfigTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/java/org/apache/logging/log4j/async/config/AsyncLoggerConfigTest.java Sun Apr 7 22:07:42 2013
@@ -1,3 +1,19 @@
+/*
+ * 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.async.config;
import static org.junit.Assert.*;
@@ -23,7 +39,7 @@ public class AsyncLoggerConfigTest {
@Test
public void testAdditivity() throws Exception {
- File f = new File("AsyncLoggerConfigTest.log");
+ File f = new File("target", "AsyncLoggerConfigTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
Logger log = LogManager.getLogger("com.foo.Bar");
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerConfigTest.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerConfigTest.xml?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerConfigTest.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerConfigTest.xml Sun Apr 7 22:07:42 2013
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<appenders>
- <File name="File" fileName="AsyncLoggerConfigTest.log" bufferedIO="false" immediateFlush="true" append="false">
+ <File name="File" fileName="target/AsyncLoggerConfigTest.log" bufferedIO="false" immediateFlush="true" append="false">
<PatternLayout>
<pattern>%d %p %c{1.} [%t] %X{aKey} %m %location %ex%n</pattern>
</PatternLayout>
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerLocationTest.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerLocationTest.xml?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerLocationTest.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerLocationTest.xml Sun Apr 7 22:07:42 2013
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<appenders>
- <FastFile name="FastFile" fileName="AsyncLoggerLocationTest.log"
+ <FastFile name="FastFile" fileName="target/AsyncLoggerLocationTest.log"
immediateFlush="false" append="false">
<PatternLayout>
<pattern>%d %p %c{1.} [%t] %X{aKey} %location %m %ex%n</pattern>
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerTest.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerTest.xml?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerTest.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/resources/AsyncLoggerTest.xml Sun Apr 7 22:07:42 2013
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<appenders>
- <FastFile name="FastFile" fileName="AsyncLoggerTest.log"
+ <FastFile name="FastFile" fileName="target/AsyncLoggerTest.log"
immediateFlush="false" append="false">
<PatternLayout>
<pattern>%d %p %c{1.} [%t] %X{aKey} %location %m %ex%n</pattern>
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderLocationTest.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderLocationTest.xml?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderLocationTest.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderLocationTest.xml Sun Apr 7 22:07:42 2013
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<appenders>
- <FastFile name="FastFile" fileName="FastFileAppenderLocationTest.log" immediateFlush="false" append="false">
+ <FastFile name="FastFile" fileName="target/FastFileAppenderLocationTest.log" immediateFlush="false" append="false">
<PatternLayout>
<pattern>%d %p %c{1.} [%t] %X{aKey} %m %location %ex%n</pattern>
<!--
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderTest.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderTest.xml?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderTest.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastFileAppenderTest.xml Sun Apr 7 22:07:42 2013
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<appenders>
- <FastFile name="FastFile" fileName="FastFileAppenderTest.log" immediateFlush="false" append="false">
+ <FastFile name="FastFile" fileName="target/FastFileAppenderTest.log" immediateFlush="false" append="false">
<PatternLayout>
<pattern>%d %p %c{1.} [%t] %X{aKey} %m %location %ex%n</pattern>
<!--
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderLocationTest.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderLocationTest.xml?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderLocationTest.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderLocationTest.xml Sun Apr 7 22:07:42 2013
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<appenders>
- <FastRollingFile name="FastRollingFile" fileName="FastRollingFileAppenderLocationTest.log"
+ <FastRollingFile name="FastRollingFile" fileName="target/FastRollingFileAppenderLocationTest.log"
filePattern="test-%d{MM-dd-yyyy}-%i.log.gz" append="false"
immediateFlush="false">
<PatternLayout>
Modified: logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderTest.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderTest.xml?rev=1465483&r1=1465482&r2=1465483&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderTest.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-async/src/test/resources/FastRollingFileAppenderTest.xml Sun Apr 7 22:07:42 2013
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<appenders>
- <FastRollingFile name="FastRollingFile" fileName="FastRollingFileAppenderTest.log"
- filePattern="test-%d{MM-dd-yyyy}-%i.log.gz" append="false"
+ <FastRollingFile name="FastRollingFile" fileName="target/FastRollingFileAppenderTest.log"
+ filePattern="target/afterRollover-%i.log" append="false"
immediateFlush="false">
<PatternLayout>
<pattern>%d %p %c{1.} [%t] %X{aKey} %m %location %ex%n</pattern>
</PatternLayout>
<Policies>
- <TimeBasedTriggeringPolicy />
+ <SizeBasedTriggeringPolicy size="250 B"/>
</Policies>
</FastRollingFile>
</appenders>