logback-dev
Threads by month
- ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
November 2006
- 5 participants
- 262 discussions
Online report : http://localhost:8090/continuum/servlet/continuum/target/ProjectBuild.vm/vi…
Build statistics:
State: Failed
Previous State: Ok
Started at: Tue, 14 Nov 2006 16:20:58 +0100
Finished at: Tue, 14 Nov 2006 16:21:13 +0100
Total time: 14s
Build Trigger: Schedule
Exit code: 1
Building machine hostname: pixie
Operating system : Linux(unknown)
Java version : 1.5.0_08(Sun Microsystems Inc.)
Changes
seb SMTPAppenders now use an EventEvaluator.
Classic version uses a JaninoEventEvaluator with a given default expression.
Access version uses a class extending JaninoEventEvaluator to implement the correct behavior.
/logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/DefaultSMTPEvaluator.java
/logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/DefaultSMTPEvaluatorTest.java
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java
/logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
/logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java
/logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
****************************************************************************
Output:
****************************************************************************
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building Logback Classic Module
[INFO] task-segment: [clean, install]
[INFO] ----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /opt/continuum-1.0.3/apps/continuum/working-directory/46/target
[INFO] Deleting directory /opt/continuum-1.0.3/apps/continuum/working-directory/46/target/classes
[INFO] Deleting directory /opt/continuum-1.0.3/apps/continuum/working-directory/46/target/test-classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 70 source files to /opt/continuum-1.0.3/apps/continuum/working-directory/46/target/classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
Compiling 61 source files to /opt/continuum-1.0.3/apps/continuum/working-directory/46/target/test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory: /opt/continuum-1.0.3/apps/continuum/working-directory/46/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running ch.qos.logback.classic.net.LoggingEventSerializationTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.09 sec
Running ch.qos.logback.classic.control.CLCTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec
Running ch.qos.logback.classic.LoggerContextTest
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.02 sec
Running ch.qos.logback.classic.pattern.ClassNameAbbreviatorTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 sec
Running ch.qos.logback.classic.pattern.MDCConverterTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec
Running ch.qos.logback.classic.MDCTest
Exiting a
Exiting b
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec
Running ch.qos.logback.classic.BasicLoggerTest
|-WARN in ch.qos.logback.core.appender.ListAppender[null] - Attempted to append to non started appender [null].
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec
Running ch.qos.logback.classic.PatternLayoutTest
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.021 sec
Running ch.qos.logback.classic.MessageFormattingTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec
Running ch.qos.logback.classic.boolex.JaninoEventEvaluatorTest
INFO] Some message
INFO] Some message
timestamp > 10]: 6610 nanos
x.matches(message): 45470 nanos
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.759 sec
Running ch.qos.logback.classic.net.SMTPAppenderTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.097 sec
Running ch.qos.logback.classic.joran.EvaluatorJoranTest
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Ignoring debug attribute.
|-WARN in ch.qos.logback.classic.joran.action.EvaluatorAction - Assuming default evaluator class [ch.qos.logback.classic.boolex.JaninoEventEvaluator]
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Adding evaluator named [IGNORE_EVAL] to the object stack
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Starting evaluator named [IGNORE_EVAL]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [CONSOLE] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE to Logger[root]
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Ignoring debug attribute.
|-WARN in ch.qos.logback.classic.joran.action.EvaluatorAction - Assuming default evaluator class [ch.qos.logback.classic.boolex.JaninoEventEvaluator]
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Adding evaluator named [IGNORE_EVAL] to the object stack
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Starting evaluator named [IGNORE_EVAL]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [CONSOLE] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE to Logger[root]
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Ignoring debug attribute.
|-WARN in ch.qos.logback.classic.joran.action.EvaluatorAction - Assuming default evaluator class [ch.qos.logback.classic.boolex.JaninoEventEvaluator]
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Adding evaluator named [IGNORE_EVAL] to the object stack
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Starting evaluator named [IGNORE_EVAL]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [CONSOLE] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE to Logger[root]
2006-11-14 16:21:09,530 DEBUG - hello
java.lang.Exception: test
at ch.qos.logback.classic.joran.EvaluatorJoranTest.testIgnoreMarker(EvaluatorJoranTest.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
2006-11-14 16:21:09,532 DEBUG - hello ignore
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Ignoring debug attribute.
|-WARN in ch.qos.logback.classic.joran.action.EvaluatorAction - Assuming default evaluator class [ch.qos.logback.classic.boolex.JaninoEventEvaluator]
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Adding evaluator named [IGNORE_EVAL] to the object stack
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Starting evaluator named [IGNORE_EVAL]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [CONSOLE] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE to Logger[root]
|-ERROR in ch.qos.logback.classic.spi.LoggerContextAwareBase@536c79d7 - Exception thrown for evaluator named [IGNORE_EVAL] ch.qos.logback.core.boolex.EvaluationException: Evaluator [IGNORE_EVAL] caused an exception
ch.qos.logback.core.boolex.EvaluationException: Evaluator [IGNORE_EVAL] caused an exception
at ch.qos.logback.core.boolex.JaninoEventEvaluatorBase.evaluate(JaninoEventEvaluatorBase.java:72)
at ch.qos.logback.classic.pattern.ThrowableInformationConverter.convert(ThrowableInformationConverter.java:107)
at ch.qos.logback.core.pattern.FormattingConverter.write(FormattingConverter.java:32)
at ch.qos.logback.core.pattern.PatternLayoutBase.writeLoopOnConverters(PatternLayoutBase.java:115)
at ch.qos.logback.classic.PatternLayout.doLayout(PatternLayout.java:163)
at ch.qos.logback.classic.PatternLayout.doLayout(PatternLayout.java:167)
at ch.qos.logback.core.WriterAppender.subAppend(WriterAppender.java:267)
at ch.qos.logback.core.WriterAppender.append(WriterAppender.java:114)
at ch.qos.logback.core.AppenderBase.doAppend(AppenderBase.java:71)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:286)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:270)
at ch.qos.logback.classic.Logger.filterAndLog(Logger.java:422)
at ch.qos.logback.classic.Logger.debug(Logger.java:399)
at ch.qos.logback.classic.joran.EvaluatorJoranTest.testIgnoreMarker(EvaluatorJoranTest.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.janino.ScriptEvaluator.evaluate(Unknown Source)
at ch.qos.logback.core.boolex.JaninoEventEvaluatorBase.evaluate(JaninoEventEvaluatorBase.java:65)
... 40 more
Caused by: java.lang.NullPointerException
at SC.eval(ANONYMOUS.java:2)
... 46 more
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.056 sec
Running ch.qos.logback.classic.pattern.ConverterTest
java.lang.Exception: Bogus exception
java.lang.Exception: Bogus exception
Caller+0 at ch.qos.logback.classic.pattern.ConverterTest.testCallerData(ConverterTest.java:187)
Caller+1 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.128 sec
Running ch.qos.logback.classic.DynamicLoggerContextTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.645 sec
Running ch.qos.logback.classic.control.TestAction
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec
Running ch.qos.logback.classic.db.DBAppenderTest
[Server@68814013]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@68814013]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@68814013]: [Thread[main,5,main]]: setDatabaseName(0,test)
[Server@68814013]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@68814013]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@68814013]: [Thread[main,5,main]]: setDatabasePath(0,mem:test;sql.enforce_strict_size=true)
[Server@62acc57]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@62acc57]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@62acc57]: [Thread[main,5,main]]: setDatabaseName(0,test)
[Server@62acc57]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@62acc57]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@62acc57]: [Thread[main,5,main]]: setDatabasePath(0,mem:test;sql.enforce_strict_size=true)
[Server@2880cac9]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@2880cac9]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@2880cac9]: [Thread[main,5,main]]: setDatabaseName(0,test)
[Server@2880cac9]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@2880cac9]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@2880cac9]: [Thread[main,5,main]]: setDatabasePath(0,mem:test;sql.enforce_strict_size=true)
value: someValue
[Server@4afb6354]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@4afb6354]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@4afb6354]: [Thread[main,5,main]]: setDatabaseName(0,test)
[Server@4afb6354]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@4afb6354]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@4afb6354]: [Thread[main,5,main]]: setDatabasePath(0,mem:test;sql.enforce_strict_size=true)
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.708 sec <<< FAILURE!
Running ch.qos.logback.classic.util.InitializationTest
TEST 16:21:11.048 [main] DEBUG c.q.l.c.util.InitializationTest - Hello-didily-odily
TEST 16:21:11.049 [main] DEBUG c.q.l.c.util.InitializationTest - Hello-didily-odily
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 sec
Running ch.qos.logback.classic.LoggerPerfTest
Running on pixie
Average log time for disabled statements: 6.0 nanos.
Running on pixie
Average log time for disabled statements: 19.0 nanos.
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.617 sec
Running ch.qos.logback.classic.html.HTMLLayoutTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.355 sec
Running ch.qos.logback.classic.control.RandomUtilTest
Resulting average is 5.01783
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.035 sec
Running ch.qos.logback.classic.net.SocketAppenderTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.441 sec
Running ch.qos.logback.classic.net.SyslogAppenderTest
MockSyslogServer listening on port 14501
MockSyslogServer listening on port 14502
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.22 sec
Running ch.qos.logback.classic.control.ScenarioMakerTest
CreateLogger(ljggekfdysousqjomupjiohnoxq)
CreateLogger(bvifcmybxtrznamfkzlsiqmhofw)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.mhzsrnhrzjwcbjablolmlymhkwrelapoixghaacnxkidyoinstososm.rzbtjobjewalmeqyxblexlwqrwpchucbptqmfec)
SetLevel(INFO, ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.mhzsrnhrzjwcbjablolmlymhkwrelapoixghaacnxkidyoinstososm.rzbtjobjewalmeqyxblexlwqrwpchucbptqmfec)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.mhzsrnhrzjwcbjablolmlymhkwrelapoixghaacnxkidyoinstososm.sconxzboswtpubzgjindmbwskxewvkshzpkistnlniocijaesypjwclzswiy)
SetLevel(DEBUG, ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.mhzsrnhrzjwcbjablolmlymhkwrelapoixghaacnxkidyoinstososm.sconxzboswtpubzgjindmbwskxewvkshzpkistnlniocijaesypjwclzswiy)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.mhzsrnhrzjwcbjablolmlymhkwrelapoixghaacnxkidyoinstososm.rzeafvjxmvberuvmbyjxzospogus)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.mhzsrnhrzjwcbjablolmlymhkwrelapoixghaacnxkidyoinstososm.qxkpagyuzpvcltrpjvokzt)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.mhzsrnhrzjwcbjablolmlymhkwrelapoixghaacnxkidyoinstososm.jprxvqteaohafrmugfxbyvijkbyfbnos)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.njquybkyqphfcnulkqpwtbihgddbxqgmrxicelaonogjcxlitpryimdak.dgklnhbjmlrndpdnwsfjkrmhuyoxauvfhibjqtpt)
SetLevel(INFO, ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.njquybkyqphfcnulkqpwtbihgddbxqgmrxicelaonogjcxlitpryimdak.dgklnhbjmlrndpdnwsfjkrmhuyoxauvfhibjqtpt)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.njquybkyqphfcnulkqpwtbihgddbxqgmrxicelaonogjcxlitpryimdak.bhstraisbrdcarvltibccjz)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.njquybkyqphfcnulkqpwtbihgddbxqgmrxicelaonogjcxlitpryimdak.rripvpurpstjpfzym)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.njquybkyqphfcnulkqpwtbihgddbxqgmrxicelaonogjcxlitpryimdak.ltckthuwgtraszksrfdcodspvbyyxgfolfltqhdfojmg)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.szgkwydrxisfhwtsdvraummfnhaytablthtypgqejfavo.xzbjclbwpoptlfiakyudsqtzgtozjlgbcbfszunisgexouuqlqsxs)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.szgkwydrxisfhwtsdvraummfnhaytablthtypgqejfavo.azcikomyelznxndbcxbvmkpwmscqt)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.szgkwydrxisfhwtsdvraummfnhaytablthtypgqejfavo.bjunncpxyawurawxkwjdwnclzhfxaaqrafpabrfjlse)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.szgkwydrxisfhwtsdvraummfnhaytablthtypgqejfavo.wew)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.szgkwydrxisfhwtsdvraummfnhaytablthtypgqejfavo.plpy)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.txoasruuwnggozsdqs.lyqiuiiovzrwujbuxzdnoidmhxtxqeepufkmyeaanwwsgt)
SetLevel(DEBUG, ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.txoasruuwnggozsdqs.lyqiuiiovzrwujbuxzdnoidmhxtxqeepufkmyeaanwwsgt)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.txoasruuwnggozsdqs.dsncrzuhikbayfarjaxwppvccgildpgtepnlqeftnhrinzbkijoetxpirjiaiqysas)
SetLevel(DEBUG, ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.txoasruuwnggozsdqs.dsncrzuhikbayfarjaxwppvccgildpgtepnlqeftnhrinzbkijoetxpirjiaiqysas)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.txoasruuwnggozsdqs.ofxljzobrludcnejulwxducplonrkqwqhlrfanxafyg)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.txoasruuwnggozsdqs.murkmlkvgkerioavjfrppltnddtpqvczne)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.ouhiltsaabrdybgsfkaaiafscevlllnzt.gnarpakghuhtcfmkhfbauzcbbtlq)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.ouhiltsaabrdybgsfkaaiafscevlllnzt.godcftqbrwkjdfrrioyzwmrmwpspvpztqbqqoulruyjkjbtndeenwonvcjnuczjegnxfjcsqehkn)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.ouhiltsaabrdybgsfkaaiafscevlllnzt.iwajobbvpsuuqvgjsk)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.ouhiltsaabrdybgsfkaaiafscevlllnzt.oyxsymrviydbmnelebbkvahofgbzxxrlpdkcxsypldjzosdbodjpuoljiohjdcw)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.ompilgezwcluzuffjdyxbaltrgfsfhxnxnwwkveuibkqiphq.ukdwyjklntgkvcdhzusmrj)
SetLevel(ERROR, ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.ompilgezwcluzuffjdyxbaltrgfsfhxnxnwwkveuibkqiphq.ukdwyjklntgkvcdhzusmrj)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.t.g)
SetLevel(DEBUG, ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.t.g)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.t.wexcnbkawjvfoeizazdxhlaqjuxb)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.t.xchowexpifwleubiymndxaxlxftetgp)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.t.bekqkxuuctmptezricsktevakkgpizcuitftrohmhpluhbzgaarqxljo)
CreateLogger(ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.t.mxysyqbjuggrklmsjgvoajkyzjuurvtpztlajniok)
SetLevel(DEBUG, ogkozkyaunwfk.xwjjgisoszlqenwjinmb.uhhdwizvnotxhlyzjns.t.mxysyqbjuggrklmsjgvoajkyzjuurvtpztlajniok)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.037 sec
Running ch.qos.logback.classic.joran.BasicJoranTest
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.appender.ListAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LIST]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [LIST] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [LIST to Logger[root]
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.appender.ListAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LIST]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [LIST] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - ch.qos.logback.classic.joran level set to INFO
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [LIST to Logger[root]
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Ignoring debug attribute.
|-WARN in ch.qos.logback.classic.joran.action.EvaluatorAction - Assuming default evaluator class [ch.qos.logback.classic.boolex.JaninoEventEvaluator]
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Adding evaluator named [helloEval] to the object stack
|-INFO in ch.qos.logback.core.joran.action.MatcherAction - matcher named as [m]
|-INFO in ch.qos.logback.core.joran.action.MatcherAction - Popping appender named [m] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.EvaluatorAction - Starting evaluator named [helloEval]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [CONSOLE] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE to Logger[root]
2006-11-14 16:21:12,781 DEBUG - toto
Caller+0 at ch.qos.logback.classic.joran.BasicJoranTest.testEval(BasicJoranTest.java:81)
Caller+1 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Caller+2 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Caller+3 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2006-11-14 16:21:12,781 DEBUG - hello world
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Ignoring debug attribute.
|-INFO in ch.qos.logback.core.joran.action.NestedComponentIA - was deemed applicable for [configuration][turboFilter]
|-INFO in ch.qos.logback.core.joran.action.NestedComponentIA - Pushing component <turboFilter> on top of the object stack.
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [CONSOLE] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE to Logger[root]
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Ignoring debug attribute.
|-INFO in ch.qos.logback.core.joran.action.NestedComponentIA - was deemed applicable for [configuration][turboFilter]
|-INFO in ch.qos.logback.core.joran.action.NestedComponentIA - Pushing component <turboFilter> on top of the object stack.
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [CONSOLE] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE to Logger[root]
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.05 sec
Results :
Tests run: 103, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13 seconds
[INFO] Finished at: Tue Nov 14 16:21:12 CET 2006
[INFO] Final Memory: 12M/147M
[INFO] ------------------------------------------------------------------------
****************************************************************************
1
0
Online report : http://localhost:8090/continuum/servlet/continuum/target/ProjectBuild.vm/vi…
Build statistics:
State: Failed
Previous State: Ok
Started at: Tue, 14 Nov 2006 16:20:46 +0100
Finished at: Tue, 14 Nov 2006 16:20:56 +0100
Total time: 10s
Build Trigger: Schedule
Exit code: 1
Building machine hostname: pixie
Operating system : Linux(unknown)
Java version : 1.5.0_08(Sun Microsystems Inc.)
Changes
seb SMTPAppenders now use an EventEvaluator.
Classic version uses a JaninoEventEvaluator with a given default expression.
Access version uses a class extending JaninoEventEvaluator to implement the correct behavior.
/logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/DefaultSMTPEvaluator.java
/logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/DefaultSMTPEvaluatorTest.java
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java
/logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java
/logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
/logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java
/logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
****************************************************************************
Output:
****************************************************************************
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building Logback Access Module
[INFO] task-segment: [clean, install]
[INFO] ----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /opt/continuum-1.0.3/apps/continuum/working-directory/47/target
[INFO] Deleting directory /opt/continuum-1.0.3/apps/continuum/working-directory/47/target/classes
[INFO] Deleting directory /opt/continuum-1.0.3/apps/continuum/working-directory/47/target/test-classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 41 source files to /opt/continuum-1.0.3/apps/continuum/working-directory/47/target/classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
Compiling 12 source files to /opt/continuum-1.0.3/apps/continuum/working-directory/47/target/test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory: /opt/continuum-1.0.3/apps/continuum/working-directory/47/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running ch.qos.logback.access.jetty.JettyBasicTest
2006-11-14 16:20:55.325::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2006-11-14 16:20:55.376::INFO: jetty-6.0.x
2006-11-14 16:20:55.438::INFO: Started SelectChannelConnector @ 0.0.0.0:1234
14/11/2006:16:20:55 +0100 localhost 127.0.0.1
14/11/2006:16:20:55 +0100 localhost 127.0.0.1
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.362 sec
Running ch.qos.logback.access.pattern.ConverterTest
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.03 sec
Running ch.qos.logback.access.net.DefaultSMTPEvaluatorTest
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.021 sec <<< FAILURE!
Results :
Tests run: 21, Failures: 0, Errors: 3, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Tue Nov 14 16:20:56 CET 2006
[INFO] Final Memory: 12M/143M
[INFO] ------------------------------------------------------------------------
****************************************************************************
1
0

14 Nov '06
Author: seb
Date: Tue Nov 14 16:17:29 2006
New Revision: 913
Added:
logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/DefaultSMTPEvaluator.java
logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/
logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/DefaultSMTPEvaluatorTest.java
logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java
logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java
Modified:
logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
Log:
SMTPAppenders now use an EventEvaluator.
Classic version uses a JaninoEventEvaluator with a given default expression.
Access version uses a class extending JaninoEventEvaluator to implement the correct behavior.
Added: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/DefaultSMTPEvaluator.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/DefaultSMTPEvaluator.java Tue Nov 14 16:17:29 2006
@@ -0,0 +1,39 @@
+package ch.qos.logback.access.net;
+
+import ch.qos.logback.access.boolex.JaninoEventEvaluator;
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.boolex.EvaluationException;
+
+public class DefaultSMTPEvaluator extends JaninoEventEvaluator {
+
+ private static final long ONE_DAY = 1000*60*60*24;
+ private long LAST_TRIGGER_DATE = 0L;
+
+ public DefaultSMTPEvaluator(Context context) {
+ this.context = context;
+ setName("SMTPAppender's default event evaluator");
+ setExpression("event.getStatusCode() >= 500");
+ }
+
+ /**
+ * Is this <code>event</code> the e-mail triggering event?
+ *
+ * <p>
+ * This method returns <code>true</code>, if the event is
+ * evaluated to true. Otherwise it returns <code>false</code>.
+ *
+ * Once an email is sent, the next one will not be sent unless a certain amount
+ * of time passed.
+ */
+ @Override
+ public boolean evaluate(Object event) throws EvaluationException {
+
+ if (super.evaluate(event)) {
+ if (System.currentTimeMillis() >= LAST_TRIGGER_DATE + ONE_DAY) {
+ LAST_TRIGGER_DATE = System.currentTimeMillis();
+ return true;
+ }
+ }
+ return false;
+ }
+}
Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java (original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java Tue Nov 14 16:17:29 2006
@@ -10,14 +10,12 @@
package ch.qos.logback.access.net;
-import java.io.File;
-
import ch.qos.logback.access.PatternLayout;
-import ch.qos.logback.core.helpers.CyclicBuffer;
import ch.qos.logback.access.spi.AccessEvent;
import ch.qos.logback.core.Layout;
+import ch.qos.logback.core.boolex.EventEvaluator;
+import ch.qos.logback.core.helpers.CyclicBuffer;
import ch.qos.logback.core.net.SMTPAppenderBase;
-import ch.qos.logback.core.rolling.TriggeringPolicy;
/**
* Send an e-mail when a specific access event occurs, typically on server errors.
@@ -34,7 +32,7 @@
* an email will be sent only if the previous email was sent more that 24 hours ago.
* <p>
* This behaviour can be easily bypassed either by modifying this class, or by
- * imlementing a new <code>TriggeringPolicy</code>.
+ * imlementing a new <code>EventEvaluator</code>.
* <p>
* @author Ceki Gülcü
* @author Sébastien Pennec
@@ -49,19 +47,26 @@
/**
* The default constructor will instantiate the appender with a
- * {@link TriggeringEventEvaluator} that will trigger on events with level
+ * {@link EventEvaluator} that will trigger on events with level
* ERROR or higher.
*/
public SMTPAppender() {
- this(new DefaultEvaluator());
+ DefaultSMTPEvaluator evaluator = new DefaultSMTPEvaluator(getContext());
+ setEventEvaluator(evaluator);
}
/**
* Use <code>evaluator</code> passed as parameter as the {@link
- * TriggeringEventEvaluator} for this SMTPAppender.
+ * EventEvaluator} for this SMTPAppender.
*/
- public SMTPAppender(TriggeringPolicy evaluator) {
- this.triggeringPolicy = evaluator;
+ public SMTPAppender(EventEvaluator evaluator) {
+ this.eventEvaluator = evaluator;
+ }
+
+ @Override
+ public void start() {
+ ((DefaultSMTPEvaluator) eventEvaluator).start();
+ super.start();
}
/**
@@ -115,47 +120,3 @@
return pl;
}
}
-
-class DefaultEvaluator implements TriggeringPolicy {
-
- private boolean started;
-
- private static final int TRIGGERING_STATUS_CODE = 500;
- private static final long ONE_DAY = 1000*60*60*24;
- private long LAST_TRIGGER_DATE = 0L;
-
-
- /**
- * Is this <code>event</code> the e-mail triggering event?
- *
- * <p>
- * This method returns <code>true</code>, if the event status code
- * is 500 (server error) or higher. Otherwise it returns <code>false</code>.
- *
- * Once an email is sent, the next one will not be sent unless a certain amount
- * of time passed.
- */
- public boolean isTriggeringEvent(File activeFile, Object eventObject) {
- AccessEvent event = (AccessEvent) eventObject;
-
- if (TRIGGERING_STATUS_CODE <= event.getStatusCode()) {
- if (System.currentTimeMillis() >= LAST_TRIGGER_DATE + ONE_DAY) {
- LAST_TRIGGER_DATE = System.currentTimeMillis();
- return true;
- }
- }
- return false;
- }
-
- public boolean isStarted() {
- return started == true;
- }
-
- public void start() {
- started = true;
- }
-
- public void stop() {
- started = false;
- }
-}
Added: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/DefaultSMTPEvaluatorTest.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/DefaultSMTPEvaluatorTest.java Tue Nov 14 16:17:29 2006
@@ -0,0 +1,61 @@
+package ch.qos.logback.access.net;
+
+import junit.framework.TestCase;
+import ch.qos.logback.access.pattern.helpers.DummyRequest;
+import ch.qos.logback.access.pattern.helpers.DummyResponse;
+import ch.qos.logback.access.pattern.helpers.DummyServerAdapter;
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.ContextBase;
+import ch.qos.logback.core.boolex.EvaluationException;
+
+public class DefaultSMTPEvaluatorTest extends TestCase {
+
+
+ Context context = new ContextBase();
+ DefaultSMTPEvaluator evaluator;
+ DummyRequest request;
+ DummyResponse response;
+ DummyServerAdapter serverAdapter;
+
+ public void setUp() throws Exception {
+ evaluator = new DefaultSMTPEvaluator(context);
+ evaluator.start();
+ request = new DummyRequest();
+ response = new DummyResponse();
+ serverAdapter = new DummyServerAdapter(request, response);
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception {
+ evaluator.stop();
+ evaluator = null;
+ request = null;
+ response = null;
+ serverAdapter = null;
+ context = null;
+ }
+
+ public void testExpectFalseBecauseOfStatus() throws EvaluationException {
+ AccessEvent ae = new AccessEvent(request, response, serverAdapter);
+ response.setStatus(100);
+ assertFalse(evaluator.evaluate(ae));
+ }
+
+ public void testExpectTrue() throws EvaluationException {
+ AccessEvent ae = new AccessEvent(request, response, serverAdapter);
+ response.setStatus(500);
+ assertTrue(evaluator.evaluate(ae));
+ }
+
+ public void testExpectFalseBecauseOfTime() throws EvaluationException {
+ AccessEvent ae = new AccessEvent(request, response, serverAdapter);
+ response.setStatus(500);
+ //this returns true and sets the time
+ evaluator.evaluate(ae);
+ //this should return false because 24h have not passed yet.
+ assertFalse(evaluator.evaluate(ae));
+ }
+
+
+}
Added: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java Tue Nov 14 16:17:29 2006
@@ -0,0 +1,21 @@
+/**
+ * Logback: the generic, reliable, fast and flexible logging framework for Java.
+ *
+ * Copyright (C) 2000-2006, QOS.ch
+ *
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
+ */
+package ch.qos.logback.access.net;
+
+import junit.framework.*;
+
+public class PackageTest extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(DefaultSMTPEvaluatorTest.class);
+ return suite;
+ }
+}
\ No newline at end of file
Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java (original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java Tue Nov 14 16:17:29 2006
@@ -12,7 +12,9 @@
public class DummyResponse implements HttpServletResponse {
+ int status;
Map<String, String> headerMap;
+
public DummyResponse() {
headerMap = new HashMap<String, String>();
headerMap.put("headerName1", "headerValue1");
@@ -70,9 +72,6 @@
public void setIntHeader(String arg0, int arg1) {
}
- public void setStatus(int arg0) {
- }
-
public void setStatus(int arg0, String arg1) {
}
@@ -131,5 +130,17 @@
public String getHeader(String key) {
return headerMap.get(key);
}
+
+ public long getContentCount() {
+ return 10000L;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
}
Added: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java Tue Nov 14 16:17:29 2006
@@ -0,0 +1,27 @@
+package ch.qos.logback.access.pattern.helpers;
+
+import ch.qos.logback.access.spi.ServerAdapter;
+
+public class DummyServerAdapter implements ServerAdapter {
+
+ DummyRequest request;
+ DummyResponse response;
+
+ public DummyServerAdapter(DummyRequest dummyRequest, DummyResponse dummyResponse) {
+ this.request = dummyRequest;
+ this.response = dummyResponse;
+ }
+
+ public long getContentLength() {
+ return response.getContentCount();
+ }
+
+ public int getStatusCode() {
+ return response.getStatus();
+ }
+
+ public String getResponseHeader(String key) {
+ return response.getHeader(key);
+ }
+
+}
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java Tue Nov 14 16:17:29 2006
@@ -10,15 +10,13 @@
package ch.qos.logback.classic.net;
-import java.io.File;
-
-import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.PatternLayout;
-import ch.qos.logback.core.helpers.CyclicBuffer;
+import ch.qos.logback.classic.boolex.JaninoEventEvaluator;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.Layout;
+import ch.qos.logback.core.boolex.EventEvaluator;
+import ch.qos.logback.core.helpers.CyclicBuffer;
import ch.qos.logback.core.net.SMTPAppenderBase;
-import ch.qos.logback.core.rolling.TriggeringPolicy;
/**
* Send an e-mail when a specific logging event occurs, typically on errors or
@@ -38,25 +36,36 @@
public class SMTPAppender extends SMTPAppenderBase {
static final String DEFAULT_SUBJECT_PATTERN = "%logger{20} - %m";
+ static final String DEFAULT_EVALUATOR_EXPRESSION = "level >= ERROR";
private int bufferSize = 512;
protected CyclicBuffer cb = new CyclicBuffer(bufferSize);
/**
* The default constructor will instantiate the appender with a
- * {@link TriggeringPolicy} that will trigger on events with level
+ * {@link EventEvaluator} that will trigger on events with level
* ERROR or higher.
*/
public SMTPAppender() {
- this(new DefaultSMTPTriggeringPolicy());
+ JaninoEventEvaluator jee = new JaninoEventEvaluator();
+ jee.setContext(getContext());
+ jee.setExpression(DEFAULT_EVALUATOR_EXPRESSION);
+ jee.setName("SMTPAppender's default event evaluator");
+ this.eventEvaluator = jee;
}
/**
* Use the parameter as the {@link
- * TriggeringPolicy} for this SMTPAppender.
+ * EventEvaluator} for this SMTPAppender.
*/
- public SMTPAppender(TriggeringPolicy triggeringPolicy) {
- this.triggeringPolicy = triggeringPolicy;
+ public SMTPAppender(EventEvaluator eventEvaluator) {
+ this.eventEvaluator = eventEvaluator;
+ }
+
+ @Override
+ public void start() {
+ ((JaninoEventEvaluator) eventEvaluator).start();
+ super.start();
}
/**
@@ -111,32 +120,3 @@
return pl;
}
}
-
-class DefaultSMTPTriggeringPolicy implements TriggeringPolicy {
-
- private boolean started;
-
- /**
- * Is this <code>event</code> the e-mail triggering event?
- *
- * <p>
- * This method returns <code>true</code>, if the event level has ERROR
- * level or higher. Otherwise it returns <code>false</code>.
- */
- public boolean isTriggeringEvent(File activeFile, Object eventObject) {
- LoggingEvent event = (LoggingEvent) eventObject;
- return event.getLevel().isGreaterOrEqual(Level.ERROR);
- }
-
- public boolean isStarted() {
- return started == true;
- }
-
- public void start() {
- started = true;
- }
-
- public void stop() {
- started = false;
- }
-}
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java Tue Nov 14 16:17:29 2006
@@ -75,7 +75,7 @@
}
public void setTriggeringPolicy() {
- appender.setTriggeringPolicy(null);
+ appender.setEventEvaluator(null);
appender.checkEntryConditions();
assertEquals(1, appender.getContext().getStatusManager().getCount());
}
@@ -86,20 +86,6 @@
assertEquals(1, appender.getContext().getStatusManager().getCount());
}
- public void testDefaultEvaluatorNoTrigger() {
- DefaultSMTPTriggeringPolicy evaluator = new DefaultSMTPTriggeringPolicy();
- LoggingEvent le = new LoggingEvent();
- le.setLevel(Level.DEBUG);
- assertFalse(evaluator.isTriggeringEvent(null, le));
- }
-
- public void testDefaultEvaluatorTrigger() {
- DefaultSMTPTriggeringPolicy evaluator = new DefaultSMTPTriggeringPolicy();
- LoggingEvent le = new LoggingEvent();
- le.setLevel(Level.ERROR);
- assertTrue(evaluator.isTriggeringEvent(null, le));
- }
-
private static Layout buildLayout(LoggerContext lc) {
PatternLayout layout = new PatternLayout();
layout.setContext(lc);
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java Tue Nov 14 16:17:29 2006
@@ -26,7 +26,8 @@
import ch.qos.logback.core.AppenderBase;
import ch.qos.logback.core.Layout;
-import ch.qos.logback.core.rolling.TriggeringPolicy;
+import ch.qos.logback.core.boolex.EvaluationException;
+import ch.qos.logback.core.boolex.EventEvaluator;
/**
* An abstract class that provides basic support for
@@ -49,7 +50,7 @@
protected Message msg;
- protected TriggeringPolicy triggeringPolicy;
+ protected EventEvaluator eventEvaluator;
/**
* return a layout for the subjet string as appropriate for the
@@ -86,6 +87,8 @@
subjectLayout = makeSubjectLayout(subjectStr);
+
+
started = true;
} catch (MessagingException e) {
@@ -105,9 +108,13 @@
subAppend(eventObject);
- if (triggeringPolicy.isTriggeringEvent(null, eventObject)) {
+ try {
+ if (eventEvaluator.evaluate(eventObject)) {
sendBuffer(eventObject);
}
+ } catch (EvaluationException ex) {
+ addError("SMTPAppender's EventEvaluator threw an Exception" + ex);
+ }
}
abstract protected void subAppend(Object eventObject);
@@ -126,8 +133,8 @@
return false;
}
- if (this.triggeringPolicy == null) {
- addError("No TriggeringPolicy is set for appender [" + name + "].");
+ if (this.eventEvaluator == null) {
+ addError("No EventEvaluator is set for appender [" + name + "].");
return false;
}
@@ -272,13 +279,13 @@
}
/**
- * The <b>TriggeringPolicy</b> option takes a string value representing the
- * name of the class implementing the {@link TriggeringPolicy}
+ * The <b>EventEvaluator</b> option takes a string value representing the
+ * name of the class implementing the {@link EventEvaluators}
* interface. A corresponding object will be instantiated and assigned as the
- * triggering event evaluator for the SMTPAppender.
+ * event evaluator for the SMTPAppender.
*/
- public void setTriggeringPolicy(TriggeringPolicy triggeringPolicy) {
- this.triggeringPolicy = triggeringPolicy;
+ public void setEventEvaluator(EventEvaluator eventEvaluator) {
+ this.eventEvaluator = eventEvaluator;
}
public Layout getLayout() {
1
0

svn commit: r912 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action
by noreply.ceki@qos.ch 14 Nov '06
by noreply.ceki@qos.ch 14 Nov '06
14 Nov '06
Author: ceki
Date: Tue Nov 14 13:57:27 2006
New Revision: 912
Modified:
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java
Log:
Avoid unnecessary noise.
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java Tue Nov 14 13:57:27 2006
@@ -68,7 +68,7 @@
ImplicitActionData ad = new ImplicitActionData(parentBean, containmentType);
ad.propertyName = nestedElementTagName;
actionDataStack.push(ad);
- addInfo("NestedSimplePropertyIA deemed applicable <" + pattern + ">");
+ //addInfo("NestedSimplePropertyIA deemed applicable <" + pattern + ">");
return true;
default:
addError("PropertySetter.canContainComponent returned " + containmentType);
1
0

svn commit: r911 - logback/trunk/logback-site/src/site/xdocTemplates/manual
by noreply.seb@qos.ch 14 Nov '06
by noreply.seb@qos.ch 14 Nov '06
14 Nov '06
Author: seb
Date: Tue Nov 14 12:12:10 2006
New Revision: 911
Modified:
logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml
logback/trunk/logback-site/src/site/xdocTemplates/manual/index.xml
logback/trunk/logback-site/src/site/xdocTemplates/manual/layouts.xml
Log:
minor fixes
Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml (original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml Tue Nov 14 12:12:10 2006
@@ -394,7 +394,7 @@
<p>
To run this example, as well as others in this
- chapter, please run the script provided in logback's main directory.
+ chapter, please run the script provided in the <em>logback-examples</em> directory.
Then, use the <code>ConfigurationTester</code> by
issuing the following command, once in the <em>logback-examples</em> directory:
</p>
@@ -1728,6 +1728,9 @@
</root>
</configuration></pre></div>
+
+
+
<h3>DBAppender</h3>
<p>
@@ -1744,11 +1747,11 @@
is a specific script for each of the most popular database systems.
If the script for your particular type of database system is missing, it should be
quite easy to write one, taking example on the already existing scripts. If
- you send them to us, we will gladly include missing scripts in future
+ you send them to us, we will gladly include missing scripts in future releases.
</p>
<p>
- If the JDBC driver you are using supports the
+ If your JDBC driver supports the
<code>getGeneratedKeys</code> method introduced in
JDBC 3.0 specification, then no more steps are required, excluding usual
configuration.
Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/index.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/index.xml (original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/index.xml Tue Nov 14 12:12:10 2006
@@ -40,8 +40,9 @@
</p>
<p>
To run the examples provided in this book, you might have
- to add the logback jars to your classpath. They are available
- on our <a href="../download.html">download page</a>.
+ to run the provided script to setup your classpath. The scripts
+ can be found in the logback distributions, inside the <em>logback-examples</em>
+ directory.
</p>
</div>
Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/layouts.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/layouts.xml (original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/layouts.xml Tue Nov 14 12:12:10 2006
@@ -191,10 +191,14 @@
<p>The sample application <code>chapter5.SampleLogging</code> configures logback with the
configuration script supplied as parameter and then logs a debug message,
followed by an error message.
- See <em>examples/chapter5/SampleLogging.java</em> for precise details.</p>
+ See <em>src/main/java/chapter5/SampleLogging.java</em> for precise details.</p>
- <p>Executing the command <em>java chapter5.SampleLogging chapter5/sampleLayoutConfig.xml</em>
- will produce the following output:</p>
+ <p>
+ To run this example, as well as others in this
+ chapter, please run the script provided in the <em>logback-examples</em> directory.
+ Executing the command <em>java chapter5.SampleLogging src/main/java/chapter5/sampleLayoutConfig.xml</em>
+ once in the <em>logback-examples</em> directory will produce the following output:
+ </p>
<div class="source"><pre>0 DEBUG [main] chapter5.SampleLogging - Everything's going well
0 ERROR [main] chapter5.SampleLogging - ... not quite</pre></div>
@@ -1047,7 +1051,7 @@
Example 5.2: Sample usage of EventEvaluators
(logback-examples/src/main/java/chapter5/CallerEvaluatorExample.java)
</em>
- <div class="source"><pre>ppackage chapter5;
+ <div class="source"><pre>package chapter5;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1205,7 +1209,7 @@
<p>Let us say that our customized <code>Converter</code> will output the level of the logging
event, colored following ANSI rules. Here is the necessary implementation:</p>
-<em> Example 5.4: Sample Converter Example (examples/chapter5/MySampleConverter.java)</em>
+<em> Example 5.4: Sample Converter Example (src/main/java/chapter5/MySampleConverter.java)</em>
<div class="source"><pre>package chapter5;
import ch.qos.logback.classic.Level;
@@ -1255,7 +1259,7 @@
the new <code>Converter</code>. For this task, we just need to declare the new
conversion word in the configuration file, as shown below:</p>
-<em> Example 5.4: Sample Converter Example (examples/chapter5/mySampleConverterConfig.xml)</em>
+<em> Example 5.4: Sample Converter Example (src/main/java/chapter5/mySampleConverterConfig.xml)</em>
<div class="source"><pre><configuration>
<b><conversionRule conversionWord="sample" converterClass="chapter5.MySampleConverter" /></b>
1
0

svn commit: r910 - in logback/trunk: . logback-examples logback-examples/src/main/resources src/main/assembly
by noreply.seb@qos.ch 13 Nov '06
by noreply.seb@qos.ch 13 Nov '06
13 Nov '06
Author: seb
Date: Mon Nov 13 22:08:01 2006
New Revision: 910
Added:
logback/trunk/logback-examples/src/main/resources/setClasspath.cmd
- copied, changed from r907, /logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.cmd
logback/trunk/logback-examples/src/main/resources/setClasspath.sh
- copied, changed from r907, /logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.sh
Removed:
logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.cmd
logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.sh
Modified:
logback/trunk/logback-examples/pom.xml
logback/trunk/pom.xml
logback/trunk/src/main/assembly/dist.xml
Log:
modified script names
modified script destination in assembly
added versions of logback modules and slf4j to be inserted into the scripts by maven
Modified: logback/trunk/logback-examples/pom.xml
==============================================================================
--- logback/trunk/logback-examples/pom.xml (original)
+++ logback/trunk/logback-examples/pom.xml Mon Nov 13 22:08:01 2006
@@ -55,6 +55,12 @@
</dependencies>
<build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Copied: logback/trunk/logback-examples/src/main/resources/setClasspath.cmd (from r907, /logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.cmd)
==============================================================================
--- /logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.cmd (original)
+++ logback/trunk/logback-examples/src/main/resources/setClasspath.cmd Mon Nov 13 22:08:01 2006
@@ -5,10 +5,10 @@
set LB_HOME=c:/SET/THIS/PARAMETER/TO/THE/FOLDER/WHERE/YOU/INSTALLED/LOGBACK
REM echo %LB_HOME%
-set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-classic-0.6-SNAPSHOT.jar
-set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-core-0.6-SNAPSHOT.jar
-set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/logback-examples-0.6-SNAPSHOT.jar
-set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/lib/slf4j-api-1.1.0-beta0.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-classic-${project.version}.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-core-${project.version}.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/logback-examples-${project.version}.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/lib/slf4j-api-${slf4j.version}.jar
REM echo %CLASSPATH%
Copied: logback/trunk/logback-examples/src/main/resources/setClasspath.sh (from r907, /logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.sh)
==============================================================================
--- /logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.sh (original)
+++ logback/trunk/logback-examples/src/main/resources/setClasspath.sh Mon Nov 13 22:08:01 2006
@@ -4,13 +4,10 @@
# This script will add logback jars to your classpath.
##
-CLASSPATH="$CLASSPATH;${PWD}/logback-access-0.6-SNAPSHOT.jar"
-CLASSPATH="${CLASSPATH};${PWD}/logback-classic-0.6-SNAPSHOT.jar"
-CLASSPATH="${CLASSPATH};${PWD}/logback-classic-0.6-SNAPSHOT-tests.jar"
-CLASSPATH="${CLASSPATH};${PWD}/logback-core-0.6-SNAPSHOT.jar"
-CLASSPATH="${CLASSPATH};${PWD}/logback-core-0.6-SNAPSHOT-tests.jar"
-CLASSPATH="${CLASSPATH};${PWD}/logback-examples/logback-examples-0.6-SNAPSHOT.jar"
-CLASSPATH="${CLASSPATH};${PWD}/logback-examples/lib/slf4j-api-1.1.0-beta0.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-classic-${project.version}.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-core-${project.version}.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-examples/logback-examples-${project.version}.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-examples/lib/slf4j-api-${slf4j.version}.jar"
export CLASSPATH
Modified: logback/trunk/pom.xml
==============================================================================
--- logback/trunk/pom.xml (original)
+++ logback/trunk/pom.xml Mon Nov 13 22:08:01 2006
@@ -34,6 +34,10 @@
</dependency>
</dependencies>
+ <properties>
+ <slf4j.version>1.1.0-RC0</slf4j.version>
+ </properties>
+
<dependencyManagement>
<dependencies>
<!-- Project modules -->
Modified: logback/trunk/src/main/assembly/dist.xml
==============================================================================
--- logback/trunk/src/main/assembly/dist.xml (original)
+++ logback/trunk/src/main/assembly/dist.xml Mon Nov 13 22:08:01 2006
@@ -54,7 +54,30 @@
<exclude>*.bak</exclude>
</excludes>
</fileSet>
-
+ <fileSet>
+ <directory>logback-site/</directory>
+ <outputDirectory>logback-site/</outputDirectory>
+ <includes>
+ <include>
+ pom.xml
+ </include>
+ </includes>
+ <excludes>
+ <exclude>*.bak</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>logback-skin/</directory>
+ <outputDirectory>logback-skin/</outputDirectory>
+ <includes>
+ <include>
+ pom.xml
+ </include>
+ </includes>
+ <excludes>
+ <exclude>*.bak</exclude>
+ </excludes>
+ </fileSet>
<!-- Module Source directories -->
<fileSet>
<directory>logback-core/src/</directory>
@@ -76,6 +99,23 @@
<fileSet>
<directory>logback-examples/src/</directory>
<outputDirectory>logback-examples/src/</outputDirectory>
+ <excludes>
+ <exclude>
+ main/resources/
+ </exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>logback-examples/src/main/resources</directory>
+ <outputDirectory>logback-examples/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>logback-site/src/</directory>
+ <outputDirectory>logback-site/src/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>logback-skin/src/</directory>
+ <outputDirectory>logback-skin/src/</outputDirectory>
</fileSet>
<!-- We also include the classes of the examples module -->
<fileSet>
@@ -139,7 +179,7 @@
<!-- Website -->
<fileSet>
<directory>target/site</directory>
- <outputDirectory>/site</outputDirectory>
+ <outputDirectory>logback-site/target/site</outputDirectory>
</fileSet>
<!-- Parent files -->
1
0

svn commit: r909 - in logback/trunk: . logback-classic/src/main/java/ch/qos/logback/classic/util
by noreply.ceki@qos.ch 13 Nov '06
by noreply.ceki@qos.ch 13 Nov '06
13 Nov '06
Author: ceki
Date: Mon Nov 13 21:11:32 2006
New Revision: 909
Modified:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java
logback/trunk/pom.xml
Log:
- Default configuration no longer calls BasicConfigurator.
- minor addition in pom.xml
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java Mon Nov 13 21:11:32 2006
@@ -2,7 +2,6 @@
import java.net.URL;
-import ch.qos.logback.classic.BasicConfigurator;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.joran.spi.JoranException;
@@ -38,7 +37,7 @@
StatusPrinter.print(loggerContext);
}
} else {
- BasicConfigurator.configure(loggerContext);
+ // BasicConfigurator.configure(loggerContext);
}
}
}
Modified: logback/trunk/pom.xml
==============================================================================
--- logback/trunk/pom.xml (original)
+++ logback/trunk/pom.xml Mon Nov 13 21:11:32 2006
@@ -106,6 +106,15 @@
</dependencies>
</dependencyManagement>
+ <profiles>
+ <profile>
+ <id>testSkip</id>
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+ </profile>
+ </profiles>
+
<build>
<extensions>
<extension>
1
0

svn commit: r908 - logback/trunk/logback-site/src/site/xdocTemplates
by noreply.ceki@qos.ch 13 Nov '06
by noreply.ceki@qos.ch 13 Nov '06
13 Nov '06
Author: ceki
Date: Mon Nov 13 21:03:28 2006
New Revision: 908
Modified:
logback/trunk/logback-site/src/site/xdocTemplates/shortIntro.xml
Log:
Ongoing work on the intro.
Modified: logback/trunk/logback-site/src/site/xdocTemplates/shortIntro.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/shortIntro.xml (original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/shortIntro.xml Mon Nov 13 21:03:28 2006
@@ -406,20 +406,14 @@
<table>
<tr>
<th>
- Logger
- <br />
- name
+ Logger name
</th>
<th>
- Assigned
- <br />
- level
+ Assigned level
</th>
<th>
- Effective
- <br />
- level
+ Effective level
</th>
</tr>
<tr>
@@ -444,30 +438,24 @@
<td>DEBUG</td>
</tr>
</table>
- <p>
- In example 1 above, only the root logger is assigned a
- level.
- This level value, <code>DEBUG</code>, is inherited by the other loggers
- <code>X</code>, <code>X.Y</code> and <code>X.Y.Z</code>
+
+ <p> In example 1 above, only the root logger is assigned a level.
+ This level value, <code>DEBUG</code>, is inherited by the other
+ loggers <code>X</code>, <code>X.Y</code> and <code>X.Y.Z</code>
</p>
+
<em>Example 2</em>
<table>
<tr>
<th>
- Logger
- <br />
- name
+ Logger name
</th>
<th>
- Assigned
- <br />
- level
+ Assigned level
</th>
<th>
- Effective
- <br />
- level
+ Effective level
</th>
</tr>
<tr align="left">
@@ -493,28 +481,21 @@
</tr>
</table>
- <p>
- In example 2 above, all loggers have an assigned level value.
- There is no need for level inheritence.
+ <p>In example 2 above, all loggers have an assigned level value.
+ There is no need for level inheritence.
</p>
<em>Example 3</em>
<table>
<tr>
<th>
- Logger
- <br />
- name
+ Logger name
</th>
<th>
- Assigned
- <br />
- level
+ Assigned level
</th>
<th>
- Effective
- <br />
- level
+ Effective level
</th>
</tr>
<tr align="left">
@@ -551,19 +532,13 @@
<tr>
<th>
- Logger
- <br />
- name
+ Logger name
</th>
<th>
- Assigned
- <br />
- level
+ Assigned level
</th>
<th>
- Effective
- <br />
- level
+ Effective level
</th>
</tr>
<tr align="left">
@@ -589,8 +564,7 @@
</tr>
</table>
- <!-- ========= CEKI: STOPPED HERE =================== -->
-
+
<p>In example 4 above, the loggers <code>root</code> and
<code>X</code> and are assigned the levels <code>DEBUG</code> and
<code>INFO</code> respectively. The loggers <code>X.Y</code> and
@@ -627,7 +601,7 @@
<code>DEBUG < INFO < WARN < ERROR</code>.
</p>
- <p>In a more graphic way, here is how the selection rule works: in
+ <p>In a more graphic way, here is how the selection rule works. In
the following table, the vertical header shows the the level of
the logging request, designated by <em>p</em>, while the
horizontal header shows effective level of the logger, designated
@@ -728,51 +702,52 @@
discussed shortly.
</p>
<p>
- Logback makes it easy to name loggers by
- <em>software component</em>.
- This can be accomplished by instantiating a
- logger in each class, with the logger name equal to the
- fully qualified name of the class. This is a useful and
- straightforward method of defining loggers. As the log
- output bears the name of the generating logger, this naming
- strategy makes it easy to identify the origin of a log
- message. However, this is only one possible, albeit common,
- strategy for naming loggers. Logback does not restrict the
- possible set of loggers. The developer is free to name the
- loggers she desires.
+ Logback makes it easy to name loggers by <em>software
+ component</em>. This can be accomplished by instantiating a
+ logger in each class, with the logger name equal to the fully
+ qualified name of the class. This is a useful and
+ straightforward method of defining loggers. As the log output
+ bears the name of the generating logger, this naming strategy
+ makes it easy to identify the origin of a log message. However,
+ this is only one possible, albeit common, strategy for naming
+ loggers. Logback does not restrict the possible set of
+ loggers. As a developer, you are free to name loggers as you
+ wish.
</p>
- <p>
- Nevertheless, naming loggers after the class where they are
- located seems to be the best strategy known so far.
+
+ <p>Nevertheless, naming loggers after the class where they are
+ located seems to be the best strategy known so far.
</p>
<h3>Appenders and Layouts</h3>
<p>
- The ability to selectively enable or disable logging
- requests based on their logger is only part of the picture.
- Logback allows logging requests to print to multiple
- destinations. In logback speak, an output destination is
- called an appender. Currently, appenders exist for the
- console, files, remote socket servers, JMS, and remote UNIX
- Syslog daemons. It is also possible to log asynchronously.
+ The ability to selectively enable or disable logging requests
+ based on their logger is only part of the picture. Logback
+ allows logging requests to print to multiple destinations. In
+ logback speak, an output destination is called an
+ appender. Currently, appenders exist for the console, files,
+ remote socket servers, to MySQL, PostgreSQL, Oracle and other
+ databases, to JMS, and remote UNIX Syslog daemons.
+
+ <!--It is also possible to log asynchronously. -->
</p>
<p>More than one appender can be attached to a logger.</p>
- <p>
- The <code>addAppender</code> method adds an appender to a given logger.
- Each enabled logging request for a given logger will be
- forwarded to all the appenders in that logger as well as the
- appenders higher in the context. In other words, appenders
- are inherited additively from the logger context. For
- example, if a console appender is added to the root logger,
- then all enabled logging requests will at least print on the
- console. If in addition a file appender is added to a
- logger, say <em>L</em>, then enabled logging requests for
- <em>L</em> and <em>L</em>'s children will print on a file <em>and</em> on the console.
- It is possible to override this default behavior so that appender
- accumulation is no longer additive by setting the additivity
- flag to false.
+
+ <p> The <code><a href="apidocs/ch/qos/logback/classic/Logger.html#addAppender(ch.qos.logback.core.Appender)">addAppender</a></code> method adds an appender to a
+ given logger. Each enabled logging request for a given logger
+ will be forwarded to all the appenders in that logger as well as
+ the appenders higher in the context. In other words, appenders are
+ inherited additively from the logger context. For example, if a
+ console appender is added to the root logger, then all enabled
+ logging requests will at least print on the console. If in
+ addition a file appender is added to a logger, say <em>L</em>,
+ then enabled logging requests for <em>L</em> and <em>L</em>'s
+ children will print on a file <em>and</em> on the console. It is
+ possible to override this default behavior so that appender
+ accumulation is no longer additive by setting the additivity flag
+ to false.
</p>
<p>
@@ -810,7 +785,7 @@
<table class="bodyTable">
<tr>
<th>Logger Name</th>
- <th>Added Appenders</th>
+ <th>Attached Appenders</th>
<th>Additivity Flag</th>
<th>Output Targets</th>
<th>Comment</th>
@@ -820,10 +795,9 @@
<td>A1</td>
<td>not applicable</td>
<td>A1</td>
- <td>
- The root logger can be accessed
- with the LoggerFactory.getLogger("root") method. There is no
- default appender attached to root.
+
+ <td>Since the root logger stands at the top of the logger
+ hiearchy, the additivity flag does not apply to it.
</td>
</tr>
<tr>
@@ -850,18 +824,19 @@
<tr>
<td>security</td>
<td>A-sec</td>
- <td class="blue">false</td>
+ <td class="blue"><span class="blue">false</span></td>
<td>A-sec</td>
+
<td>
- No appender accumulation since the additivity flag
- is set to
+ No appender accumulation since the additivity flag is set to
<code>false</code>. Only appender A-sec will be used.
</td>
</tr>
<tr>
<td>security.access</td>
<td>none</td>
- <td>true</td> <td>A-sec</td>
+ <td>true</td>
+ <td>A-sec</td>
<td>
Only appenders of "security" because the additivity
flag in "security" is set to
@@ -887,7 +862,7 @@
<p>
For example, the PatternLayout with the conversion pattern
- "%-4relative [%thread] %-5level %class - %msg%n" will output something akin to:
+ "%-4relative [%thread] %-5level %logger{32} - %msg%n" will output something akin to:
</p>
<div class="source"><pre>176 [main] DEBUG chapter1.HelloWorld3 - Hello world.</pre></div>
@@ -901,12 +876,15 @@
the message of the statement.
</p>
- <h4>Parametrized logging</h4>
+ <h3>Parameterized logging</h3>
<p>
- If you are a SLF4J user, you'll
- notice that the methods used to request logging do not only
- take a String as a parameter. Some methods accept further parameters.
+ Given that loggers in logback-classic implement the <a
+ href="http://www.slf4j.org/api/org/slf4j/Logger.html">SLF4J's
+ Logger interface</a>, certain printing methods admit more than
+ one parameter. These printing method variants are mainly
+ intended to improve performance while minimizing the impact on
+ the readability of the code.
</p>
<p>
@@ -945,6 +923,8 @@
log a statement.
</p>
+<!-- ========= CEKI: STOPPED HERE =================== -->
+
<h4>Better alternative</h4>
<p>
@@ -957,12 +937,11 @@
logger.debug("The entry is {}.", entry);</pre></div>
<p>
- After evaluting whether to log or not, and only if the
- decision is affirmative, will the logger implementation
- format the message and replace the '{}' pair with the string
- value of <code>entry</code>.
- In other words, this form does not incur the cost of
- parameter construction in case the log statement is
+ After evaluting whether to log or not, and only if the decision
+ is positive, will the logger implementation format the message
+ and replace the '{}' pair with the string value of
+ <code>entry</code>. In other words, this form does not incur
+ the cost of parameter construction in case the log statement is
disabled.
</p>
@@ -997,27 +976,29 @@
<h3>Configuration</h3>
<p>
- Inserting log requests into the application code requires
- a fair amount of planning and effort. Observation shows that
- approximately 4 percent of code is dedicated to logging. Consequently,
- even moderately sized applications will have thousands of logging
- statements embedded within their code. Given their number, it becomes
- imperative to manage these log statements without the need to
- modify them manually.
- </p>
- <p>
- The logback environment is fully configurable programmatically.
- However, it is far more flexible to configure logback using
- configuration files. In logback, configuration files must be written in
- XML format.
- </p>
- <p>
- Log4j users can convert their <code>log4j.properties</code> files to logback xml configration files using
- our <a href="http://logback.qos.ch/translator/">PropertiesTranslator</a> webapp.
+ Inserting log requests into the application code requires a fair
+ amount of planning and effort. Observation shows that
+ approximately four percent of code is dedicated to
+ logging. Consequently, even moderately sized applications will
+ contain thousands of logging statements embedded within its
+ code. Given their number, it becomes imperative to manage these
+ log statements without the need to modify them manually.
+ </p>
+ <p>
+ The logback environment is fully configurable programmatically.
+ However, it is far more flexible to configure logback using
+ configuration files. In logback, configuration files are
+ expressed in XML.
+ </p>
+ <p>
+ Existing log4j users can convert their <em>log4j.properties</em>
+ files to <em>logback.xml</em> using <a
+ href="http://logback.qos.ch/translator/">PropertiesTranslator</a>
+ web-application.
</p>
<p>
Let us give a taste of how logback configuration is done with the help of an
- imaginary application MyApp that uses logback.
+ imaginary application <em>MyApp</em> that uses logback.
</p>
<em>Example 1.4: Basic configuration (logback-examples/src/main/java/chapter1/MyApp.java)</em>
<div class="source"><pre>package chapter1;
1
0

svn commit: r907 - in logback/trunk: . logback-examples/src/main/resources src/main/assembly
by noreply.seb@qos.ch 13 Nov '06
by noreply.seb@qos.ch 13 Nov '06
13 Nov '06
Author: seb
Date: Mon Nov 13 20:38:13 2006
New Revision: 907
Added:
logback/trunk/logback-examples/src/main/resources/
logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.cmd
logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.sh
Removed:
logback/trunk/setExamplesClasspath.sh
Modified:
logback/trunk/src/main/assembly/dist.xml
Log:
added config scripts
removed tests jars from assembly
Added: logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.cmd
==============================================================================
--- (empty file)
+++ logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.cmd Mon Nov 13 20:38:13 2006
@@ -0,0 +1,14 @@
+
+@echo off
+REM This script will add logback jars to your classpath.
+
+set LB_HOME=c:/SET/THIS/PARAMETER/TO/THE/FOLDER/WHERE/YOU/INSTALLED/LOGBACK
+REM echo %LB_HOME%
+
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-classic-0.6-SNAPSHOT.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-core-0.6-SNAPSHOT.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/logback-examples-0.6-SNAPSHOT.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/lib/slf4j-api-1.1.0-beta0.jar
+
+
+REM echo %CLASSPATH%
Added: logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.sh
==============================================================================
--- (empty file)
+++ logback/trunk/logback-examples/src/main/resources/setExamplesClasspath.sh Mon Nov 13 20:38:13 2006
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+##
+# This script will add logback jars to your classpath.
+##
+
+CLASSPATH="$CLASSPATH;${PWD}/logback-access-0.6-SNAPSHOT.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-classic-0.6-SNAPSHOT.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-classic-0.6-SNAPSHOT-tests.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-core-0.6-SNAPSHOT.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-core-0.6-SNAPSHOT-tests.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-examples/logback-examples-0.6-SNAPSHOT.jar"
+CLASSPATH="${CLASSPATH};${PWD}/logback-examples/lib/slf4j-api-1.1.0-beta0.jar"
+
+export CLASSPATH
+
+echo $CLASSPATH
Modified: logback/trunk/src/main/assembly/dist.xml
==============================================================================
--- logback/trunk/src/main/assembly/dist.xml (original)
+++ logback/trunk/src/main/assembly/dist.xml Mon Nov 13 20:38:13 2006
@@ -96,7 +96,6 @@
<outputDirectory>/</outputDirectory>
<includes>
<include>logback-core-${project.version}.jar</include>
- <include>logback-core-${project.version}-tests.jar</include>
</includes>
</fileSet>
<fileSet>
@@ -104,7 +103,6 @@
<outputDirectory>/</outputDirectory>
<includes>
<include>logback-classic-${project.version}.jar</include>
- <include>logback-classic-${project.version}-tests.jar</include>
</includes>
</fileSet>
<fileSet>
1
0

13 Nov '06
Author: seb
Date: Mon Nov 13 18:27:38 2006
New Revision: 906
Modified:
logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
logback/trunk/logback-examples/src/main/java/chapter4/mail/EMail.java
logback/trunk/logback-examples/src/main/java/chapter4/mail/mail3.xml
logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml
Log:
Removed references to event evaluators in SMTPAppender, using TriggeringPolicy instead.
Updated configuration scripts and examples accondingly.
Other improvements to the documentation
Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java (original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java Mon Nov 13 18:27:38 2006
@@ -61,7 +61,7 @@
* TriggeringEventEvaluator} for this SMTPAppender.
*/
public SMTPAppender(TriggeringPolicy evaluator) {
- this.evaluator = evaluator;
+ this.triggeringPolicy = evaluator;
}
/**
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java Mon Nov 13 18:27:38 2006
@@ -44,19 +44,19 @@
/**
* The default constructor will instantiate the appender with a
- * {@link TriggeringEventEvaluator} that will trigger on events with level
+ * {@link TriggeringPolicy} that will trigger on events with level
* ERROR or higher.
*/
public SMTPAppender() {
- this(new DefaultEvaluator());
+ this(new DefaultSMTPTriggeringPolicy());
}
/**
- * Use <code>evaluator</code> passed as parameter as the {@link
- * TriggeringEventEvaluator} for this SMTPAppender.
+ * Use the parameter as the {@link
+ * TriggeringPolicy} for this SMTPAppender.
*/
- public SMTPAppender(TriggeringPolicy evaluator) {
- this.evaluator = evaluator;
+ public SMTPAppender(TriggeringPolicy triggeringPolicy) {
+ this.triggeringPolicy = triggeringPolicy;
}
/**
@@ -112,7 +112,7 @@
}
}
-class DefaultEvaluator implements TriggeringPolicy {
+class DefaultSMTPTriggeringPolicy implements TriggeringPolicy {
private boolean started;
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppenderTest.java Mon Nov 13 18:27:38 2006
@@ -74,8 +74,8 @@
assertEquals(1, appender.getContext().getStatusManager().getCount());
}
- public void testEntryConditionsCheckNoEvaluator() {
- appender.setEvaluator(null);
+ public void setTriggeringPolicy() {
+ appender.setTriggeringPolicy(null);
appender.checkEntryConditions();
assertEquals(1, appender.getContext().getStatusManager().getCount());
}
@@ -87,14 +87,14 @@
}
public void testDefaultEvaluatorNoTrigger() {
- DefaultEvaluator evaluator = new DefaultEvaluator();
+ DefaultSMTPTriggeringPolicy evaluator = new DefaultSMTPTriggeringPolicy();
LoggingEvent le = new LoggingEvent();
le.setLevel(Level.DEBUG);
assertFalse(evaluator.isTriggeringEvent(null, le));
}
public void testDefaultEvaluatorTrigger() {
- DefaultEvaluator evaluator = new DefaultEvaluator();
+ DefaultSMTPTriggeringPolicy evaluator = new DefaultSMTPTriggeringPolicy();
LoggingEvent le = new LoggingEvent();
le.setLevel(Level.ERROR);
assertTrue(evaluator.isTriggeringEvent(null, le));
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java Mon Nov 13 18:27:38 2006
@@ -27,7 +27,6 @@
import ch.qos.logback.core.AppenderBase;
import ch.qos.logback.core.Layout;
import ch.qos.logback.core.rolling.TriggeringPolicy;
-import ch.qos.logback.core.util.OptionHelper;
/**
* An abstract class that provides basic support for
@@ -50,7 +49,7 @@
protected Message msg;
- protected TriggeringPolicy evaluator;
+ protected TriggeringPolicy triggeringPolicy;
/**
* return a layout for the subjet string as appropriate for the
@@ -106,7 +105,7 @@
subAppend(eventObject);
- if (evaluator.isTriggeringEvent(null, eventObject)) {
+ if (triggeringPolicy.isTriggeringEvent(null, eventObject)) {
sendBuffer(eventObject);
}
}
@@ -127,7 +126,7 @@
return false;
}
- if (this.evaluator == null) {
+ if (this.triggeringPolicy == null) {
addError("No TriggeringPolicy is set for appender [" + name + "].");
return false;
}
@@ -210,13 +209,6 @@
abstract protected void fillBuffer(StringBuffer sbuf);
/**
- * Returns value of the <b>EvaluatorClass</b> option.
- */
- public String getEvaluatorClass() {
- return evaluator == null ? null : evaluator.getClass().getName();
- }
-
- /**
* Returns value of the <b>From</b> option.
*/
public String getFrom() {
@@ -279,25 +271,16 @@
this.msg = msg;
}
- public void setEvaluator(TriggeringPolicy evaluator) {
- this.evaluator = evaluator;
- }
-
/**
- * The <b>EvaluatorClass</b> option takes a string value representing the
- * name of the class implementing the {@link TriggeringEventEvaluator}
+ * The <b>TriggeringPolicy</b> option takes a string value representing the
+ * name of the class implementing the {@link TriggeringPolicy}
* interface. A corresponding object will be instantiated and assigned as the
* triggering event evaluator for the SMTPAppender.
*/
- public void setEvaluatorClass(String value) {
- try {
- evaluator = (TriggeringPolicy) OptionHelper.instantiateByClassName(value,
- TriggeringPolicy.class);
- } catch (Exception ex) {
- addError("Evaluator class instanciation failed");
- }
+ public void setTriggeringPolicy(TriggeringPolicy triggeringPolicy) {
+ this.triggeringPolicy = triggeringPolicy;
}
-
+
public Layout getLayout() {
return layout;
}
Modified: logback/trunk/logback-examples/src/main/java/chapter4/mail/EMail.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/mail/EMail.java (original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/mail/EMail.java Mon Nov 13 18:27:38 2006
@@ -20,7 +20,7 @@
/**
* This application generates log messages in numbers specified by the
- * user. It is intended to let users test RollingFileAppender. See
+ * user. See
* also configuration scripts rolling.properties and rolling.xml.
* */
public class EMail {
Modified: logback/trunk/logback-examples/src/main/java/chapter4/mail/mail3.xml
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/mail/mail3.xml (original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/mail/mail3.xml Mon Nov 13 18:27:38 2006
@@ -2,12 +2,12 @@
<!-- ============================================================= -->
<!-- Sample SMTPAppender configuration using the HTMLLayout and a -->
-<!-- custom trigger event evaluator. -->
+<!-- custom triggering policy. -->
<!-- ============================================================= -->
<configuration>
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
- <EvaluatorClass>chapter4.mail.CounterBasedTP</EvaluatorClass>
+ <TriggeringPolicy class="chapter4.mail.CounterBasedTP" />
<BufferSize>1050</BufferSize>
<SMTPHost>${smtpHost}</SMTPHost>
<To>${to}</To>
Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml (original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml Mon Nov 13 18:27:38 2006
@@ -203,6 +203,13 @@
that are dynamically inferred using JavaBeans introspection. </p>
<h2>Logback Core</h2>
+
+ <p>
+ Core is logback's central module. It offers functionnalities that are available
+ to any other module based on logback core. The <code>Appender</code> classes
+ contained in the core module are can be used by any module without any customization.
+ </p>
+
<a name="WriterAppender" />
<h3>WriterAppender</h3>
@@ -314,7 +321,7 @@
ensures that all
appenders in the hierarchy are closed and their buffers are flushed. The
<code>ExitWoes2</code> class uses this statement and outputs a logging
- request. <b>DOES NOT WORK ??</b>
+ request.
</p>
<p>
@@ -375,7 +382,7 @@
<b><appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%-4relative [%thread] %-5level - %msg %n</Pattern>
+ <Pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</Pattern>
</layout>
</appender></b>
@@ -387,8 +394,8 @@
<p>
To run this example, as well as others in this
- chapter, please add the <em>logback-examples-VERSION.hjar</em> to your classpath.
- Then, use the provided <code>ConfigurationTester</code> by
+ chapter, please run the script provided in logback's main directory.
+ Then, use the <code>ConfigurationTester</code> by
issuing the following command, once in the <em>logback-examples</em> directory:
</p>
@@ -501,22 +508,22 @@
<em>Example 4.3: FileAppender configuration (logback-examples/src/main/java/chapter4/conf/logback-fileAppender.xml)</em>
<div class="source"><pre><configuration>
- <b><appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <File>testFile.log</File>
- <Append>true</Append>
- <Encoding>UTF-8</Encoding>
- <BufferedIO>false</BufferedIO>
- <ImmediateFlush>true</ImmediateFlush>
-
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
- </layout>
- </appender></b>
-
- <root>
- <level value="debug" />
- <appender-ref ref="FILE" />
- </root>
+ <b><appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <File>testFile.log</File>
+ <Append>true</Append>
+ <Encoding>UTF-8</Encoding>
+ <BufferedIO>false</BufferedIO>
+ <ImmediateFlush>true</ImmediateFlush>
+
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
+ </layout>
+ </appender></b>
+
+ <root>
+ <level value="debug" />
+ <appender-ref ref="FILE" />
+ </root>
</configuration></pre></div>
<p>
@@ -597,7 +604,7 @@
<td><code>RollingPolicy</code></td>
<td>
This option is the component that will dictate
- <code>RollingFileAppender</code>'s behaviour when the rollover
+ <code>RollingFileAppender</code>'s behaviour when rollover
occurs. See more information below.
</td>
</tr>
@@ -616,9 +623,9 @@
<p><a href="../xref/ch/qos/logback/core/rolling/RollingPolicy.html"><code>RollingPolicy</code></a>
implementations are responsible for the
- procedure of the rollover. They manage file renaming and sometimes deleting.</p>
+ rollover procedure. They manage file renaming and in occasion file deleting.</p>
- <p>The <code>RollingPolicy</code> interface is rather simple:</p>
+ <p>The <code>RollingPolicy</code> interface is presented below:</p>
<div class="source"><pre>package ch.qos.logback.core.rolling;
@@ -650,7 +657,7 @@
<p>
The <span class="option">File</span> option, which is configured in the
<code>FileAppender</code> element, is required. It represents the name of the file
- where current logging output will be written. The <span class="option">FileNamePattern</span>
+ to write to. The <span class="option">FileNamePattern</span>
option represents the file name pattern for the archived (rolled over) log files.
The <span class="option">FileNamePattern</span> option, which is also required, must include
an integer token, that is the string <em>%i</em>
@@ -1015,10 +1022,10 @@
<p>
As we have seen, the <span class="option">FileNamePattern</span> serves two purposes. First,
by studying the pattern, logback computes the requested rollover periodicity. Second,
- it uses the pattern to custom each rolled files. It is entirely possible for two different
+ it computes each files' name based on the pattern. It is entirely possible for two different
file name patterns to specify the same periodicity.
The date patterns <em>yyyy-MM</em> and <em>yyyy@MM</em> both specify monthly
- rollover periodicity, although the rolled files will carry different customizations.
+ rollover periodicity, although the rolled files will carry different names.
</p>
<p>
@@ -1094,7 +1101,7 @@
<p><a href="../xref/ch/qos/logback/core/rolling/TriggeringPolicy.html"><code>TriggeringPolicy</code></a>
implementations are responsible for instructing
- the <code>RollingFileAppender</code> to proceed to the rollover.</p>
+ the <code>RollingFileAppender</code> to rollover.</p>
<p>The <code>TriggeringPolicy</code> interface is pretty simple.</p>
@@ -1105,7 +1112,7 @@
public interface TriggeringPolicy extends LifeCycle {
- <b>public boolean isTriggeringEvent(final File file, final Object event);</b>
+ <b>public boolean isTriggeringEvent(final File activeFile, final Object event);</b>
}</pre></div>
<p>
@@ -1124,7 +1131,7 @@
<a href="../xref/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.html">
<code>SizeBasedTriggeringPolicy</code></a>
looks at size of the file being currently written to. If it
- grows bigger than the specified size, the
+ grows larger than the specified size, the
<code>FileAppender</code> using the
<code>SizeBasedTriggeringPolicy</code>
will proceed to the rollover of the current file and log to
@@ -1200,10 +1207,10 @@
they are instances of the <code>LoggingEvent</code> class in logback classic.</p>
<a name="SocketAppender" />
- <h3>SockerAppender</h3>
+ <h3>SocketAppender</h3>
<p>
- The appenders covered this far were only able to log to local resources.
+ The appenders covered this far were only able to log on local resources.
In contrast, the <a href="../xref/ch/qos/logback/classic/net/SocketAppender.html">
<code>SocketAppender</code></a> is designed to log to a
remote entity by transmitting serialized <code>LoggingEvent</code> objects over the wire.
@@ -1211,7 +1218,8 @@
On the receiving end after de-serialization, the event can be logged as
if it were generated locally. Multiple <code>SocketAppender</code> instances
running of different machines can direct their logging output
- to a central log server. <code>SocketAppender</code> does not admit an
+ to a central log server whose format is fixed.
+ <code>SocketAppender</code> does not admit an
associated layout because it sends serialized events to a remote server.
<code>SocketAppender</code> operates above the
<em>Transmission Control Protocol (TCP)</em>
@@ -1233,7 +1241,7 @@
network rate. In particular, in the extreme case where the network link
to the server is down, the client will be eventually blocked.
Alternatively, if the network link is up, but the server is down,
- the client will not be blocked although the log events will be
+ the client will not be blocked, although the log events will be
lost due to server unavailability.
</p>
@@ -1357,7 +1365,7 @@
<code>SimpleSocketServer</code>
the client will transparently reconnect to the new server
instance, although the events generated while disconnected
- will be simply and irrevocably lost.
+ will be simply (and irrevocably) lost.
</p>
<p>
@@ -1410,8 +1418,8 @@
Allow us to repeat for emphasis that serialization of logging events is not
intrusive. A de-serialized event carries the same information as any other
logging event. It can be manipulated as if it were generated locally;
- except that serialized logging events by default do not include location
- information. Here is an example to illustrate the point. First, start
+ except that serialized logging events by default do not include caller
+ data. Here is an example to illustrate the point. First, start
<code>SimpleSocketServer</code> with the following command:
</p>
@@ -1509,7 +1517,7 @@
</p>
<p>
By default, <code>SMTPAppender</code> will form a subject with
- the message of the last logging event.
+ logger name and the message of the last logging event.
</p>
</td>
</tr>
@@ -1525,16 +1533,22 @@
</td>
</tr>
<tr>
- <td><b><span class="option">EvaluatorClass</span></b></td>
+ <td><b><span class="option">TriggeringPolicy</span></b></td>
<td><code>String</code></td>
<td>
- The <span class="option">EvaluatorClass</span> option takes a string
- value representing the name of the class implementing the
- <code>TriggeringPolicy</code> interface. A corresponding object will be
- instantiated and assigned as the triggering event evaluator for the
- <code>SMTPAppender</code>. In the absence of this option,
- <code>SMTPAppender</code> is assigned a default evaluator which triggers
+ <p>This option is declared by creating a new <code><TriggeringPolicy/></code>
+ element. The name of the class that the user wishes to use as the
+ <code>SMTPAppender</code>'s <code>TriggeringPolicy</code> can be given
+ by adding an attribute to the newly created element.
+ </p>
+ <p>
+ More details about the use of triggering policies with <code>SMTPAppender</code>
+ follow further down this document.
+ </p>
+ <p>In the absence of this option,
+ <code>SMTPAppender</code> is assigned a default triggering policy which triggers
email transmission as a response to any event of level <em>ERROR</em> or higher.
+ </p>
</td>
</tr>
</table>
@@ -1544,7 +1558,7 @@
in its cyclic buffer, throwing away older events when its buffer becomes full.
The number of logging events delivered in any e-mail sent by <code>SMTPAppender</code>
is upper-bounded by <span class="option">BufferSize</span>. This keeps memory
- requirements bounded while still delivering the desired amount of application context.
+ requirements bounded while still delivering a reasonable amount of application context.
</p>
<p>
@@ -1578,7 +1592,7 @@
<To>DESTINATION-EMAIL</To>
<From>SENDER-EMAIL</From>
<layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%date %-5level %logger - %message%n</Pattern>
+ <Pattern>%date %-5level %logger{35} - %message%n</Pattern>
</layout>
</appender>
@@ -1593,10 +1607,10 @@
configuration file, you must set the <span class="option">SMTPHost</span>,
<span class="option">To</span> and <span class="option">From</span> options
to values appropriate for your environment. Once you have set the proper values,
- execute the following command:
+ change directory to <em>logback-examples</em> and execute the following command:
</p>
-<div class="source"><pre>java chapter4.mail.EMail 300 chapter4/mail/mail.xml</pre></div>
+<div class="source"><pre>java chapter4.mail.EMail 300 src/main/java/chapter4/mail/mail.xml</pre></div>
<p>
The chosen recipient should see an email message containing 300 logging events
@@ -1624,7 +1638,7 @@
</p>
<div class="source"><pre>java -Dfrom=source(a)xyz.com -Dto=recipient(a)xyz.com
- -DsmtpHost=some_smtp_host chapter4.mail.EMail 10000 chapter4/mail/mail2.xml
+ -DsmtpHost=some_smtp_host src/main/java/chapter4.mail.EMail 10000 chapter4/mail/mail2.xml
</pre></div>
<p>
@@ -1667,7 +1681,7 @@
static int LIMIT = 1024;
int counter = 0;
- public boolean isTriggeringEvent(File file, Object event) {
+ public boolean isTriggeringEvent(File activeFile, Object event) {
counter++;
if (counter == LIMIT) {
@@ -1684,15 +1698,15 @@
Note that this implementation extends <code>TriggeringPolicyBase</code> instead
of implementing <code>TriggeringPolicy</code>. This allows the user to concentrate
on the core functions of her <code>TriggeringPolicy</code> and let the base class
- manage the other functionnalities.
+ provide the common functionnality.
</p>
<p>
- Setting the <span class="option">EvaluatorClass</span> option of
- <code>SMTPAppender</code> instructs it to use a custom evaluator.
+ Setting the <span class="option">TriggeringPolicy</span> option of
+ <code>SMTPAppender</code> instructs it to use a custom triggering policy.
The next configuration file attaches a <code>SMTPAppender</code> to the root logger.
This appender has a buffer size of 2048 and uses a <code>CounterBasedTP</code> instance
- as its triggering event evaluator.
+ as its triggering policy.
</p>
<em>Example 4.10: <code>SMTPAppender</code> with custom
@@ -1700,7 +1714,7 @@
<div class="source"><pre><configuration>
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
- <b><EvaluatorClass>chapter4.mail.CounterBasedTP</EvaluatorClass></b>
+ <b><TriggeringPolicy class="chapter4.mail.CounterBasedTP" /></b>
<BufferSize>1050</BufferSize>
<SMTPHost>${smtpHost}</SMTPHost>
<To>${to}</To>
1
0