Skip to content

Commit ac8a06e

Browse files
committedMay 7, 2014
Add git attributes - to fix line endings
Add suggested git attributes and associated files that were not in sync already with expected line endings.
1 parent 8aa285a commit ac8a06e

File tree

23 files changed

+1528
-1506
lines changed

23 files changed

+1528
-1506
lines changed
 

‎.gitattributes

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.access.jetty;
15-
16-
import ch.qos.logback.access.spi.IAccessEvent;
17-
import ch.qos.logback.access.PatternLayoutEncoder;
18-
import ch.qos.logback.access.testUtil.NotifyingListAppender;
19-
import ch.qos.logback.core.ConsoleAppender;
20-
21-
public class JettyFixtureWithListAndConsoleAppenders extends JettyFixtureBase {
22-
23-
public JettyFixtureWithListAndConsoleAppenders(RequestLogImpl impl, int port) {
24-
super(impl, port);
25-
url = "http://localhost:" + port + "/";
26-
}
27-
28-
public void start() throws Exception {
29-
super.start();
30-
Thread.yield();
31-
}
32-
33-
public void stop() throws Exception {
34-
super.stop();
35-
Thread.sleep(500);
36-
}
37-
38-
@Override
39-
protected void configureRequestLogImpl() {
40-
NotifyingListAppender appender = new NotifyingListAppender();
41-
appender.setContext(requestLogImpl);
42-
appender.setName("list");
43-
appender.start();
44-
45-
ConsoleAppender<IAccessEvent> console = new ConsoleAppender<IAccessEvent>();
46-
console.setContext(requestLogImpl);
47-
console.setName("console");
48-
PatternLayoutEncoder layout = new PatternLayoutEncoder();
49-
layout.setContext(requestLogImpl);
50-
layout.setPattern("%date %server %clientHost");
51-
console.setEncoder(layout);
52-
layout.start();
53-
console.start();
54-
55-
requestLogImpl.addAppender(appender);
56-
requestLogImpl.addAppender(console);
57-
}
58-
}
59-
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.access.jetty;
15+
16+
import ch.qos.logback.access.spi.IAccessEvent;
17+
import ch.qos.logback.access.PatternLayoutEncoder;
18+
import ch.qos.logback.access.testUtil.NotifyingListAppender;
19+
import ch.qos.logback.core.ConsoleAppender;
20+
21+
public class JettyFixtureWithListAndConsoleAppenders extends JettyFixtureBase {
22+
23+
public JettyFixtureWithListAndConsoleAppenders(RequestLogImpl impl, int port) {
24+
super(impl, port);
25+
url = "http://localhost:" + port + "/";
26+
}
27+
28+
public void start() throws Exception {
29+
super.start();
30+
Thread.yield();
31+
}
32+
33+
public void stop() throws Exception {
34+
super.stop();
35+
Thread.sleep(500);
36+
}
37+
38+
@Override
39+
protected void configureRequestLogImpl() {
40+
NotifyingListAppender appender = new NotifyingListAppender();
41+
appender.setContext(requestLogImpl);
42+
appender.setName("list");
43+
appender.start();
44+
45+
ConsoleAppender<IAccessEvent> console = new ConsoleAppender<IAccessEvent>();
46+
console.setContext(requestLogImpl);
47+
console.setName("console");
48+
PatternLayoutEncoder layout = new PatternLayoutEncoder();
49+
layout.setContext(requestLogImpl);
50+
layout.setPattern("%date %server %clientHost");
51+
console.setEncoder(layout);
52+
layout.start();
53+
console.start();
54+
55+
requestLogImpl.addAppender(appender);
56+
requestLogImpl.addAppender(console);
57+
}
58+
}
59+
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,95 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.access.joran;
15-
16-
import ch.qos.logback.access.TeztConstants;
17-
import ch.qos.logback.access.spi.AccessContext;
18-
import ch.qos.logback.core.ConsoleAppender;
19-
import ch.qos.logback.core.joran.spi.JoranException;
20-
import ch.qos.logback.core.read.ListAppender;
21-
import ch.qos.logback.core.status.StatusChecker;
22-
import ch.qos.logback.core.testUtil.RandomUtil;
23-
import ch.qos.logback.core.util.CoreTestConstants;
24-
import org.junit.Before;
25-
import org.junit.Test;
26-
27-
import java.io.IOException;
28-
import java.net.InetAddress;
29-
import java.net.UnknownHostException;
30-
31-
import static org.junit.Assert.assertNotNull;
32-
import static org.junit.Assert.assertNull;
33-
import static org.junit.Assert.assertTrue;
34-
35-
/**
36-
* @author Ceki G&uuml;c&uuml;
37-
*/
38-
public class ConditionalTest {
39-
40-
AccessContext context = new AccessContext();
41-
StatusChecker checker = new StatusChecker(context);
42-
43-
int diff = RandomUtil.getPositiveInt();
44-
String randomOutputDir = CoreTestConstants.OUTPUT_DIR_PREFIX + diff + "/";
45-
46-
@Before
47-
public void setUp() {
48-
InetAddress localhost = null;
49-
try {
50-
localhost = InetAddress.getLocalHost();
51-
context.putProperty("aHost", localhost.getHostName());
52-
} catch (UnknownHostException e) {
53-
e.printStackTrace();
54-
}
55-
}
56-
57-
void configure(String file) throws JoranException {
58-
JoranConfigurator jc = new JoranConfigurator();
59-
jc.setContext(context);
60-
jc.doConfigure(file);
61-
}
62-
63-
@Test
64-
public void conditionalConsoleApp_IF_THEN_True() throws JoranException, UnknownHostException {
65-
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");
66-
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
67-
assertNotNull(consoleAppender);
68-
assertTrue(checker.isErrorFree(0));
69-
}
70-
71-
@Test
72-
public void conditionalConsoleApp_IF_THEN_False() throws JoranException,
73-
IOException, InterruptedException {
74-
context.putProperty("aHost", null);
75-
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");
76-
77-
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
78-
assertNull(consoleAppender);
79-
80-
StatusChecker checker = new StatusChecker(context);
81-
assertTrue(checker.isErrorFree(0));
82-
}
83-
84-
@Test
85-
public void conditionalConsoleApp_ELSE() throws JoranException,
86-
IOException, InterruptedException {
87-
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole_ELSE.xml");
88-
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
89-
assertNull(consoleAppender);
90-
91-
ListAppender listAppender = (ListAppender) context.getAppender("LIST");
92-
assertNotNull(listAppender);
93-
assertTrue(checker.isErrorFree(0));
94-
}
95-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.access.joran;
15+
16+
import ch.qos.logback.access.TeztConstants;
17+
import ch.qos.logback.access.spi.AccessContext;
18+
import ch.qos.logback.core.ConsoleAppender;
19+
import ch.qos.logback.core.joran.spi.JoranException;
20+
import ch.qos.logback.core.read.ListAppender;
21+
import ch.qos.logback.core.status.StatusChecker;
22+
import ch.qos.logback.core.testUtil.RandomUtil;
23+
import ch.qos.logback.core.util.CoreTestConstants;
24+
import org.junit.Before;
25+
import org.junit.Test;
26+
27+
import java.io.IOException;
28+
import java.net.InetAddress;
29+
import java.net.UnknownHostException;
30+
31+
import static org.junit.Assert.assertNotNull;
32+
import static org.junit.Assert.assertNull;
33+
import static org.junit.Assert.assertTrue;
34+
35+
/**
36+
* @author Ceki G&uuml;c&uuml;
37+
*/
38+
public class ConditionalTest {
39+
40+
AccessContext context = new AccessContext();
41+
StatusChecker checker = new StatusChecker(context);
42+
43+
int diff = RandomUtil.getPositiveInt();
44+
String randomOutputDir = CoreTestConstants.OUTPUT_DIR_PREFIX + diff + "/";
45+
46+
@Before
47+
public void setUp() {
48+
InetAddress localhost = null;
49+
try {
50+
localhost = InetAddress.getLocalHost();
51+
context.putProperty("aHost", localhost.getHostName());
52+
} catch (UnknownHostException e) {
53+
e.printStackTrace();
54+
}
55+
}
56+
57+
void configure(String file) throws JoranException {
58+
JoranConfigurator jc = new JoranConfigurator();
59+
jc.setContext(context);
60+
jc.doConfigure(file);
61+
}
62+
63+
@Test
64+
public void conditionalConsoleApp_IF_THEN_True() throws JoranException, UnknownHostException {
65+
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");
66+
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
67+
assertNotNull(consoleAppender);
68+
assertTrue(checker.isErrorFree(0));
69+
}
70+
71+
@Test
72+
public void conditionalConsoleApp_IF_THEN_False() throws JoranException,
73+
IOException, InterruptedException {
74+
context.putProperty("aHost", null);
75+
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");
76+
77+
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
78+
assertNull(consoleAppender);
79+
80+
StatusChecker checker = new StatusChecker(context);
81+
assertTrue(checker.isErrorFree(0));
82+
}
83+
84+
@Test
85+
public void conditionalConsoleApp_ELSE() throws JoranException,
86+
IOException, InterruptedException {
87+
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole_ELSE.xml");
88+
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
89+
assertNull(consoleAppender);
90+
91+
ListAppender listAppender = (ListAppender) context.getAppender("LIST");
92+
assertNotNull(listAppender);
93+
assertTrue(checker.isErrorFree(0));
94+
}
95+
}
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.access.joran;
15-
16-
import org.junit.runner.RunWith;
17-
import org.junit.runners.Suite;
18-
19-
/**
20-
* @author Ceki G&uuml;c&uuml;
21-
*/
22-
@RunWith(Suite.class)
23-
@Suite.SuiteClasses({JoranConfiguratorTest.class, ConditionalTest.class})
24-
public class PackageTest {
25-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.access.joran;
15+
16+
import org.junit.runner.RunWith;
17+
import org.junit.runners.Suite;
18+
19+
/**
20+
* @author Ceki G&uuml;c&uuml;
21+
*/
22+
@RunWith(Suite.class)
23+
@Suite.SuiteClasses({JoranConfiguratorTest.class, ConditionalTest.class})
24+
public class PackageTest {
25+
}
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.classic.issue.lbcore211;
15-
16-
import ch.qos.logback.classic.Logger;
17-
import ch.qos.logback.classic.LoggerContext;
18-
import ch.qos.logback.classic.joran.JoranConfigurator;
19-
import ch.qos.logback.core.joran.spi.JoranException;
20-
import ch.qos.logback.core.util.StatusPrinter;
21-
import org.junit.Test;
22-
import org.slf4j.LoggerFactory;
23-
24-
/**
25-
* @author Ceki G&uuml;c&uuml;
26-
*/
27-
public class Lbcore211 {
28-
29-
@Test
30-
public void lbcore211() throws JoranException {
31-
32-
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
33-
34-
JoranConfigurator configurator = new JoranConfigurator();
35-
configurator.setContext(lc);
36-
lc.reset();
37-
configurator.doConfigure("/home/ceki/lbcore211.xml");
38-
39-
Logger l = lc.getLogger("file.logger");
40-
StatusPrinter.print(lc);
41-
for (int i = 0; i < 10; i++) {
42-
l.info("hello " + i);
43-
}
44-
45-
lc.stop();
46-
}
47-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.classic.issue.lbcore211;
15+
16+
import ch.qos.logback.classic.Logger;
17+
import ch.qos.logback.classic.LoggerContext;
18+
import ch.qos.logback.classic.joran.JoranConfigurator;
19+
import ch.qos.logback.core.joran.spi.JoranException;
20+
import ch.qos.logback.core.util.StatusPrinter;
21+
import org.junit.Test;
22+
import org.slf4j.LoggerFactory;
23+
24+
/**
25+
* @author Ceki G&uuml;c&uuml;
26+
*/
27+
public class Lbcore211 {
28+
29+
@Test
30+
public void lbcore211() throws JoranException {
31+
32+
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
33+
34+
JoranConfigurator configurator = new JoranConfigurator();
35+
configurator.setContext(lc);
36+
lc.reset();
37+
configurator.doConfigure("/home/ceki/lbcore211.xml");
38+
39+
Logger l = lc.getLogger("file.logger");
40+
StatusPrinter.print(lc);
41+
for (int i = 0; i < 10; i++) {
42+
l.info("hello " + i);
43+
}
44+
45+
lc.stop();
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.classic.turbo.lru;
15-
16-
public class Event<K> {
17-
18-
final public boolean put;
19-
final public K k;
20-
21-
public Event(boolean put, K k) {
22-
this.put = put;
23-
this.k = k;
24-
}
25-
26-
public String toString() {
27-
if(put) {
28-
return "Event: put, "+k;
29-
} else {
30-
return "Event: get, "+k;
31-
}
32-
}
33-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.classic.turbo.lru;
15+
16+
public class Event<K> {
17+
18+
final public boolean put;
19+
final public K k;
20+
21+
public Event(boolean put, K k) {
22+
this.put = put;
23+
this.k = k;
24+
}
25+
26+
public String toString() {
27+
if(put) {
28+
return "Event: put, "+k;
29+
} else {
30+
return "Event: get, "+k;
31+
}
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.classic.turbo.lru;
15-
16-
import java.util.ArrayList;
17-
import java.util.LinkedHashMap;
18-
import java.util.List;
19-
import java.util.Map;
20-
21-
/**
22-
* An lru cache based on Java's LinkedHashMap.
23-
*
24-
* @author Ceki Gulcu
25-
*
26-
* @param <K>
27-
* @param <V>
28-
*/
29-
public class LRUCache<K, V> extends LinkedHashMap<K, V> {
30-
private static final long serialVersionUID = -6592964689843698200L;
31-
32-
final int cacheSize;
33-
34-
public LRUCache(int cacheSize) {
35-
super((int) (cacheSize*(4.0f/3)), 0.75f, true);
36-
if(cacheSize < 1) {
37-
throw new IllegalArgumentException("Cache size cannnot be smaller than 1");
38-
}
39-
this.cacheSize = cacheSize;
40-
}
41-
42-
protected boolean removeEldestEntry(Map.Entry eldest) {
43-
return (size() > cacheSize);
44-
}
45-
46-
List<K> keyList() {
47-
ArrayList<K> al = new ArrayList<K>();
48-
al.addAll(keySet());
49-
return al;
50-
}
51-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.classic.turbo.lru;
15+
16+
import java.util.ArrayList;
17+
import java.util.LinkedHashMap;
18+
import java.util.List;
19+
import java.util.Map;
20+
21+
/**
22+
* An lru cache based on Java's LinkedHashMap.
23+
*
24+
* @author Ceki Gulcu
25+
*
26+
* @param <K>
27+
* @param <V>
28+
*/
29+
public class LRUCache<K, V> extends LinkedHashMap<K, V> {
30+
private static final long serialVersionUID = -6592964689843698200L;
31+
32+
final int cacheSize;
33+
34+
public LRUCache(int cacheSize) {
35+
super((int) (cacheSize*(4.0f/3)), 0.75f, true);
36+
if(cacheSize < 1) {
37+
throw new IllegalArgumentException("Cache size cannnot be smaller than 1");
38+
}
39+
this.cacheSize = cacheSize;
40+
}
41+
42+
protected boolean removeEldestEntry(Map.Entry eldest) {
43+
return (size() > cacheSize);
44+
}
45+
46+
List<K> keyList() {
47+
ArrayList<K> al = new ArrayList<K>();
48+
al.addAll(keySet());
49+
return al;
50+
}
51+
}
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,122 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.classic.turbo.lru;
15-
16-
import static org.junit.Assert.assertEquals;
17-
18-
import java.util.LinkedList;
19-
import java.util.List;
20-
21-
import org.junit.Ignore;
22-
import org.junit.Test;
23-
24-
@Ignore
25-
public class LRUCacheTest {
26-
27-
@Test
28-
public void smoke() {
29-
30-
LRUCache<String, String> cache = new LRUCache<String, String>(2);
31-
cache.put("a", "a");
32-
cache.put("b", "b");
33-
cache.put("c", "c");
34-
List<String> witness = new LinkedList<String>();
35-
witness.add("b");
36-
witness.add("c");
37-
assertEquals(witness, cache.keyList());
38-
}
39-
40-
@Test
41-
public void typicalScenarioTest() {
42-
int simulationLen = 1000 * 10;
43-
int cacheSize = 100;
44-
int worldSize = 1000;
45-
doScenario(simulationLen, cacheSize, worldSize);
46-
}
47-
48-
@Test
49-
public void scenarioCoverageTest() {
50-
int simulationLen = 1000 * 10;
51-
52-
int[] cacheSizes = new int[] { 1, 10, 100};
53-
// tests with large worldSizes are slow because with a large
54-
// world size the probability of a cache miss is high.
55-
int[] worldSizes = new int[] { 1, 10, 100 };
56-
57-
for (int i = 0; i < cacheSizes.length; i++) {
58-
for (int j = 0; j < worldSizes.length; j++) {
59-
doScenario(simulationLen, cacheSizes[i], worldSizes[j]);
60-
}
61-
}
62-
}
63-
64-
void doScenario(int simulationLen, int cacheSize, int worldSize) {
65-
int get2PutRatio = 10;
66-
Simulator simulator = new Simulator(worldSize, get2PutRatio, false);
67-
List<Event> scenario = simulator.generateScenario(simulationLen);
68-
LRUCache<String, String> lruCache = new LRUCache<String, String>(cacheSize);
69-
T_LRUCache<String> tlruCache = new T_LRUCache<String>(cacheSize);
70-
long start = System.nanoTime();
71-
simulator.simulate(scenario, lruCache, tlruCache);
72-
//assertEquals(tlruCache.keyList(), lruCache.keyList());
73-
long end = System.nanoTime();
74-
System.out.println("cacheSize=" + cacheSize + ", worldSize=" + worldSize
75-
+ ", elapsed time=" + ((end - start) / (1000 * 1000)) + " in millis");
76-
}
77-
78-
79-
80-
@Test
81-
@Ignore // slow test that is known to pass
82-
public void multiThreadedScenario() throws InterruptedException {
83-
int cacheSize = 100;
84-
int worldSize = cacheSize*2;
85-
LRUCache<String, String> lruCache = new LRUCache<String, String>(cacheSize);
86-
T_LRUCache<String> tlruCache = new T_LRUCache<String>(cacheSize);
87-
SimulatorRunnable[] simulatorArray = new SimulatorRunnable[5];
88-
for(int i = 0; i < simulatorArray.length; i++) {
89-
simulatorArray[i] = new SimulatorRunnable(lruCache, tlruCache, worldSize);
90-
}
91-
for(int i = 0; i < simulatorArray.length; i++) {
92-
simulatorArray[i].start();
93-
}
94-
for(int i = 0; i < simulatorArray.length; i++) {
95-
simulatorArray[i].join();
96-
}
97-
assertEquals(tlruCache.keyList(), lruCache.keyList());
98-
}
99-
100-
private class SimulatorRunnable extends Thread {
101-
102-
LRUCache<String, String> lruCache;
103-
T_LRUCache<String> tlruCache;
104-
int worldSize;
105-
106-
SimulatorRunnable(LRUCache<String, String> lruCache, T_LRUCache<String> tlruCache, int worldSize) {
107-
this.lruCache = lruCache;
108-
this.tlruCache = tlruCache;
109-
this.worldSize = worldSize;
110-
}
111-
112-
public void run() {
113-
int get2PutRatio = 10;
114-
int simulationLen = 1000*50;
115-
Simulator simulator = new Simulator(worldSize, get2PutRatio, true);
116-
List<Event> scenario = simulator.generateScenario(simulationLen);
117-
simulator.simulate(scenario, lruCache, tlruCache);
118-
System.out.println("done");
119-
}
120-
}
121-
122-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.classic.turbo.lru;
15+
16+
import static org.junit.Assert.assertEquals;
17+
18+
import java.util.LinkedList;
19+
import java.util.List;
20+
21+
import org.junit.Ignore;
22+
import org.junit.Test;
23+
24+
@Ignore
25+
public class LRUCacheTest {
26+
27+
@Test
28+
public void smoke() {
29+
30+
LRUCache<String, String> cache = new LRUCache<String, String>(2);
31+
cache.put("a", "a");
32+
cache.put("b", "b");
33+
cache.put("c", "c");
34+
List<String> witness = new LinkedList<String>();
35+
witness.add("b");
36+
witness.add("c");
37+
assertEquals(witness, cache.keyList());
38+
}
39+
40+
@Test
41+
public void typicalScenarioTest() {
42+
int simulationLen = 1000 * 10;
43+
int cacheSize = 100;
44+
int worldSize = 1000;
45+
doScenario(simulationLen, cacheSize, worldSize);
46+
}
47+
48+
@Test
49+
public void scenarioCoverageTest() {
50+
int simulationLen = 1000 * 10;
51+
52+
int[] cacheSizes = new int[] { 1, 10, 100};
53+
// tests with large worldSizes are slow because with a large
54+
// world size the probability of a cache miss is high.
55+
int[] worldSizes = new int[] { 1, 10, 100 };
56+
57+
for (int i = 0; i < cacheSizes.length; i++) {
58+
for (int j = 0; j < worldSizes.length; j++) {
59+
doScenario(simulationLen, cacheSizes[i], worldSizes[j]);
60+
}
61+
}
62+
}
63+
64+
void doScenario(int simulationLen, int cacheSize, int worldSize) {
65+
int get2PutRatio = 10;
66+
Simulator simulator = new Simulator(worldSize, get2PutRatio, false);
67+
List<Event> scenario = simulator.generateScenario(simulationLen);
68+
LRUCache<String, String> lruCache = new LRUCache<String, String>(cacheSize);
69+
T_LRUCache<String> tlruCache = new T_LRUCache<String>(cacheSize);
70+
long start = System.nanoTime();
71+
simulator.simulate(scenario, lruCache, tlruCache);
72+
//assertEquals(tlruCache.keyList(), lruCache.keyList());
73+
long end = System.nanoTime();
74+
System.out.println("cacheSize=" + cacheSize + ", worldSize=" + worldSize
75+
+ ", elapsed time=" + ((end - start) / (1000 * 1000)) + " in millis");
76+
}
77+
78+
79+
80+
@Test
81+
@Ignore // slow test that is known to pass
82+
public void multiThreadedScenario() throws InterruptedException {
83+
int cacheSize = 100;
84+
int worldSize = cacheSize*2;
85+
LRUCache<String, String> lruCache = new LRUCache<String, String>(cacheSize);
86+
T_LRUCache<String> tlruCache = new T_LRUCache<String>(cacheSize);
87+
SimulatorRunnable[] simulatorArray = new SimulatorRunnable[5];
88+
for(int i = 0; i < simulatorArray.length; i++) {
89+
simulatorArray[i] = new SimulatorRunnable(lruCache, tlruCache, worldSize);
90+
}
91+
for(int i = 0; i < simulatorArray.length; i++) {
92+
simulatorArray[i].start();
93+
}
94+
for(int i = 0; i < simulatorArray.length; i++) {
95+
simulatorArray[i].join();
96+
}
97+
assertEquals(tlruCache.keyList(), lruCache.keyList());
98+
}
99+
100+
private class SimulatorRunnable extends Thread {
101+
102+
LRUCache<String, String> lruCache;
103+
T_LRUCache<String> tlruCache;
104+
int worldSize;
105+
106+
SimulatorRunnable(LRUCache<String, String> lruCache, T_LRUCache<String> tlruCache, int worldSize) {
107+
this.lruCache = lruCache;
108+
this.tlruCache = tlruCache;
109+
this.worldSize = worldSize;
110+
}
111+
112+
public void run() {
113+
int get2PutRatio = 10;
114+
int simulationLen = 1000*50;
115+
Simulator simulator = new Simulator(worldSize, get2PutRatio, true);
116+
List<Event> scenario = simulator.generateScenario(simulationLen);
117+
simulator.simulate(scenario, lruCache, tlruCache);
118+
System.out.println("done");
119+
}
120+
}
121+
122+
}
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,89 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.classic.turbo.lru;
15-
16-
import static org.junit.Assert.assertEquals;
17-
18-
import java.util.ArrayList;
19-
import java.util.List;
20-
import java.util.Random;
21-
22-
public class Simulator {
23-
24-
Random random;
25-
26-
int worldSize;
27-
int get2PutRatio;
28-
boolean multiThreaded;
29-
30-
public Simulator(int worldSize, int get2PutRatio, boolean multiThreaded) {
31-
this.worldSize = worldSize;
32-
this.get2PutRatio = get2PutRatio;
33-
long seed = System.nanoTime();
34-
// System.out.println("seed is "+seed);
35-
random = new Random(seed);
36-
this.multiThreaded = multiThreaded;
37-
}
38-
39-
public List<Event> generateScenario(int len) {
40-
List<Event> scenario = new ArrayList<Event>();
41-
42-
for (int i = 0; i < len; i++) {
43-
44-
int r = random.nextInt(get2PutRatio);
45-
boolean put = false;
46-
if (r == 0) {
47-
put = true;
48-
}
49-
r = random.nextInt(worldSize);
50-
Event<String> e = new Event<String>(put, String.valueOf(r));
51-
scenario.add(e);
52-
}
53-
return scenario;
54-
}
55-
56-
public void simulate(List<Event> scenario, LRUCache<String, String> lruCache,
57-
T_LRUCache<String> tlruCache) {
58-
for (Event<String> e : scenario) {
59-
if (e.put) {
60-
lruCache.put(e.k, e.k);
61-
tlruCache.put(e.k);
62-
} else {
63-
String r0 = lruCache.get(e.k);
64-
String r1 = tlruCache.get(e.k);
65-
if (!multiThreaded) {
66-
// if the simulation is used in a multi-threaded
67-
// context, then the state of lruCache may be different than
68-
// that of tlruCache. In single threaded mode, they should
69-
// return the same values all the time
70-
if (r0 != null) {
71-
assertEquals(r0, e.k);
72-
}
73-
assertEquals(r0, r1);
74-
}
75-
}
76-
}
77-
}
78-
79-
// void compareAndDumpIfDifferent(LRUCache<String, String> lruCache,
80-
// T_LRUCache<String> tlruCache) {
81-
// lruCache.dump();
82-
// tlruCache.dump();
83-
// if(!lruCache.keyList().equals(tlruCache.ketList())) {
84-
// lruCache.dump();
85-
// tlruCache.dump();
86-
// throw new AssertionFailedError("s");
87-
// }
88-
// }
89-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.classic.turbo.lru;
15+
16+
import static org.junit.Assert.assertEquals;
17+
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
import java.util.Random;
21+
22+
public class Simulator {
23+
24+
Random random;
25+
26+
int worldSize;
27+
int get2PutRatio;
28+
boolean multiThreaded;
29+
30+
public Simulator(int worldSize, int get2PutRatio, boolean multiThreaded) {
31+
this.worldSize = worldSize;
32+
this.get2PutRatio = get2PutRatio;
33+
long seed = System.nanoTime();
34+
// System.out.println("seed is "+seed);
35+
random = new Random(seed);
36+
this.multiThreaded = multiThreaded;
37+
}
38+
39+
public List<Event> generateScenario(int len) {
40+
List<Event> scenario = new ArrayList<Event>();
41+
42+
for (int i = 0; i < len; i++) {
43+
44+
int r = random.nextInt(get2PutRatio);
45+
boolean put = false;
46+
if (r == 0) {
47+
put = true;
48+
}
49+
r = random.nextInt(worldSize);
50+
Event<String> e = new Event<String>(put, String.valueOf(r));
51+
scenario.add(e);
52+
}
53+
return scenario;
54+
}
55+
56+
public void simulate(List<Event> scenario, LRUCache<String, String> lruCache,
57+
T_LRUCache<String> tlruCache) {
58+
for (Event<String> e : scenario) {
59+
if (e.put) {
60+
lruCache.put(e.k, e.k);
61+
tlruCache.put(e.k);
62+
} else {
63+
String r0 = lruCache.get(e.k);
64+
String r1 = tlruCache.get(e.k);
65+
if (!multiThreaded) {
66+
// if the simulation is used in a multi-threaded
67+
// context, then the state of lruCache may be different than
68+
// that of tlruCache. In single threaded mode, they should
69+
// return the same values all the time
70+
if (r0 != null) {
71+
assertEquals(r0, e.k);
72+
}
73+
assertEquals(r0, r1);
74+
}
75+
}
76+
}
77+
}
78+
79+
// void compareAndDumpIfDifferent(LRUCache<String, String> lruCache,
80+
// T_LRUCache<String> tlruCache) {
81+
// lruCache.dump();
82+
// tlruCache.dump();
83+
// if(!lruCache.keyList().equals(tlruCache.ketList())) {
84+
// lruCache.dump();
85+
// tlruCache.dump();
86+
// throw new AssertionFailedError("s");
87+
// }
88+
// }
89+
}
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.classic.turbo.lru;
15-
16-
public class T_Entry<K> implements Comparable {
17-
18-
K k;
19-
long sequenceNumber;
20-
21-
T_Entry(K k, long sn) {
22-
this.k = k;
23-
this.sequenceNumber = sn;
24-
}
25-
26-
public int compareTo(Object o) {
27-
if(!(o instanceof T_Entry)) {
28-
throw new IllegalArgumentException("arguments must be of type "+T_Entry.class);
29-
}
30-
31-
T_Entry other = (T_Entry) o;
32-
if(sequenceNumber > other.sequenceNumber) {
33-
return 1;
34-
}
35-
if(sequenceNumber == other.sequenceNumber) {
36-
return 0;
37-
}
38-
return -1;
39-
}
40-
@Override
41-
public String toString() {
42-
return "("+k+","+sequenceNumber+")";
43-
//return "("+k+")";
44-
}
45-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.classic.turbo.lru;
15+
16+
public class T_Entry<K> implements Comparable {
17+
18+
K k;
19+
long sequenceNumber;
20+
21+
T_Entry(K k, long sn) {
22+
this.k = k;
23+
this.sequenceNumber = sn;
24+
}
25+
26+
public int compareTo(Object o) {
27+
if(!(o instanceof T_Entry)) {
28+
throw new IllegalArgumentException("arguments must be of type "+T_Entry.class);
29+
}
30+
31+
T_Entry other = (T_Entry) o;
32+
if(sequenceNumber > other.sequenceNumber) {
33+
return 1;
34+
}
35+
if(sequenceNumber == other.sequenceNumber) {
36+
return 0;
37+
}
38+
return -1;
39+
}
40+
@Override
41+
public String toString() {
42+
return "("+k+","+sequenceNumber+")";
43+
//return "("+k+")";
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,94 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.classic.turbo.lru;
15-
16-
import java.util.ArrayList;
17-
import java.util.Collections;
18-
import java.util.LinkedList;
19-
import java.util.List;
20-
21-
/**
22-
* This is an alternative (slower) implementation of LRUCache for testing
23-
* purposes.
24-
*
25-
* @author Ceki Gulcu
26-
*/
27-
public class T_LRUCache<K> {
28-
29-
int sequenceNumber;
30-
final int cacheSize;
31-
List<T_Entry<K>> cacheList = new LinkedList<T_Entry<K>>();
32-
33-
public T_LRUCache(int size) {
34-
this.cacheSize = size;
35-
}
36-
37-
@SuppressWarnings("unchecked")
38-
synchronized public void put(K k) {
39-
sequenceNumber++;
40-
T_Entry<K> te = getEntry(k);
41-
if (te != null) {
42-
te.sequenceNumber = sequenceNumber;
43-
} else {
44-
te = new T_Entry<K>(k, sequenceNumber);
45-
cacheList.add(te);
46-
}
47-
Collections.sort(cacheList);
48-
while(cacheList.size() > cacheSize) {
49-
cacheList.remove(0);
50-
}
51-
}
52-
53-
@SuppressWarnings("unchecked")
54-
synchronized public K get(K k) {
55-
T_Entry<K> te = getEntry(k);
56-
if (te == null) {
57-
return null;
58-
} else {
59-
te.sequenceNumber = ++sequenceNumber;
60-
Collections.sort(cacheList);
61-
return te.k;
62-
}
63-
}
64-
65-
synchronized public List<K> keyList() {
66-
List<K> keyList = new ArrayList<K>();
67-
for (T_Entry<K> e : cacheList) {
68-
keyList.add(e.k);
69-
}
70-
return keyList;
71-
}
72-
73-
private T_Entry<K> getEntry(K k) {
74-
for (int i = 0; i < cacheList.size(); i++) {
75-
T_Entry<K> te = cacheList.get(i);
76-
if (te.k.equals(k)) {
77-
return te;
78-
}
79-
}
80-
return null;
81-
}
82-
83-
84-
public void dump() {
85-
System.out.print("T:");
86-
for (T_Entry<K> te : cacheList) {
87-
//System.out.print(te.toString()+"->");
88-
System.out.print(te.k+", ");
89-
}
90-
System.out.println();
91-
}
92-
93-
}
94-
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.classic.turbo.lru;
15+
16+
import java.util.ArrayList;
17+
import java.util.Collections;
18+
import java.util.LinkedList;
19+
import java.util.List;
20+
21+
/**
22+
* This is an alternative (slower) implementation of LRUCache for testing
23+
* purposes.
24+
*
25+
* @author Ceki Gulcu
26+
*/
27+
public class T_LRUCache<K> {
28+
29+
int sequenceNumber;
30+
final int cacheSize;
31+
List<T_Entry<K>> cacheList = new LinkedList<T_Entry<K>>();
32+
33+
public T_LRUCache(int size) {
34+
this.cacheSize = size;
35+
}
36+
37+
@SuppressWarnings("unchecked")
38+
synchronized public void put(K k) {
39+
sequenceNumber++;
40+
T_Entry<K> te = getEntry(k);
41+
if (te != null) {
42+
te.sequenceNumber = sequenceNumber;
43+
} else {
44+
te = new T_Entry<K>(k, sequenceNumber);
45+
cacheList.add(te);
46+
}
47+
Collections.sort(cacheList);
48+
while(cacheList.size() > cacheSize) {
49+
cacheList.remove(0);
50+
}
51+
}
52+
53+
@SuppressWarnings("unchecked")
54+
synchronized public K get(K k) {
55+
T_Entry<K> te = getEntry(k);
56+
if (te == null) {
57+
return null;
58+
} else {
59+
te.sequenceNumber = ++sequenceNumber;
60+
Collections.sort(cacheList);
61+
return te.k;
62+
}
63+
}
64+
65+
synchronized public List<K> keyList() {
66+
List<K> keyList = new ArrayList<K>();
67+
for (T_Entry<K> e : cacheList) {
68+
keyList.add(e.k);
69+
}
70+
return keyList;
71+
}
72+
73+
private T_Entry<K> getEntry(K k) {
74+
for (int i = 0; i < cacheList.size(); i++) {
75+
T_Entry<K> te = cacheList.get(i);
76+
if (te.k.equals(k)) {
77+
return te;
78+
}
79+
}
80+
return null;
81+
}
82+
83+
84+
public void dump() {
85+
System.out.print("T:");
86+
for (T_Entry<K> te : cacheList) {
87+
//System.out.print(te.toString()+"->");
88+
System.out.print(te.k+", ");
89+
}
90+
System.out.println();
91+
}
92+
93+
}
94+
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
<configuration>
2-
<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener"/>
3-
4-
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
5-
<file>test.log</file>
6-
7-
8-
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
9-
<!-- rollover every minute -->
10-
<fileNamePattern>bla-%d{yyyy-MM-dd, SECONDARY}/app.%d{yyyy-MM-dd'T'HH_mm}.log</fileNamePattern>
11-
</rollingPolicy>
12-
13-
<encoder>
14-
<pattern>%d{"yyyy-MM-dd HH:mm:ss,SSS"} [%thread] %-5level %logger{36} - %msg%n%xEx</pattern>
15-
</encoder>
16-
</appender>
17-
18-
<root level="DEBUG">
19-
<appender-ref ref="FILE"/>
20-
</root>
1+
<configuration>
2+
<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener"/>
3+
4+
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
5+
<file>test.log</file>
6+
7+
8+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
9+
<!-- rollover every minute -->
10+
<fileNamePattern>bla-%d{yyyy-MM-dd, SECONDARY}/app.%d{yyyy-MM-dd'T'HH_mm}.log</fileNamePattern>
11+
</rollingPolicy>
12+
13+
<encoder>
14+
<pattern>%d{"yyyy-MM-dd HH:mm:ss,SSS"} [%thread] %-5level %logger{36} - %msg%n%xEx</pattern>
15+
</encoder>
16+
</appender>
17+
18+
<root level="DEBUG">
19+
<appender-ref ref="FILE"/>
20+
</root>
2121
</configuration>
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.core.hook;
15-
16-
import ch.qos.logback.core.Context;
17-
import ch.qos.logback.core.ContextBase;
18-
import ch.qos.logback.core.util.Duration;
19-
20-
/**
21-
* ShutdownHook implementation that stops the Logback context after a specified
22-
* delay. The default delay is 0 ms (zero).
23-
*
24-
* @author Mike Reinhold
25-
*/
26-
public class DelayingShutdownHook extends ShutdownHookBase {
27-
/**
28-
* The default is no delay before shutdown.
29-
*/
30-
public static final Duration DEFAULT_DELAY = Duration.buildByMilliseconds(0);
31-
32-
/**
33-
* The delay in milliseconds before the ShutdownHook stops the logback context
34-
*/
35-
private Duration delay = DEFAULT_DELAY;
36-
37-
public DelayingShutdownHook() {
38-
}
39-
40-
public Duration getDelay() {
41-
return delay;
42-
}
43-
44-
/**
45-
* The duration to wait before shutting down the current logback context.
46-
*
47-
* @param delay
48-
*/
49-
public void setDelay(Duration delay) {
50-
this.delay = delay;
51-
}
52-
53-
public void run() {
54-
try {
55-
Thread.sleep(delay.getMilliseconds());
56-
} catch (InterruptedException e) {
57-
}
58-
super.stop();
59-
}
60-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.core.hook;
15+
16+
import ch.qos.logback.core.Context;
17+
import ch.qos.logback.core.ContextBase;
18+
import ch.qos.logback.core.util.Duration;
19+
20+
/**
21+
* ShutdownHook implementation that stops the Logback context after a specified
22+
* delay. The default delay is 0 ms (zero).
23+
*
24+
* @author Mike Reinhold
25+
*/
26+
public class DelayingShutdownHook extends ShutdownHookBase {
27+
/**
28+
* The default is no delay before shutdown.
29+
*/
30+
public static final Duration DEFAULT_DELAY = Duration.buildByMilliseconds(0);
31+
32+
/**
33+
* The delay in milliseconds before the ShutdownHook stops the logback context
34+
*/
35+
private Duration delay = DEFAULT_DELAY;
36+
37+
public DelayingShutdownHook() {
38+
}
39+
40+
public Duration getDelay() {
41+
return delay;
42+
}
43+
44+
/**
45+
* The duration to wait before shutting down the current logback context.
46+
*
47+
* @param delay
48+
*/
49+
public void setDelay(Duration delay) {
50+
this.delay = delay;
51+
}
52+
53+
public void run() {
54+
try {
55+
Thread.sleep(delay.getMilliseconds());
56+
} catch (InterruptedException e) {
57+
}
58+
super.stop();
59+
}
60+
}
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.core.hook;
15-
16-
import ch.qos.logback.core.spi.ContextAware;
17-
18-
/**
19-
* Interface describing a logback shutdown hook implementation
20-
*
21-
* @author Mike Reinhold
22-
*/
23-
public interface ShutdownHook extends Runnable, ContextAware {
24-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.core.hook;
15+
16+
import ch.qos.logback.core.spi.ContextAware;
17+
18+
/**
19+
* Interface describing a logback shutdown hook implementation
20+
*
21+
* @author Mike Reinhold
22+
*/
23+
public interface ShutdownHook extends Runnable, ContextAware {
24+
}
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.core.hook;
15-
16-
import ch.qos.logback.core.Context;
17-
import ch.qos.logback.core.ContextBase;
18-
import ch.qos.logback.core.spi.ContextAwareBase;
19-
20-
/**
21-
* Base class for classes implementing a Logback ShutdownHook via extension
22-
*
23-
* @author Mike Reinhold
24-
*/
25-
public abstract class ShutdownHookBase extends ContextAwareBase implements ShutdownHook {
26-
27-
public ShutdownHookBase() {
28-
}
29-
30-
/**
31-
* Default method for stopping the Logback context
32-
*/
33-
protected void stop() {
34-
addInfo("Logback context being closed via shutdown hook");
35-
36-
Context hookContext = getContext();
37-
if (hookContext instanceof ContextBase) {
38-
ContextBase context = (ContextBase) hookContext;
39-
context.stop();
40-
}
41-
}
42-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.core.hook;
15+
16+
import ch.qos.logback.core.Context;
17+
import ch.qos.logback.core.ContextBase;
18+
import ch.qos.logback.core.spi.ContextAwareBase;
19+
20+
/**
21+
* Base class for classes implementing a Logback ShutdownHook via extension
22+
*
23+
* @author Mike Reinhold
24+
*/
25+
public abstract class ShutdownHookBase extends ContextAwareBase implements ShutdownHook {
26+
27+
public ShutdownHookBase() {
28+
}
29+
30+
/**
31+
* Default method for stopping the Logback context
32+
*/
33+
protected void stop() {
34+
addInfo("Logback context being closed via shutdown hook");
35+
36+
Context hookContext = getContext();
37+
if (hookContext instanceof ContextBase) {
38+
ContextBase context = (ContextBase) hookContext;
39+
context.stop();
40+
}
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2-
3-
<html>
4-
<head>
5-
<title></title>
6-
</head>
7-
8-
<body>
9-
10-
<p>Contains the shutdown hook functionality of logback,
11-
including the interface and base class for implementing
12-
hooks as well as some default implementations, such as
13-
@link{ch.qos.logback.core.hook.DelayingShutdownHook}
14-
</p>
15-
16-
</body>
17-
</html>
1+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2+
3+
<html>
4+
<head>
5+
<title></title>
6+
</head>
7+
8+
<body>
9+
10+
<p>Contains the shutdown hook functionality of logback,
11+
including the interface and base class for implementing
12+
hooks as well as some default implementations, such as
13+
@link{ch.qos.logback.core.hook.DelayingShutdownHook}
14+
</p>
15+
16+
</body>
17+
</html>
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.core.joran.action;
15-
16-
import org.xml.sax.Attributes;
17-
18-
import ch.qos.logback.core.CoreConstants;
19-
import ch.qos.logback.core.hook.ShutdownHookBase;
20-
import ch.qos.logback.core.joran.spi.ActionException;
21-
import ch.qos.logback.core.joran.spi.InterpretationContext;
22-
import ch.qos.logback.core.util.OptionHelper;
23-
24-
/**
25-
* Action which handles <shutdownHook> elements in configuration files.
26-
*
27-
* @author Mike Reinhold
28-
*/
29-
public class ShutdownHookAction extends Action {
30-
31-
ShutdownHookBase hook;
32-
private boolean inError;
33-
34-
/**
35-
* Instantiates a shutdown hook of the given class and sets its name.
36-
*
37-
* The hook thus generated is placed in the {@link InterpretationContext}'s
38-
* shutdown hook bag.
39-
*/
40-
@Override
41-
public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException {
42-
hook = null;
43-
inError = false;
44-
45-
String className = attributes.getValue(CLASS_ATTRIBUTE);
46-
if (OptionHelper.isEmpty(className)) {
47-
addError("Missing class name for shutdown hook. Near [" + name
48-
+ "] line " + getLineNumber(ic));
49-
inError = true;
50-
return;
51-
}
52-
53-
try {
54-
addInfo("About to instantiate shutdown hook of type [" + className + "]");
55-
56-
hook = (ShutdownHookBase) OptionHelper.instantiateByClassName(className,
57-
ShutdownHookBase.class, context);
58-
hook.setContext(context);
59-
60-
ic.pushObject(hook);
61-
}catch (Exception e) {
62-
inError = true;
63-
addError("Could not create a shutdown hook of type [" + className + "].", e);
64-
throw new ActionException(e);
65-
}
66-
}
67-
68-
/**
69-
* Once the children elements are also parsed, now is the time to activate the
70-
* shutdown hook options.
71-
*/
72-
@Override
73-
public void end(InterpretationContext ic, String name) throws ActionException {
74-
if (inError) {
75-
return;
76-
}
77-
78-
Object o = ic.peekObject();
79-
if (o != hook) {
80-
addWarn("The object at the of the stack is not the hook pushed earlier.");
81-
} else {
82-
ic.popObject();
83-
84-
Thread hookThread = new Thread(hook, "Logback shutdown hook [" + context.getName() + "]");
85-
86-
context.putObject(CoreConstants.SHUTDOWN_HOOK_THREAD, hookThread);
87-
Runtime.getRuntime().addShutdownHook(hookThread);
88-
}
89-
}
90-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.core.joran.action;
15+
16+
import org.xml.sax.Attributes;
17+
18+
import ch.qos.logback.core.CoreConstants;
19+
import ch.qos.logback.core.hook.ShutdownHookBase;
20+
import ch.qos.logback.core.joran.spi.ActionException;
21+
import ch.qos.logback.core.joran.spi.InterpretationContext;
22+
import ch.qos.logback.core.util.OptionHelper;
23+
24+
/**
25+
* Action which handles <shutdownHook> elements in configuration files.
26+
*
27+
* @author Mike Reinhold
28+
*/
29+
public class ShutdownHookAction extends Action {
30+
31+
ShutdownHookBase hook;
32+
private boolean inError;
33+
34+
/**
35+
* Instantiates a shutdown hook of the given class and sets its name.
36+
*
37+
* The hook thus generated is placed in the {@link InterpretationContext}'s
38+
* shutdown hook bag.
39+
*/
40+
@Override
41+
public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException {
42+
hook = null;
43+
inError = false;
44+
45+
String className = attributes.getValue(CLASS_ATTRIBUTE);
46+
if (OptionHelper.isEmpty(className)) {
47+
addError("Missing class name for shutdown hook. Near [" + name
48+
+ "] line " + getLineNumber(ic));
49+
inError = true;
50+
return;
51+
}
52+
53+
try {
54+
addInfo("About to instantiate shutdown hook of type [" + className + "]");
55+
56+
hook = (ShutdownHookBase) OptionHelper.instantiateByClassName(className,
57+
ShutdownHookBase.class, context);
58+
hook.setContext(context);
59+
60+
ic.pushObject(hook);
61+
}catch (Exception e) {
62+
inError = true;
63+
addError("Could not create a shutdown hook of type [" + className + "].", e);
64+
throw new ActionException(e);
65+
}
66+
}
67+
68+
/**
69+
* Once the children elements are also parsed, now is the time to activate the
70+
* shutdown hook options.
71+
*/
72+
@Override
73+
public void end(InterpretationContext ic, String name) throws ActionException {
74+
if (inError) {
75+
return;
76+
}
77+
78+
Object o = ic.peekObject();
79+
if (o != hook) {
80+
addWarn("The object at the of the stack is not the hook pushed earlier.");
81+
} else {
82+
ic.popObject();
83+
84+
Thread hookThread = new Thread(hook, "Logback shutdown hook [" + context.getName() + "]");
85+
86+
context.putObject(CoreConstants.SHUTDOWN_HOOK_THREAD, hookThread);
87+
Runtime.getRuntime().addShutdownHook(hookThread);
88+
}
89+
}
90+
}
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.core.joran.conditional;
15-
16-
import ch.qos.logback.core.spi.PropertyContainer;
17-
import ch.qos.logback.core.util.OptionHelper;
18-
19-
public class PropertyWrapperForScripts {
20-
21-
PropertyContainer local;
22-
PropertyContainer context;
23-
24-
// this method is invoked by reflection in PropertyEvalScriptBuilder
25-
public void setPropertyContainers(PropertyContainer local, PropertyContainer context) {
26-
this.local = local;
27-
this.context = context;
28-
}
29-
30-
public boolean isNull(String k) {
31-
String val = OptionHelper.propertyLookup(k, local, context);
32-
return (val == null);
33-
}
34-
35-
public boolean isDefined(String k) {
36-
String val = OptionHelper.propertyLookup(k, local, context);
37-
return (val != null);
38-
}
39-
40-
public String p(String k) {
41-
return property(k);
42-
}
43-
44-
public String property(String k) {
45-
String val = OptionHelper.propertyLookup(k, local, context);
46-
if(val != null)
47-
return val;
48-
else
49-
return "";
50-
}
51-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.core.joran.conditional;
15+
16+
import ch.qos.logback.core.spi.PropertyContainer;
17+
import ch.qos.logback.core.util.OptionHelper;
18+
19+
public class PropertyWrapperForScripts {
20+
21+
PropertyContainer local;
22+
PropertyContainer context;
23+
24+
// this method is invoked by reflection in PropertyEvalScriptBuilder
25+
public void setPropertyContainers(PropertyContainer local, PropertyContainer context) {
26+
this.local = local;
27+
this.context = context;
28+
}
29+
30+
public boolean isNull(String k) {
31+
String val = OptionHelper.propertyLookup(k, local, context);
32+
return (val == null);
33+
}
34+
35+
public boolean isDefined(String k) {
36+
String val = OptionHelper.propertyLookup(k, local, context);
37+
return (val != null);
38+
}
39+
40+
public String p(String k) {
41+
return property(k);
42+
}
43+
44+
public String property(String k) {
45+
String val = OptionHelper.propertyLookup(k, local, context);
46+
if(val != null)
47+
return val;
48+
else
49+
return "";
50+
}
51+
}
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.core.spi;
15-
16-
/**
17-
* This class just makes it easier to identify locks associated with logback
18-
* when analysing thread dumps.
19-
*
20-
* @author Ceki G&uuml;c&uuml;
21-
*/
22-
public class LogbackLock extends Object {
23-
24-
25-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.core.spi;
15+
16+
/**
17+
* This class just makes it easier to identify locks associated with logback
18+
* when analysing thread dumps.
19+
*
20+
* @author Ceki G&uuml;c&uuml;
21+
*/
22+
public class LogbackLock extends Object {
23+
24+
25+
}
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.core.rolling;
15-
16-
import ch.qos.logback.core.Context;
17-
import ch.qos.logback.core.ContextBase;
18-
import org.junit.Before;
19-
import org.junit.Test;
20-
21-
import java.util.logging.Logger;
22-
23-
import static org.junit.Assert.assertEquals;
24-
25-
/**
26-
* @author Ceki G&uuml;c&uuml;
27-
*/
28-
public class TimeBasedFileNamingAndTriggeringPolicyBaseTest {
29-
30-
static long MILLIS_IN_MINUTE = 60*1000;
31-
32-
Context context = new ContextBase();
33-
RollingFileAppender rfa = new RollingFileAppender();
34-
TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy();
35-
DefaultTimeBasedFileNamingAndTriggeringPolicy timeBasedFNATP = new DefaultTimeBasedFileNamingAndTriggeringPolicy();
36-
37-
@Before
38-
public void setUp() {
39-
rfa.setContext(context);
40-
tbrp.setContext(context);
41-
timeBasedFNATP.setContext(context);
42-
43-
rfa.setRollingPolicy(tbrp);
44-
tbrp.setParent(rfa);
45-
tbrp.setTimeBasedFileNamingAndTriggeringPolicy(timeBasedFNATP);
46-
timeBasedFNATP.setTimeBasedRollingPolicy(tbrp);
47-
}
48-
49-
@Test
50-
public void singleDate() {
51-
// Tuesday December 20th 17:59:01 CET 2011
52-
long startTime = 1324400341553L;
53-
tbrp.setFileNamePattern("foo-%d{yyyy-MM'T'mm}.log");
54-
tbrp.start();
55-
56-
timeBasedFNATP.setCurrentTime(startTime);
57-
timeBasedFNATP.start();
58-
59-
timeBasedFNATP.setCurrentTime(startTime+MILLIS_IN_MINUTE);
60-
timeBasedFNATP.isTriggeringEvent(null, null);
61-
String elapsedPeriodsFileName = timeBasedFNATP.getElapsedPeriodsFileName();
62-
assertEquals("foo-2011-12T59.log", elapsedPeriodsFileName);
63-
}
64-
65-
// see "log rollover should be configurable using %d multiple times in file name pattern"
66-
// http://jira.qos.ch/browse/LBCORE-242
67-
68-
@Test
69-
public void multiDate() {
70-
// Tuesday December 20th 17:59:01 CET 2011
71-
long startTime = 1324400341553L;
72-
tbrp.setFileNamePattern("foo-%d{yyyy-MM, AUX}/%d{mm}.log");
73-
tbrp.start();
74-
75-
timeBasedFNATP.setCurrentTime(startTime);
76-
timeBasedFNATP.start();
77-
78-
timeBasedFNATP.setCurrentTime(startTime+MILLIS_IN_MINUTE);
79-
timeBasedFNATP.isTriggeringEvent(null, null);
80-
String elapsedPeriodsFileName = timeBasedFNATP.getElapsedPeriodsFileName();
81-
assertEquals("foo-2011-12/59.log", elapsedPeriodsFileName);
82-
}
83-
84-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.core.rolling;
15+
16+
import ch.qos.logback.core.Context;
17+
import ch.qos.logback.core.ContextBase;
18+
import org.junit.Before;
19+
import org.junit.Test;
20+
21+
import java.util.logging.Logger;
22+
23+
import static org.junit.Assert.assertEquals;
24+
25+
/**
26+
* @author Ceki G&uuml;c&uuml;
27+
*/
28+
public class TimeBasedFileNamingAndTriggeringPolicyBaseTest {
29+
30+
static long MILLIS_IN_MINUTE = 60*1000;
31+
32+
Context context = new ContextBase();
33+
RollingFileAppender rfa = new RollingFileAppender();
34+
TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy();
35+
DefaultTimeBasedFileNamingAndTriggeringPolicy timeBasedFNATP = new DefaultTimeBasedFileNamingAndTriggeringPolicy();
36+
37+
@Before
38+
public void setUp() {
39+
rfa.setContext(context);
40+
tbrp.setContext(context);
41+
timeBasedFNATP.setContext(context);
42+
43+
rfa.setRollingPolicy(tbrp);
44+
tbrp.setParent(rfa);
45+
tbrp.setTimeBasedFileNamingAndTriggeringPolicy(timeBasedFNATP);
46+
timeBasedFNATP.setTimeBasedRollingPolicy(tbrp);
47+
}
48+
49+
@Test
50+
public void singleDate() {
51+
// Tuesday December 20th 17:59:01 CET 2011
52+
long startTime = 1324400341553L;
53+
tbrp.setFileNamePattern("foo-%d{yyyy-MM'T'mm}.log");
54+
tbrp.start();
55+
56+
timeBasedFNATP.setCurrentTime(startTime);
57+
timeBasedFNATP.start();
58+
59+
timeBasedFNATP.setCurrentTime(startTime+MILLIS_IN_MINUTE);
60+
timeBasedFNATP.isTriggeringEvent(null, null);
61+
String elapsedPeriodsFileName = timeBasedFNATP.getElapsedPeriodsFileName();
62+
assertEquals("foo-2011-12T59.log", elapsedPeriodsFileName);
63+
}
64+
65+
// see "log rollover should be configurable using %d multiple times in file name pattern"
66+
// http://jira.qos.ch/browse/LBCORE-242
67+
68+
@Test
69+
public void multiDate() {
70+
// Tuesday December 20th 17:59:01 CET 2011
71+
long startTime = 1324400341553L;
72+
tbrp.setFileNamePattern("foo-%d{yyyy-MM, AUX}/%d{mm}.log");
73+
tbrp.start();
74+
75+
timeBasedFNATP.setCurrentTime(startTime);
76+
timeBasedFNATP.start();
77+
78+
timeBasedFNATP.setCurrentTime(startTime+MILLIS_IN_MINUTE);
79+
timeBasedFNATP.isTriggeringEvent(null, null);
80+
String elapsedPeriodsFileName = timeBasedFNATP.getElapsedPeriodsFileName();
81+
assertEquals("foo-2011-12/59.log", elapsedPeriodsFileName);
82+
}
83+
84+
}
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
/**
2-
* Logback: the reliable, generic, fast and flexible logging framework.
3-
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4-
*
5-
* This program and the accompanying materials are dual-licensed under
6-
* either the terms of the Eclipse Public License v1.0 as published by
7-
* the Eclipse Foundation
8-
*
9-
* or (per the licensee's choosing)
10-
*
11-
* under the terms of the GNU Lesser General Public License version 2.1
12-
* as published by the Free Software Foundation.
13-
*/
14-
package ch.qos.logback.core.testUtil;
15-
16-
import ch.qos.logback.core.util.CoreTestConstants;
17-
18-
import java.io.File;
19-
20-
import static junit.framework.Assert.assertTrue;
21-
22-
/**
23-
* @author Ceki G&uuml;c&uuml;
24-
*/
25-
public class FileTestUtil {
26-
27-
public static void makeTestOutputDir() {
28-
File target = new File(CoreTestConstants.TARGET_DIR);
29-
if(target.exists() && target.isDirectory()) {
30-
File testoutput = new File(CoreTestConstants.OUTPUT_DIR_PREFIX);
31-
if(!testoutput.exists())
32-
assertTrue(testoutput.mkdir());
33-
} else {
34-
throw new IllegalStateException(CoreTestConstants.TARGET_DIR + " does not exist");
35-
}
36-
}
37-
}
1+
/**
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
package ch.qos.logback.core.testUtil;
15+
16+
import ch.qos.logback.core.util.CoreTestConstants;
17+
18+
import java.io.File;
19+
20+
import static junit.framework.Assert.assertTrue;
21+
22+
/**
23+
* @author Ceki G&uuml;c&uuml;
24+
*/
25+
public class FileTestUtil {
26+
27+
public static void makeTestOutputDir() {
28+
File target = new File(CoreTestConstants.TARGET_DIR);
29+
if(target.exists() && target.isDirectory()) {
30+
File testoutput = new File(CoreTestConstants.OUTPUT_DIR_PREFIX);
31+
if(!testoutput.exists())
32+
assertTrue(testoutput.mkdir());
33+
} else {
34+
throw new IllegalStateException(CoreTestConstants.TARGET_DIR + " does not exist");
35+
}
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -1,188 +1,188 @@
1-
package ch.qos.logback.core.rolling
2-
3-
/**
4-
* Logback: the reliable, generic, fast and flexible logging framework.
5-
* Copyright (C) 1999-2011, QOS.ch. All rights reserved.
6-
*
7-
* This program and the accompanying materials are dual-licensed under
8-
* either the terms of the Eclipse Public License v1.0 as published by
9-
* the Eclipse Foundation
10-
*
11-
* or (per the licensee's choosing)
12-
*
13-
* under the terms of the GNU Lesser General Public License version 2.1
14-
* as published by the Free Software Foundation.
15-
*/
16-
17-
import ch.qos.logback.core.encoder.EchoEncoder
18-
import ch.qos.logback.core.status.InfoStatus
19-
import java.util.Date
20-
import org.junit.{Ignore, Test}
21-
import org.junit.Before
22-
import java.io.File
23-
import ch.qos.logback.core.util.StatusPrinter
24-
25-
/**
26-
* @author Ceki G&uuml;c&uuml;
27-
*/
28-
class SizeAndTimeBasedFNATP_STest extends RollingScaffolding {
29-
private var sizeAndTimeBasedFNATP: SizeAndTimeBasedFNATP[AnyRef] = null
30-
private val rfa1: RollingFileAppender[AnyRef] = new RollingFileAppender[AnyRef]
31-
private val tbrp1: TimeBasedRollingPolicy[AnyRef] = new TimeBasedRollingPolicy[AnyRef]
32-
private val rfa2: RollingFileAppender[AnyRef] = new RollingFileAppender[AnyRef]
33-
private val tbrp2: TimeBasedRollingPolicy[AnyRef] = new TimeBasedRollingPolicy[AnyRef]
34-
35-
private val encoder: EchoEncoder[AnyRef] = new EchoEncoder[AnyRef]
36-
var fileSize = 0
37-
var fileIndexCounter = 0
38-
var sizeThreshold = 0
39-
40-
@Before
41-
def setUp() {
42-
setUpScaffolding
43-
}
44-
45-
private def initRollingFileAppender(rfa: RollingFileAppender[AnyRef], filename: String): Unit = {
46-
rfa.setContext(context)
47-
rfa.setEncoder(encoder)
48-
if (filename != null) {
49-
rfa.setFile(filename)
50-
}
51-
}
52-
53-
private def initPolicies(rfa: RollingFileAppender[AnyRef], tbrp: TimeBasedRollingPolicy[AnyRef], filenamePattern: String, sizeThreshold: Int, givenTime: Long, lastCheck: Long): Unit = {
54-
sizeAndTimeBasedFNATP = new SizeAndTimeBasedFNATP[AnyRef]
55-
tbrp.setContext(context)
56-
sizeAndTimeBasedFNATP.setMaxFileSize("" + sizeThreshold)
57-
tbrp.setTimeBasedFileNamingAndTriggeringPolicy(sizeAndTimeBasedFNATP)
58-
tbrp.setFileNamePattern(filenamePattern)
59-
tbrp.setParent(rfa)
60-
tbrp.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(givenTime)
61-
rfa.setRollingPolicy(tbrp)
62-
tbrp.start
63-
rfa.start
64-
}
65-
66-
private def addExpectedFileNamedIfItsTime(randomOutputDir: String, testId: String, msg: String, compressionSuffix: String) {
67-
fileSize = fileSize + msg.getBytes.length
68-
if (passThresholdTime(nextRolloverThreshold)) {
69-
fileIndexCounter = 0
70-
fileSize = 0
71-
addExpectedFileName_ByFileIndexCounter(randomOutputDir, testId, getMillisOfCurrentPeriodsStart, fileIndexCounter, compressionSuffix)
72-
recomputeRolloverThreshold(currentTime)
73-
return
74-
}
75-
76-
// windows can delay file size changes, so we only allow for
77-
// fileIndexCounter 0
78-
if ((fileIndexCounter < 1) && fileSize > sizeThreshold) {
79-
addExpectedFileName_ByFileIndexCounter(randomOutputDir, testId, getMillisOfCurrentPeriodsStart, fileIndexCounter, compressionSuffix)
80-
fileIndexCounter = fileIndexCounter + 1
81-
fileSize = 0
82-
}
83-
}
84-
85-
def generic(testId: String, stem: String, withSecondPhase: Boolean, compressionSuffix: String = "") {
86-
var file = if (stem != null) randomOutputDir + stem else null
87-
initRollingFileAppender(rfa1, file)
88-
sizeThreshold = 300
89-
initPolicies(rfa1, tbrp1, randomOutputDir + testId + "-%d{" + DATE_PATTERN_WITH_SECONDS + "}-%i.txt"+compressionSuffix, sizeThreshold, currentTime, 0)
90-
addExpectedFileName_ByFileIndexCounter(randomOutputDir, testId, getMillisOfCurrentPeriodsStart, fileIndexCounter, compressionSuffix)
91-
incCurrentTime(100)
92-
tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime)
93-
var runLength: Int = 100
94-
var prefix: String = "Hello -----------------"
95-
96-
for (i <- 0 until runLength) {
97-
var msg: String = prefix + i
98-
rfa1.doAppend(msg)
99-
addExpectedFileNamedIfItsTime(randomOutputDir, testId, msg, compressionSuffix)
100-
incCurrentTime(20)
101-
tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime)
102-
}
103-
104-
105-
if(withSecondPhase) {
106-
secondPhase
107-
runLength = runLength*2
108-
}
109-
110-
if (stem != null)
111-
massageExpectedFilesToCorresponToCurrentTarget(file, true)
112-
113-
Thread.sleep(20)
114-
// wait for compression to finish
115-
if(tbrp1.future != null) {
116-
tbrp1.future.get()
117-
}
118-
119-
StatusPrinter.print(context)
120-
expectedFilenameList.foreach(println(_))
121-
existenceCheck(expectedFilenameList)
122-
sortedContentCheck(randomOutputDir, runLength, prefix)
123-
124-
def secondPhase() {
125-
rfa1.stop();
126-
127-
if(stem != null) {
128-
val f = new File(file);
129-
f.setLastModified(currentTime);
130-
}
131-
132-
sm.add(new InfoStatus("Time when rfa1 is stopped: " + new Date(currentTime), this));
133-
sm.add(new InfoStatus("currentTime%1000=" + (currentTime % 1000), this));
134-
135-
initRollingFileAppender(rfa2, file);
136-
initPolicies(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
137-
+ DATE_PATTERN_WITH_SECONDS + "}-%i.txt"+compressionSuffix, sizeThreshold, currentTime, 0);
138-
139-
for (i <- runLength until runLength * 2) {
140-
incCurrentTime(100);
141-
tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
142-
var msg = prefix + i
143-
rfa2.doAppend(msg);
144-
addExpectedFileNamedIfItsTime(randomOutputDir, testId, msg, compressionSuffix);
145-
}
146-
}
147-
}
148-
149-
val FIRST_PHASE_ONLY = false
150-
val WITH_SECOND_PHASE = true
151-
152-
@Test
153-
def noCompression_FileSet_NoRestart_1 {
154-
generic("test1", "toto.log", FIRST_PHASE_ONLY)
155-
}
156-
157-
@Test
158-
def noCompression_FileBlank_NoRestart_2 {
159-
generic("test2", null, FIRST_PHASE_ONLY)
160-
}
161-
162-
@Test
163-
def noCompression_FileBlank_WithStopStart_3 {
164-
generic("test3", null, WITH_SECOND_PHASE)
165-
}
166-
167-
@Test
168-
def noCompression_FileSet_WithStopStart_4 {
169-
generic("test4", "test4.log", WITH_SECOND_PHASE)
170-
}
171-
172-
@Test
173-
def withGZCompression_FileSet_NoRestart_5 {
174-
generic("test5", "toto.log", FIRST_PHASE_ONLY, ".gz")
175-
}
176-
177-
@Test
178-
def withGZCompression_FileBlank_NoRestart_6 {
179-
generic("test6", null, FIRST_PHASE_ONLY, ".gz")
180-
}
181-
182-
@Test
183-
def withZipCompression_FileSet_NoRestart_7 {
184-
generic("test7", "toto.log", FIRST_PHASE_ONLY, ".zip")
185-
checkZipEntryMatchesZipFilename(expectedFilenameList.filter(_.endsWith(".zip")), "test7-20\\d{2}-\\d{2}-\\d{2}_\\d{2}_\\d{2}_\\d{2}-\\d")
186-
187-
}
188-
}
1+
package ch.qos.logback.core.rolling
2+
3+
/**
4+
* Logback: the reliable, generic, fast and flexible logging framework.
5+
* Copyright (C) 1999-2011, QOS.ch. All rights reserved.
6+
*
7+
* This program and the accompanying materials are dual-licensed under
8+
* either the terms of the Eclipse Public License v1.0 as published by
9+
* the Eclipse Foundation
10+
*
11+
* or (per the licensee's choosing)
12+
*
13+
* under the terms of the GNU Lesser General Public License version 2.1
14+
* as published by the Free Software Foundation.
15+
*/
16+
17+
import ch.qos.logback.core.encoder.EchoEncoder
18+
import ch.qos.logback.core.status.InfoStatus
19+
import java.util.Date
20+
import org.junit.{Ignore, Test}
21+
import org.junit.Before
22+
import java.io.File
23+
import ch.qos.logback.core.util.StatusPrinter
24+
25+
/**
26+
* @author Ceki G&uuml;c&uuml;
27+
*/
28+
class SizeAndTimeBasedFNATP_STest extends RollingScaffolding {
29+
private var sizeAndTimeBasedFNATP: SizeAndTimeBasedFNATP[AnyRef] = null
30+
private val rfa1: RollingFileAppender[AnyRef] = new RollingFileAppender[AnyRef]
31+
private val tbrp1: TimeBasedRollingPolicy[AnyRef] = new TimeBasedRollingPolicy[AnyRef]
32+
private val rfa2: RollingFileAppender[AnyRef] = new RollingFileAppender[AnyRef]
33+
private val tbrp2: TimeBasedRollingPolicy[AnyRef] = new TimeBasedRollingPolicy[AnyRef]
34+
35+
private val encoder: EchoEncoder[AnyRef] = new EchoEncoder[AnyRef]
36+
var fileSize = 0
37+
var fileIndexCounter = 0
38+
var sizeThreshold = 0
39+
40+
@Before
41+
def setUp() {
42+
setUpScaffolding
43+
}
44+
45+
private def initRollingFileAppender(rfa: RollingFileAppender[AnyRef], filename: String): Unit = {
46+
rfa.setContext(context)
47+
rfa.setEncoder(encoder)
48+
if (filename != null) {
49+
rfa.setFile(filename)
50+
}
51+
}
52+
53+
private def initPolicies(rfa: RollingFileAppender[AnyRef], tbrp: TimeBasedRollingPolicy[AnyRef], filenamePattern: String, sizeThreshold: Int, givenTime: Long, lastCheck: Long): Unit = {
54+
sizeAndTimeBasedFNATP = new SizeAndTimeBasedFNATP[AnyRef]
55+
tbrp.setContext(context)
56+
sizeAndTimeBasedFNATP.setMaxFileSize("" + sizeThreshold)
57+
tbrp.setTimeBasedFileNamingAndTriggeringPolicy(sizeAndTimeBasedFNATP)
58+
tbrp.setFileNamePattern(filenamePattern)
59+
tbrp.setParent(rfa)
60+
tbrp.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(givenTime)
61+
rfa.setRollingPolicy(tbrp)
62+
tbrp.start
63+
rfa.start
64+
}
65+
66+
private def addExpectedFileNamedIfItsTime(randomOutputDir: String, testId: String, msg: String, compressionSuffix: String) {
67+
fileSize = fileSize + msg.getBytes.length
68+
if (passThresholdTime(nextRolloverThreshold)) {
69+
fileIndexCounter = 0
70+
fileSize = 0
71+
addExpectedFileName_ByFileIndexCounter(randomOutputDir, testId, getMillisOfCurrentPeriodsStart, fileIndexCounter, compressionSuffix)
72+
recomputeRolloverThreshold(currentTime)
73+
return
74+
}
75+
76+
// windows can delay file size changes, so we only allow for
77+
// fileIndexCounter 0
78+
if ((fileIndexCounter < 1) && fileSize > sizeThreshold) {
79+
addExpectedFileName_ByFileIndexCounter(randomOutputDir, testId, getMillisOfCurrentPeriodsStart, fileIndexCounter, compressionSuffix)
80+
fileIndexCounter = fileIndexCounter + 1
81+
fileSize = 0
82+
}
83+
}
84+
85+
def generic(testId: String, stem: String, withSecondPhase: Boolean, compressionSuffix: String = "") {
86+
var file = if (stem != null) randomOutputDir + stem else null
87+
initRollingFileAppender(rfa1, file)
88+
sizeThreshold = 300
89+
initPolicies(rfa1, tbrp1, randomOutputDir + testId + "-%d{" + DATE_PATTERN_WITH_SECONDS + "}-%i.txt"+compressionSuffix, sizeThreshold, currentTime, 0)
90+
addExpectedFileName_ByFileIndexCounter(randomOutputDir, testId, getMillisOfCurrentPeriodsStart, fileIndexCounter, compressionSuffix)
91+
incCurrentTime(100)
92+
tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime)
93+
var runLength: Int = 100
94+
var prefix: String = "Hello -----------------"
95+
96+
for (i <- 0 until runLength) {
97+
var msg: String = prefix + i
98+
rfa1.doAppend(msg)
99+
addExpectedFileNamedIfItsTime(randomOutputDir, testId, msg, compressionSuffix)
100+
incCurrentTime(20)
101+
tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime)
102+
}
103+
104+
105+
if(withSecondPhase) {
106+
secondPhase
107+
runLength = runLength*2
108+
}
109+
110+
if (stem != null)
111+
massageExpectedFilesToCorresponToCurrentTarget(file, true)
112+
113+
Thread.sleep(20)
114+
// wait for compression to finish
115+
if(tbrp1.future != null) {
116+
tbrp1.future.get()
117+
}
118+
119+
StatusPrinter.print(context)
120+
expectedFilenameList.foreach(println(_))
121+
existenceCheck(expectedFilenameList)
122+
sortedContentCheck(randomOutputDir, runLength, prefix)
123+
124+
def secondPhase() {
125+
rfa1.stop();
126+
127+
if(stem != null) {
128+
val f = new File(file);
129+
f.setLastModified(currentTime);
130+
}
131+
132+
sm.add(new InfoStatus("Time when rfa1 is stopped: " + new Date(currentTime), this));
133+
sm.add(new InfoStatus("currentTime%1000=" + (currentTime % 1000), this));
134+
135+
initRollingFileAppender(rfa2, file);
136+
initPolicies(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
137+
+ DATE_PATTERN_WITH_SECONDS + "}-%i.txt"+compressionSuffix, sizeThreshold, currentTime, 0);
138+
139+
for (i <- runLength until runLength * 2) {
140+
incCurrentTime(100);
141+
tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
142+
var msg = prefix + i
143+
rfa2.doAppend(msg);
144+
addExpectedFileNamedIfItsTime(randomOutputDir, testId, msg, compressionSuffix);
145+
}
146+
}
147+
}
148+
149+
val FIRST_PHASE_ONLY = false
150+
val WITH_SECOND_PHASE = true
151+
152+
@Test
153+
def noCompression_FileSet_NoRestart_1 {
154+
generic("test1", "toto.log", FIRST_PHASE_ONLY)
155+
}
156+
157+
@Test
158+
def noCompression_FileBlank_NoRestart_2 {
159+
generic("test2", null, FIRST_PHASE_ONLY)
160+
}
161+
162+
@Test
163+
def noCompression_FileBlank_WithStopStart_3 {
164+
generic("test3", null, WITH_SECOND_PHASE)
165+
}
166+
167+
@Test
168+
def noCompression_FileSet_WithStopStart_4 {
169+
generic("test4", "test4.log", WITH_SECOND_PHASE)
170+
}
171+
172+
@Test
173+
def withGZCompression_FileSet_NoRestart_5 {
174+
generic("test5", "toto.log", FIRST_PHASE_ONLY, ".gz")
175+
}
176+
177+
@Test
178+
def withGZCompression_FileBlank_NoRestart_6 {
179+
generic("test6", null, FIRST_PHASE_ONLY, ".gz")
180+
}
181+
182+
@Test
183+
def withZipCompression_FileSet_NoRestart_7 {
184+
generic("test7", "toto.log", FIRST_PHASE_ONLY, ".zip")
185+
checkZipEntryMatchesZipFilename(expectedFilenameList.filter(_.endsWith(".zip")), "test7-20\\d{2}-\\d{2}-\\d{2}_\\d{2}_\\d{2}_\\d{2}-\\d")
186+
187+
}
188+
}

‎logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala

+208-208
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.