[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-52-g650b734
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Wed Mar 3 09:02:02 CET 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 650b73413e7b5aa4b0ef2fb59f0e3187c68b0554 (commit)
from 90e50c2f25dcacd6455af8baac5d8cfe6cf10f94 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=650b73413e7b5aa4b0ef2fb59f0e3187c68b0554
http://github.com/ceki/logback/commit/650b73413e7b5aa4b0ef2fb59f0e3187c68b0554
commit 650b73413e7b5aa4b0ef2fb59f0e3187c68b0554
Author: Ceki Gulcu <ceki at qos.ch>
Date: Wed Mar 3 09:00:43 2010 +0100
- Replaced uses of TeztConstants.TEST_DIR_PREFIX with
ClassicTestConstants.JORAN_INPUT_PREFIX
- added getFile method to ResilientFileOutputStream
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
index 9f4cf27..e2852b9 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
@@ -30,7 +30,6 @@ import ch.qos.logback.classic.pattern.ConverterTest;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.classic.testUtil.SampleConverter;
-import ch.qos.logback.classic.util.TeztConstants;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.pattern.PatternLayoutBase;
@@ -167,7 +166,7 @@ public class PatternLayoutTest extends AbstractPatternLayoutBaseTest {
@Test
public void testConversionRuleSupportInPatternLayout() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conversionRule/patternLayout0.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "conversionRule/patternLayout0.xml");
root.getAppender("LIST");
String msg = "Simon says";
logger.debug(msg);
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/encoder/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/encoder/PackageTest.java
index b17a9ff..deb29c8 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/encoder/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/encoder/PackageTest.java
@@ -18,6 +18,6 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
- at SuiteClasses(PatternLayoutEncoderTest.class)
+ at SuiteClasses( { PatternLayoutEncoderTest.class, LayoutInsteadOfEncoderTest.class})
public class PackageTest {
}
\ No newline at end of file
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
index f1ee47c..8c9cd2e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
@@ -40,7 +40,6 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.classic.spi.StackTraceElementProxy;
import ch.qos.logback.classic.spi.ThrowableProxy;
-import ch.qos.logback.classic.util.TeztConstants;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.testUtil.StringListAppender;
@@ -236,8 +235,8 @@ public class HTMLLayoutTest {
@Test
public void testConversionRuleSupportInHtmlLayout() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX
- + "input/joran/conversionRule/htmlLayout0.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+ + "conversionRule/htmlLayout0.xml");
root.getAppender("LIST");
String msg = "Simon says";
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/joran/EvaluatorJoranTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/joran/EvaluatorJoranTest.java
index 1fe7fa5..8f2da32 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/joran/EvaluatorJoranTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/joran/EvaluatorJoranTest.java
@@ -23,13 +23,13 @@ import org.junit.Test;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
+import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.boolex.JaninoEventEvaluator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
-import ch.qos.logback.classic.util.TeztConstants;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.boolex.EvaluationException;
import ch.qos.logback.core.joran.spi.JoranException;
@@ -42,7 +42,7 @@ public class EvaluatorJoranTest {
JoranConfigurator jc = new JoranConfigurator();
LoggerContext loggerContext = new LoggerContext();
jc.setContext(loggerContext);
- jc.doConfigure(TeztConstants.TEST_DIR_PREFIX + "input/joran/simpleEvaluator.xml");
+ jc.doConfigure(ClassicTestConstants.JORAN_INPUT_PREFIX + "simpleEvaluator.xml");
Map evalMap = (Map) loggerContext.getObject(CoreConstants.EVALUATOR_MAP);
@@ -63,7 +63,7 @@ public class EvaluatorJoranTest {
JoranConfigurator jc = new JoranConfigurator();
LoggerContext loggerContext = new LoggerContext();
jc.setContext(loggerContext);
- jc.doConfigure(TeztConstants.TEST_DIR_PREFIX + "input/joran/ignore.xml");
+ jc.doConfigure(ClassicTestConstants.JORAN_INPUT_PREFIX + "ignore.xml");
Map evalMap = (Map) loggerContext.getObject(CoreConstants.EVALUATOR_MAP);
assertNotNull(evalMap);
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
index 58b3855..5b495f5 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
@@ -25,6 +25,7 @@ import java.util.Date;
import org.junit.Test;
import org.slf4j.MDC;
+import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
@@ -32,7 +33,6 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.turbo.DebugUsersTurboFilter;
import ch.qos.logback.classic.turbo.NOPTurboFilter;
import ch.qos.logback.classic.turbo.TurboFilter;
-import ch.qos.logback.classic.util.TeztConstants;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.read.ListAppender;
@@ -53,7 +53,7 @@ public class JoranConfiguratorTest {
@Test
public void simpleList() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/simpleList.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "simpleList.xml");
Logger logger = loggerContext.getLogger(this.getClass().getName());
Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
@@ -68,7 +68,7 @@ public class JoranConfiguratorTest {
@Test
public void level() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/simpleLevel.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "simpleLevel.xml");
ListAppender listAppender = (ListAppender) root.getAppender("LIST");
assertEquals(0, listAppender.list.size());
String msg = "hello world";
@@ -77,13 +77,12 @@ public class JoranConfiguratorTest {
}
@Test
- public void rootLoggerLevelSettingBySystemProperty()
- throws JoranException {
+ public void rootLoggerLevelSettingBySystemProperty() throws JoranException {
String propertyName = "logback.level";
System.setProperty(propertyName, "INFO");
- configure(TeztConstants.TEST_DIR_PREFIX
- + "input/joran/rootLevelByProperty.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+ + "rootLevelByProperty.xml");
// StatusPrinter.print(loggerContext);
ListAppender listAppender = (ListAppender) root.getAppender("LIST");
assertEquals(0, listAppender.list.size());
@@ -98,8 +97,8 @@ public class JoranConfiguratorTest {
String propertyName = "logback.level";
System.setProperty(propertyName, "DEBUG");
- configure(TeztConstants.TEST_DIR_PREFIX
- + "input/joran/loggerLevelByProperty.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+ + "loggerLevelByProperty.xml");
// StatusPrinter.print(loggerContext);
ListAppender listAppender = (ListAppender) root.getAppender("LIST");
assertEquals(0, listAppender.list.size());
@@ -111,20 +110,20 @@ public class JoranConfiguratorTest {
@Test
public void statusListener() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/statusListener.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "statusListener.xml");
// StatusPrinter.print(loggerContext);
}
@Test
public void contextRename() throws JoranException {
loggerContext.setName(CoreConstants.DEFAULT_CONTEXT_NAME);
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/contextRename.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "contextRename.xml");
assertEquals("wombat", loggerContext.getName());
}
@Test
public void eval() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/callerData.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "callerData.xml");
String msg = "hello world";
logger.debug("toto");
@@ -146,7 +145,7 @@ public class JoranConfiguratorTest {
// Although this test uses turbo filters, it only checks
// that Joran can see the xml element and create
// and place the relevant object correctly.
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/turbo.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "turbo.xml");
TurboFilter filter = loggerContext.getTurboFilterList().get(0);
assertTrue(filter instanceof NOPTurboFilter);
@@ -158,7 +157,7 @@ public class JoranConfiguratorTest {
// that Joran can see <user> elements, and behave correctly
// that is call the addUser method and pass the correct values
// to that method.
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/turbo2.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "turbo2.xml");
// StatusPrinter.print(loggerContext.getStatusManager());
@@ -170,7 +169,7 @@ public class JoranConfiguratorTest {
@Test
public void testLevelFilter() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/levelFilter.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "levelFilter.xml");
// StatusPrinter.print(loggerContext);
@@ -190,7 +189,7 @@ public class JoranConfiguratorTest {
@Test
public void testEvaluatorFilter() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/evaluatorFilter.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "evaluatorFilter.xml");
// StatusPrinter.print(loggerContext);
@@ -210,8 +209,8 @@ public class JoranConfiguratorTest {
@Test
public void testTurboDynamicThreshold() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX
- + "input/joran/turboDynamicThreshold.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+ + "turboDynamicThreshold.xml");
ListAppender listAppender = (ListAppender) root.getAppender("LIST");
assertEquals(0, listAppender.list.size());
@@ -230,8 +229,8 @@ public class JoranConfiguratorTest {
@Test
public void testTurboDynamicThreshold2() throws JoranException {
- configure(TeztConstants.TEST_DIR_PREFIX
- + "input/joran/turboDynamicThreshold2.xml");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+ + "turboDynamicThreshold2.xml");
ListAppender listAppender = (ListAppender) root.getAppender("LIST");
assertEquals(0, listAppender.list.size());
@@ -257,8 +256,8 @@ public class JoranConfiguratorTest {
@Test
public void scan1() throws JoranException, IOException, InterruptedException {
- String configFileAsStr = TeztConstants.TEST_DIR_PREFIX
- + "input/joran/scan1.xml";
+ String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX
+ + "scan1.xml";
configure(configFileAsStr);
File file = new File(configFileAsStr);
@@ -275,19 +274,20 @@ public class JoranConfiguratorTest {
assertTrue(checker.isErrorFree());
assertTrue(checker.containsMatch("Resetting and reconfiguring context"));
}
-
+
@Test
- public void timestamp() throws JoranException, IOException, InterruptedException {
+ public void timestamp() throws JoranException, IOException,
+ InterruptedException {
- String configFileAsStr = TeztConstants.TEST_DIR_PREFIX
- + "input/joran/timestamp.xml";
+ String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX
+ + "timestamp.xml";
configure(configFileAsStr);
-
+
String r = loggerContext.getProperty("testTimestamp");
assertNotNull(r);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
- String expected = sdf.format(new Date());
- assertEquals("expected \""+expected+"\" but got "+r, expected, r);
+ String expected = sdf.format(new Date());
+ assertEquals("expected \"" + expected + "\" but got " + r, expected, r);
}
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
index e368a4d..16b2bb3 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
@@ -29,6 +29,7 @@ import org.junit.Before;
import org.junit.Test;
import org.slf4j.MDC;
+import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.PatternLayout;
@@ -36,7 +37,6 @@ import ch.qos.logback.classic.html.HTMLLayout;
import ch.qos.logback.classic.html.XHTMLEntityResolver;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.classic.util.TeztConstants;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.Layout;
import ch.qos.logback.core.joran.spi.JoranException;
@@ -54,7 +54,7 @@ public class SMTPAppender_GreenTest {
SMTPAppender smtpAppender;
LoggerContext lc = new LoggerContext();
Logger logger = lc.getLogger(this.getClass());
-
+
static final String TEST_SUBJECT = "test subject";
static final String HEADER = "HEADER\n";
static final String FOOTER = "FOOTER\n";
@@ -69,12 +69,11 @@ public class SMTPAppender_GreenTest {
// let the grean mail server get a head start
Thread.sleep(100);
}
-
+
@After
public void tearDown() throws Exception {
greenMail.stop();
}
-
void buildSMTPAppender() throws Exception {
smtpAppender = new SMTPAppender();
@@ -108,9 +107,8 @@ public class SMTPAppender_GreenTest {
return layout;
}
-
-
- private MimeMultipart verify(String subject) throws MessagingException, IOException {
+ private MimeMultipart verify(String subject) throws MessagingException,
+ IOException {
MimeMessage[] mma = greenMail.getReceivedMessages();
assertNotNull(mma);
assertEquals(1, mma.length);
@@ -128,9 +126,9 @@ public class SMTPAppender_GreenTest {
logger.addAppender(smtpAppender);
logger.debug("hello");
logger.error("en error", new Exception("an exception"));
-
+
StatusPrinter.print(lc);
- MimeMultipart mp = verify(TEST_SUBJECT);
+ MimeMultipart mp = verify(TEST_SUBJECT);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
assertTrue(body.startsWith(HEADER.trim()));
assertTrue(body.endsWith(FOOTER.trim()));
@@ -146,15 +144,14 @@ public class SMTPAppender_GreenTest {
logger.debug("hello");
MDC.clear();
logger.error("en error", new Exception("an exception"));
-
- MimeMultipart mp = verify(TEST_SUBJECT);
+
+ MimeMultipart mp = verify(TEST_SUBJECT);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
assertTrue(body.startsWith(HEADER.trim()));
assertTrue(body.contains("key=val"));
assertTrue(body.endsWith(FOOTER.trim()));
}
-
@Test
public void html() throws Exception {
buildSMTPAppender();
@@ -163,8 +160,8 @@ public class SMTPAppender_GreenTest {
logger.addAppender(smtpAppender);
logger.debug("hello");
logger.error("en error", new Exception("an exception"));
- MimeMultipart mp = verify(TEST_SUBJECT);
-
+ MimeMultipart mp = verify(TEST_SUBJECT);
+
// verify strict adherence to xhtml1-strict.dtd
SAXReader reader = new SAXReader();
reader.setValidation(true);
@@ -190,9 +187,9 @@ public class SMTPAppender_GreenTest {
logger.debug("hello " + i);
}
logger.error("en error", new Exception("an exception"));
-
- MimeMultipart mp = verify(TEST_SUBJECT);
-
+
+ MimeMultipart mp = verify(TEST_SUBJECT);
+
// verify strict adherence to xhtml1-strict.dtd
SAXReader reader = new SAXReader();
reader.setValidation(true);
@@ -203,21 +200,21 @@ public class SMTPAppender_GreenTest {
private void configure(String file) throws JoranException {
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(lc);
- System.out.println("port="+port);
+ System.out.println("port=" + port);
lc.putProperty("port", "" + port);
jc.doConfigure(file);
}
@Test
- public void testCustomEvaluator() throws Exception {
- configure(TeztConstants.TEST_DIR_PREFIX
- + "input/joran/smtp/customEvaluator.xml");
-
+ public void testCustomEvaluator() throws Exception {
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+ + "smtp/customEvaluator.xml");
+
logger.debug("hello");
String msg2 = "world";
logger.debug(msg2);
logger.debug("invisible");
- MimeMultipart mp = verify(this.getClass().getName()+ " - "+msg2);
+ MimeMultipart mp = verify(this.getClass().getName() + " - " + msg2);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
assertEquals("helloworld", body);
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java
index 80333cd..b7ce5da 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java
@@ -22,13 +22,13 @@ import java.util.List;
import org.junit.Test;
import org.slf4j.MDC;
+import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
-import ch.qos.logback.classic.util.TeztConstants;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.read.ListAppender;
import ch.qos.logback.core.sift.AppenderTracker;
@@ -37,7 +37,7 @@ import ch.qos.logback.core.util.StatusPrinter;
public class SiftingAppenderTest {
- static String PREFIX = TeztConstants.TEST_DIR_PREFIX + "input/joran/sift/";
+ static String PREFIX = ClassicTestConstants.JORAN_INPUT_PREFIX + "sift/";
LoggerContext loggerContext = new LoggerContext();
Logger logger = loggerContext.getLogger(this.getClass().getName());
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
index 9b56d6f..e7edcc6 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
@@ -26,12 +26,12 @@ import org.junit.Before;
import org.junit.Test;
import org.slf4j.helpers.BogoPerf;
+import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.issue.lbclassic135.LoggingRunnable;
import ch.qos.logback.classic.joran.JoranConfigurator;
-import ch.qos.logback.classic.util.TeztConstants;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.contention.MultiThreadedHarness;
import ch.qos.logback.core.contention.RunnableWithCounterAndDone;
@@ -47,11 +47,11 @@ public class ReconfigureOnChangeTest {
// the space in the file name mandated by
// http://jira.qos.ch/browse/LBCORE-119
- final static String SCAN1_FILE_AS_STR = TeztConstants.TEST_DIR_PREFIX
- + "input/turbo/scan 1.xml";
+ final static String SCAN1_FILE_AS_STR = ClassicTestConstants.INPUT_PREFIX
+ + "turbo/scan 1.xml";
- final static String SCAN_LBCLASSIC_154_FILE_AS_STR = TeztConstants.TEST_DIR_PREFIX
- + "input/turbo/scan_lbclassic154.xml";
+ final static String SCAN_LBCLASSIC_154_FILE_AS_STR = ClassicTestConstants.INPUT_PREFIX
+ + "turbo/scan_lbclassic154.xml";
// it actually takes time for Windows to propagate file modification changes
// values below 100 milliseconds can be problematic the same propagation
@@ -83,6 +83,7 @@ public class ReconfigureOnChangeTest {
public void tearDown() {
System.out.println("======= TEST STOP");
}
+
void configure(File file) throws JoranException {
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(loggerContext);
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
index 4538c89..16a36c0 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
@@ -20,12 +20,12 @@ import java.net.MalformedURLException;
import org.junit.Before;
import org.junit.Test;
+import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.issue.lbclassic135.LoggingRunnable;
import ch.qos.logback.classic.joran.JoranConfigurator;
-import ch.qos.logback.classic.util.TeztConstants;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.contention.MultiThreadedHarness;
import ch.qos.logback.core.contention.RunnableWithCounterAndDone;
@@ -39,8 +39,8 @@ public class ReconfigurePerf {
// the space in the file name mandated by
// http://jira.qos.ch/browse/LBCORE-119
- final static String CONF_FILE_AS_STR = TeztConstants.TEST_DIR_PREFIX
- + "input/turbo/scan_perf.xml";
+ final static String CONF_FILE_AS_STR = ClassicTestConstants.INPUT_PREFIX
+ + "turbo/scan_perf.xml";
// it actually takes time for Windows to propagate file modification changes
// values below 100 milliseconds can be problematic the same propagation
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationTest.java
index e71b424..cfd81ca 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationTest.java
@@ -27,6 +27,7 @@ import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.LoggerFactory;
+import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.Appender;
@@ -85,10 +86,10 @@ public class InitializationTest {
@Test
public void autoConfigFromSystemProperties() throws JoranException {
- doAutoConfigFromSystemProperties(TeztConstants.TEST_DIR_PREFIX + "input/autoConfig.xml");
+ doAutoConfigFromSystemProperties(ClassicTestConstants.INPUT_PREFIX + "autoConfig.xml");
doAutoConfigFromSystemProperties("autoConfigAsResource.xml");
// test passing a URL. note the relative path syntax with file:src/test/...
- doAutoConfigFromSystemProperties("file:"+TeztConstants.TEST_DIR_PREFIX + "input/autoConfig.xml");
+ doAutoConfigFromSystemProperties("file:"+ClassicTestConstants.INPUT_PREFIX + "autoConfig.xml");
}
public void doAutoConfigFromSystemProperties(String val) throws JoranException {
@@ -104,7 +105,7 @@ public class InitializationTest {
System.setProperty(ContextInitializer.STATUS_LISTENER_CLASS, TrivialStatusListener.class.getName());
List<StatusListener> sll = lc.getStatusManager().getCopyOfStatusListenerList();
assertEquals(0, sll.size());
- doAutoConfigFromSystemProperties(TeztConstants.TEST_DIR_PREFIX + "input/autoConfig.xml");
+ doAutoConfigFromSystemProperties(ClassicTestConstants.INPUT_PREFIX + "autoConfig.xml");
sll = lc.getStatusManager().getCopyOfStatusListenerList();
assertTrue(sll.size() +" should be 1", sll.size() == 1);
}
@@ -114,7 +115,7 @@ public class InitializationTest {
System.setProperty(ContextInitializer.STATUS_LISTENER_CLASS, ContextInitializer.SYSOUT);
List<StatusListener> sll = lc.getStatusManager().getCopyOfStatusListenerList();
assertEquals(0, sll.size());
- doAutoConfigFromSystemProperties(TeztConstants.TEST_DIR_PREFIX + "input/autoConfig.xml");
+ doAutoConfigFromSystemProperties(ClassicTestConstants.INPUT_PREFIX + "autoConfig.xml");
sll = lc.getStatusManager().getCopyOfStatusListenerList();
assertTrue(sll.size() +" should be 1", sll.size() == 1);
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/TeztConstants.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/TeztConstants.java
deleted file mode 100644
index f92a75f..0000000
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/TeztConstants.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.classic.util;
-
-/**
- *
- * It seems to bother
- *
- * @author gulcu
- *
- */
-public class TeztConstants {
-
- public static final String TEST_DIR_PREFIX = "src/test/";
-
-
-}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java b/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
index c0c7b1f..373a917 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
@@ -19,6 +19,7 @@ import java.io.OutputStream;
import ch.qos.logback.core.encoder.Encoder;
import ch.qos.logback.core.spi.DeferredProcessingAware;
import ch.qos.logback.core.status.ErrorStatus;
+import static ch.qos.logback.core.CoreConstants.CODES_URL;
/**
* OutputStreamAppender appends events to a {@link OutputStream}. This class
@@ -31,6 +32,7 @@ import ch.qos.logback.core.status.ErrorStatus;
*/
public class OutputStreamAppender<E> extends UnsynchronizedAppenderBase<E> {
+
/**
* It is the encoder which is ultimately responsible for writing the event to
* an {@link OutputStream}.
@@ -87,6 +89,7 @@ public class OutputStreamAppender<E> extends UnsynchronizedAppenderBase<E> {
public void setLayout(Layout layout) {
addError("This appender no longer admits a layout as a sub-component, set an encoder instead.");
+ addError("See also "+CODES_URL+"#layoutInsteadOfEncoder for details");
}
@Override
@@ -171,7 +174,7 @@ public class OutputStreamAppender<E> extends UnsynchronizedAppenderBase<E> {
this.outputStream = outputStream;
if (encoder == null) {
- addWarn("Encoder not yet set. Cannot invoke it's init method");
+ addWarn("Encoder has not been set. Cannot invoke its init method.");
return;
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
index 0ae0343..59839c7 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
@@ -43,6 +43,11 @@ public class ResilientFileOutputStream extends OutputStream {
return fos.getChannel();
}
+
+ public File getFile() {
+ return file;
+ }
+
public void write(byte b[], int off, int len) throws IOException {
// existence of recoveryCoordinator indicates failed state
if (recoveryCoordinator != null && !presumedClean) {
@@ -101,5 +106,4 @@ public class ResilientFileOutputStream extends OutputStream {
fos = new FileOutputStream(file, true);
presumedClean = true;
}
-
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
index 215a7b3..ad4594e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
@@ -16,9 +16,9 @@ package ch.qos.logback.core.rolling;
import java.io.File;
import java.io.IOException;
+import static ch.qos.logback.core.CoreConstants.CODES_URL;
import ch.qos.logback.core.FileAppender;
import ch.qos.logback.core.rolling.helper.CompressionMode;
-
/**
* <code>RollingFileAppender</code> extends {@link FileAppender} to backup the
* log files depending on {@link RollingPolicy} and {@link TriggeringPolicy}.
@@ -46,7 +46,7 @@ public class RollingFileAppender<E> extends FileAppender<E> {
if (triggeringPolicy == null) {
addWarn("No TriggeringPolicy was set for the RollingFileAppender named "
+ getName());
- addWarn("For more information, please visit http://logback.qos.ch/codes.html#rfa_no_tp");
+ addWarn("For more information, please visit "+CODES_URL+"#rfa_no_tp");
return;
}
@@ -59,7 +59,7 @@ public class RollingFileAppender<E> extends FileAppender<E> {
if (rollingPolicy == null) {
addError("No RollingPolicy was set for the RollingFileAppender named "
+ getName());
- addError("For more information, please visit http://logback.qos.ch/codes.html#rfa_no_rp");
+ addError("For more information, please visit "+CODES_URL+"rfa_no_rp");
return;
}
@@ -85,7 +85,7 @@ public class RollingFileAppender<E> extends FileAppender<E> {
// allow setting the file name to null if mandated by prudent mode
if (file != null && ((triggeringPolicy != null) || (rollingPolicy != null))) {
addError("File property must be set before any triggeringPolicy or rollingPolicy properties");
- addError("Visit http://logback.qos.ch/codes.html#rfa_file_after for more information");
+ addError("Visit "+CODES_URL+"#rfa_file_after for more information");
}
super.setFile(file);
}
diff --git a/logback-core/src/test/input/joran/compatibility/layoutInsteadOfEncoder.xml b/logback-core/src/test/input/joran/compatibility/layoutInsteadOfEncoder.xml
deleted file mode 100644
index e69de29..0000000
diff --git a/logback-site/src/site/pages/codes.html b/logback-site/src/site/pages/codes.html
index c52a936..93c98de 100644
--- a/logback-site/src/site/pages/codes.html
+++ b/logback-site/src/site/pages/codes.html
@@ -8,13 +8,14 @@
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/_print.css" media="print" />
-
+ <link rel="stylesheet" type="text/css" href="css/prettify.css" />
</head>
- <body>
+ <body onload="prettyPrint()">
+ <script type="text/javascript" src="js/prettify.js"></script>
<script type="text/javascript">prefix='';</script>
+ <script src="templates/header.js" type="text/javascript"></script>
- <script src="templates/header.js" type="text/javascript"></script>
<div id="left">
<script src="templates/left.js" type="text/javascript"></script>
</div>
@@ -40,6 +41,77 @@
</p>
<hr/>
+ <!-- =========================================================== -->
+ <p>
+ <a name="layoutInsteadOfEncoder"
+ href="#layoutInsteadOfEncoder">This appender no longer admits a
+ layout as a sub-component, set an encoder instead.</a>
+ </p>
+
+ <p>As of logback version 0.9.19, the <code>WriterAppender</code>
+ class has been renamed as <code>OutputStreamAppender</code>, with
+ <code>FileAppender</code> now sub-classing the
+ latter. <code>OutputStreamAppender</code> and sub-classes now take
+ an <code>Encoder</code> as a sub-component instead of a
+ <code>Layout</code>.
+ </p>
+
+ <p>In practical terms, this means that configuration files need to
+ be changed</p>
+
+ <p class="red bold">from (BAD)</p>
+
+ <pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>testFile.log</file>
+ ...
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
+ </layout>
+ </appender> </pre>
+
+ <p class="red bold">or the shorter equivalent (BAD)</p>
+
+ <pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>testFile.log</file>
+ ...
+ <!-- layout are assigned the type
+ ch.qos.logback.classic.PatternLayout by default -->
+ <layout>
+ <pattern>%msg%n</pattern>
+ </layout>
+ </appender> </pre>
+
+
+ <p class="green bold">to (GOOD)</p>
+ <pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>testFile.log</file>
+ ...
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%msg%n</pattern>
+ </encode>
+ </appender> </pre>
+
+ <p class="green bold">or the shorter equivalent (GOOD)</p>
+
+ <pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>testFile.log</file>
+ ...
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%msg%n</pattern>
+ </encode>
+ </appender> </pre>
+
+
+ <p>We hope to make up for this inconvenience with cool new features
+ which are only possible using encoders.</p>
+
+ <hr/>
+
+
+ <!-- =========================================================== -->
+
<p>
<a name="socket_no_host" href="#socket_no_host">No remote host or
address is set for <code>SocketAppender</code>
@@ -51,12 +123,12 @@
as follows.
</p>
- <p class="source"><appender name="SOCKET"
+ <pre class="prettyprint source"><appender name="SOCKET"
class="ch.qos.logback.classic.net.SocketAppender">
...
<remoteHost>127.0.0.1</remoteHost>
...
-</appender></p>
+</appender></pre>
<hr />
@@ -73,11 +145,11 @@
like this:
</p>
- <p class="source"><appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender">
+ <pre class="prettyprint source"><appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender">
...
<port>4560</port>
...
-</appender></p>
+</appender></pre>
<hr />
@@ -97,13 +169,13 @@
as follows:
</p>
- <p class="source"><appender name="SMTP" class="ch.qos.logback.classic.net.SMTPAppender">
+ <pre class="prettyprint source"><appender name="SMTP" class="ch.qos.logback.classic.net.SMTPAppender">
...
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%date [%thread] %-5level %logger - %msg%n"></pattern>
</layout>
...
-</appender></p>
+</appender></pre>
<p>SMTPAppender is known to work well with <a
href="manual/layouts.html#ClassicPatternLayout">PatternLayout</a>
diff --git a/logback-site/src/site/pages/css/common.css b/logback-site/src/site/pages/css/common.css
index e1aa3ca..95db3c3 100644
--- a/logback-site/src/site/pages/css/common.css
+++ b/logback-site/src/site/pages/css/common.css
@@ -104,7 +104,7 @@ p.menu {
font-size: smaller;
}
-.strong {
+.strong, .bold {
/*font-size: 13px;*/
font-weight: bold;
}
diff --git a/logback-site/src/site/pages/documentation.html b/logback-site/src/site/pages/documentation.html
index 29f4e95..d02275e 100644
--- a/logback-site/src/site/pages/documentation.html
+++ b/logback-site/src/site/pages/documentation.html
@@ -39,6 +39,10 @@
<a href="faq.html">A Frequently Asked Questions list (FAQ)</a>
</li>
+ <li>
+ <a href="codes.html">Logback error codes and their meanings</a>
+ </li>
+
<li>
<a href="dependencies.html">Dependencies per module</a>
</li>
-----------------------------------------------------------------------
Summary of changes:
.../ch/qos/logback/classic/PatternLayoutTest.java | 3 +-
.../qos/logback/classic/encoder/PackageTest.java | 2 +-
.../qos/logback/classic/html/HTMLLayoutTest.java | 5 +-
.../logback/classic/joran/EvaluatorJoranTest.java | 6 +-
.../classic/joran/JoranConfiguratorTest.java | 58 ++++++------
.../classic/net/SMTPAppender_GreenTest.java | 43 +++++-----
.../logback/classic/sift/SiftingAppenderTest.java | 4 +-
.../classic/turbo/ReconfigureOnChangeTest.java | 11 ++-
.../qos/logback/classic/turbo/ReconfigurePerf.java | 6 +-
.../logback/classic/util/InitializationTest.java | 9 +-
.../ch/qos/logback/classic/util/TeztConstants.java | 28 ------
.../ch/qos/logback/core/OutputStreamAppender.java | 5 +-
.../core/recovery/ResilientFileOutputStream.java | 6 +-
.../logback/core/rolling/RollingFileAppender.java | 8 +-
logback-site/src/site/pages/codes.html | 90 ++++++++++++++++++--
logback-site/src/site/pages/css/common.css | 2 +-
logback-site/src/site/pages/documentation.html | 4 +
17 files changed, 171 insertions(+), 119 deletions(-)
delete mode 100644 logback-classic/src/test/java/ch/qos/logback/classic/util/TeztConstants.java
delete mode 100644 logback-core/src/test/input/joran/compatibility/layoutInsteadOfEncoder.xml
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
More information about the logback-dev
mailing list