[logback-dev] svn commit: r2056 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic logback-classic/src/main/java/ch/qos/logback/classic/joran/action logback-classic/src/main/java/ch/qos/logback/classic/pattern logback-classic/src/test/java/ch/qos/logback/classic logback-classic/src/test/java/ch/qos/logback/classic/pattern logback-core/src/main/java/ch/qos/logback/core/joran/action logback-core/src/main/java/ch/qos/logback/core/pattern
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Thu Dec 4 20:39:39 CET 2008
Author: ceki
Date: Thu Dec 4 20:39:39 2008
New Revision: 2056
Added:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ContextNameConverter.java
Modified:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/PatternLayout.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/InsertFromJNDIAction.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassicConverter.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/MDCTest.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/MessageFormattingTest.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PackageTest.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/pattern/LiteralConverter.java
Log:
- Added ContextNameConverter displaying the logger context's name.
- migrated some tests to JUnit4 format
- other cosmetic changes
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/PatternLayout.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/PatternLayout.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/PatternLayout.java Thu Dec 4 20:39:39 2008
@@ -12,10 +12,12 @@
import java.util.HashMap;
import java.util.Map;
+import ch.qos.logback.classic.joran.action.ContextNameAction;
import ch.qos.logback.classic.pattern.CallerDataConverter;
-import ch.qos.logback.classic.pattern.EnsureExceptionHandling;
import ch.qos.logback.classic.pattern.ClassOfCallerConverter;
+import ch.qos.logback.classic.pattern.ContextNameConverter;
import ch.qos.logback.classic.pattern.DateConverter;
+import ch.qos.logback.classic.pattern.EnsureExceptionHandling;
import ch.qos.logback.classic.pattern.ExtendedThrowableProxyConverter;
import ch.qos.logback.classic.pattern.FileOfCallerConverter;
import ch.qos.logback.classic.pattern.LevelConverter;
@@ -107,6 +109,9 @@
defaultConverterMap.put("nopexception",
NopThrowableInformationConverter.class.getName());
+ defaultConverterMap.put("cn", ContextNameAction.class.getName());
+ defaultConverterMap.put("contextName", ContextNameConverter.class.getName());
+
defaultConverterMap.put("caller", CallerDataConverter.class.getName());
defaultConverterMap.put("marker", MarkerConverter.class.getName());
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/InsertFromJNDIAction.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/InsertFromJNDIAction.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/InsertFromJNDIAction.java Thu Dec 4 20:39:39 2008
@@ -60,6 +60,7 @@
if(OptionHelper.isEmpty(envEntryValue)) {
addError("["+envEntryName+"] has null or empty value");
} else {
+ addInfo("Setting context variable ["+asName+"] to ["+envEntryValue+"]");
context.putProperty(asName, envEntryValue);
}
} catch (NamingException e) {
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassicConverter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassicConverter.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassicConverter.java Thu Dec 4 20:39:39 2008
@@ -19,7 +19,7 @@
/**
- * This class serves the super-class of all converters in LOGBack. It extends
+ * This class serves the super-class of all converters in logback. It extends
* {@link DynamicConverter} and also implements {@link LoggerContextAware}.
*
* @author Ceki Gulcu
Added: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ContextNameConverter.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ContextNameConverter.java Thu Dec 4 20:39:39 2008
@@ -0,0 +1,28 @@
+/**
+ * Logback: the generic, reliable, fast and flexible logging framework.
+ *
+ * Copyright (C) 2000-2008, 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.classic.pattern;
+
+import ch.qos.logback.classic.spi.LoggingEvent;
+
+/**
+ * Converts an event to the logger context's name.
+ *
+ * @author Ceki Gülcü
+ */
+public class ContextNameConverter extends ClassicConverter {
+
+ /**
+ * Return the name of the logger context's name.
+ */
+ public String convert(LoggingEvent event) {
+ return getContext().getName();
+ }
+
+}
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java Thu Dec 4 20:39:39 2008
@@ -9,6 +9,7 @@
*/
package ch.qos.logback.classic;
+import junit.framework.JUnit4TestAdapter;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -19,7 +20,7 @@
TestSuite suite = new TestSuite();
suite.addTest(org.slf4j.impl.PackageTest.suite());
- suite.addTest(ch.qos.logback.classic.PackageTest.suite());
+ suite.addTest(new JUnit4TestAdapter(ch.qos.logback.classic.PackageTest.class));
suite.addTest(ch.qos.logback.classic.util.PackageTest.suite());
suite.addTest(ch.qos.logback.classic.control.PackageTest.suite());
suite.addTest(ch.qos.logback.classic.joran.PackageTest.suite());
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/MDCTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/MDCTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/MDCTest.java Thu Dec 4 20:39:39 2008
@@ -1,29 +1,40 @@
+/**
+ * Logback: the generic, reliable, fast and flexible logging framework.
+ *
+ * Copyright (C) 2000-2008, 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.classic;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
-public class MDCTest extends TestCase {
+import org.junit.Test;
+public class MDCTest {
+ @Test
public void test() throws InterruptedException {
MDCTestThread threadA = new MDCTestThread("a");
threadA.start();
-
+
MDCTestThread threadB = new MDCTestThread("b");
threadB.start();
-
+
threadA.join();
threadB.join();
-
-
+
assertNull(threadA.x0);
assertEquals("a", threadA.x1);
assertNull(threadA.x2);
-
+
assertNull(threadB.x0);
assertEquals("b", threadB.x1);
assertNull(threadB.x2);
-
+
}
-
+
}
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/MessageFormattingTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/MessageFormattingTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/MessageFormattingTest.java Thu Dec 4 20:39:39 2008
@@ -9,15 +9,20 @@
*/
package ch.qos.logback.classic;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.read.ListAppender;
-public class MessageFormattingTest extends TestCase {
+public class MessageFormattingTest {
LoggerContext lc;
ListAppender<LoggingEvent> listAppender;
+ @Before
public void setUp() {
lc = new LoggerContext();
Logger logger = lc.getLogger(LoggerContext.ROOT_NAME);
@@ -27,6 +32,7 @@
logger.addAppender(listAppender);
}
+ @Test
public void testFormattingOneArg() {
Logger logger = lc.getLogger(LoggerContext.ROOT_NAME);
logger.debug("{}", new Integer(12));
@@ -34,6 +40,7 @@
assertEquals("12", event.getFormattedMessage());
}
+ @Test
public void testFormattingTwoArg() {
Logger logger = lc.getLogger(LoggerContext.ROOT_NAME);
logger.debug("{}-{}", new Integer(12), new Integer(13));
@@ -41,6 +48,7 @@
assertEquals("12-13", event.getFormattedMessage());
}
+ @Test
public void testNoFormatting() {
Logger logger = lc.getLogger(LoggerContext.ROOT_NAME);
logger.debug("test", new Integer(12), new Integer(13));
@@ -48,6 +56,7 @@
assertEquals("test", event.getFormattedMessage());
}
+ @Test
public void testNoFormatting2() {
Logger logger = lc.getLogger(LoggerContext.ROOT_NAME);
logger.debug("test");
@@ -55,6 +64,7 @@
assertEquals("test", event.getFormattedMessage());
}
+ @Test
public void testMessageConverter() {
Logger logger = lc.getLogger(LoggerContext.ROOT_NAME);
logger.debug("{}", 12);
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PackageTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PackageTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PackageTest.java Thu Dec 4 20:39:39 2008
@@ -9,21 +9,17 @@
*/
package ch.qos.logback.classic;
-import junit.framework.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
+ at RunWith(Suite.class)
+ at SuiteClasses( { LoggerContextTest.class, LoggerPerfTest.class,
+ ScenarioBasedLoggerContextTest.class, PatternLayoutTest.class,
+ LoggerTest.class, LoggerSerializationTest.class,
+ MessageFormattingTest.class, MDCTest.class,
+ TurboFilteringInLoggerTest.class })
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(LoggerContextTest.class));
- suite.addTest(new JUnit4TestAdapter(LoggerPerfTest.class));
- suite.addTest(new JUnit4TestAdapter(ScenarioBasedLoggerContextTest.class));
- suite.addTest(new JUnit4TestAdapter(PatternLayoutTest.class));
- suite.addTest(new JUnit4TestAdapter(LoggerTest.class));
- suite.addTest(new JUnit4TestAdapter(LoggerSerializationTest.class));
- suite.addTestSuite(MessageFormattingTest.class);
- suite.addTestSuite(MDCTest.class);
- suite.addTestSuite(TurboFilteringInLoggerTest.class);
- return suite;
- }
+
+public class PackageTest {
}
\ No newline at end of file
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java Thu Dec 4 20:39:39 2008
@@ -11,11 +11,13 @@
import static ch.qos.logback.classic.TestConstants.ISO_REGEX;
import static ch.qos.logback.classic.TestConstants.MAIN_REGEX;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
+import org.junit.Before;
import org.junit.Test;
import ch.qos.logback.classic.pattern.ConverterTest;
@@ -26,7 +28,9 @@
public class PatternLayoutTest extends AbstractPatternLayoutBaseTest {
- LoggerContext lc = new LoggerContext();
+
+ private PatternLayout pl = new PatternLayout();
+ private LoggerContext lc = new LoggerContext();
Logger logger = lc.getLogger(ConverterTest.class);
LoggingEvent le;
List optionList = new ArrayList();
@@ -36,7 +40,12 @@
Exception ex = new Exception("Bogus exception");
le = makeLoggingEvent(ex);
}
-
+
+ @Before
+ public void setUp() {
+ pl.setContext(lc);
+ }
+
LoggingEvent makeLoggingEvent(Exception ex) {
return new LoggingEvent(ch.qos.logback.core.pattern.FormattingConverter.class
.getName(), logger, Level.INFO, "Some message", ex, null);
@@ -53,10 +62,7 @@
@Test
public void testOK() {
- PatternLayout pl = new PatternLayout();
pl.setPattern("%d %le [%t] %lo{30} - %m%n");
- Context context = new LoggerContext();
- pl.setContext(context);
pl.start();
String val = pl.doLayout(getEventObject());
// 2006-02-01 22:38:06,212 INFO [main] c.q.l.pattern.ConverterTest - Some message
@@ -67,10 +73,7 @@
@Test
public void testNoExeptionHandler() {
- PatternLayout pl = new PatternLayout();
pl.setPattern("%m%n");
- Context context = new LoggerContext();
- pl.setContext(context);
pl.start();
String val = pl.doLayout(le);
assertTrue(val.contains("java.lang.Exception: Bogus exception"));
@@ -78,10 +81,7 @@
@Test
public void testCompositePattern() {
- PatternLayout pl = new PatternLayout();
pl.setPattern("%-56(%d %lo{20}) - %m%n");
- Context context = new LoggerContext();
- pl.setContext(context);
pl.start();
String val = pl.doLayout(getEventObject());
// 2008-03-18 21:55:54,250 c.q.l.c.pattern.ConverterTest - Some message
@@ -92,10 +92,7 @@
@Test
public void testNopExeptionHandler() {
- PatternLayout pl = new PatternLayout();
pl.setPattern("%nopex %m%n");
- Context context = new LoggerContext();
- pl.setContext(context);
pl.start();
String val = pl.doLayout(le);
assertTrue(!val.contains("java.lang.Exception: Bogus exception"));
@@ -103,10 +100,7 @@
@Test
public void testWithParenthesis() {
- PatternLayout pl = new PatternLayout();
pl.setPattern("\\(%msg:%msg\\) %msg");
- Context context = new LoggerContext();
- pl.setContext(context);
pl.start();
le = makeLoggingEvent(null);
String val = pl.doLayout(le);
@@ -116,11 +110,8 @@
@Test
public void testWithLettersComingFromLog4j() {
- PatternLayout pl = new PatternLayout();
//Letters: p = level and c = logger
pl.setPattern("%d %p [%t] %c{30} - %m%n");
- Context context = new LoggerContext();
- pl.setContext(context);
pl.start();
String val = pl.doLayout(getEventObject());
// 2006-02-01 22:38:06,212 INFO [main] c.q.l.pattern.ConverterTest - Some message
@@ -128,6 +119,15 @@
assertTrue(val.matches(regex));
}
+ @Test
+ public void contextNameTest() {
+ pl.setPattern("%contextName");
+ lc.setName("aValue");
+ pl.start();
+ String val = pl.doLayout(getEventObject());
+ assertEquals("aValue", val);
+ }
+
@Override
public Context getContext() {
return lc;
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java Thu Dec 4 20:39:39 2008
@@ -1,34 +1,36 @@
package ch.qos.logback.classic;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
import ch.qos.logback.classic.turbo.MarkerFilter;
import ch.qos.logback.classic.turbo.TurboFilter;
import ch.qos.logback.core.spi.FilterReply;
-import junit.framework.TestCase;
-public class TurboFilteringInLoggerTest extends TestCase {
+
+public class TurboFilteringInLoggerTest {
static final String BLUE = "BLUE";
LoggerContext context;
Logger logger;
Marker blueMarker = MarkerFactory.getMarker(BLUE);
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
context = new LoggerContext();
context.setName("test");
context.start();
logger = context.getLogger(TurboFilteringInLoggerTest.class);
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+
private void addYesFilter() {
YesFilter filter = new YesFilter();
filter.start();
@@ -57,78 +59,91 @@
context.addTurboFilter(filter);
}
+ @Test
public void testIsDebugEnabledWithYesFilter() {
addYesFilter();
logger.setLevel(Level.INFO);
assertTrue(logger.isDebugEnabled());
}
+ @Test
public void testIsInfoEnabledWithYesFilter() {
addYesFilter();
logger.setLevel(Level.WARN);
assertTrue(logger.isInfoEnabled());
}
+ @Test
public void testIsWarnEnabledWithYesFilter() {
addYesFilter();
logger.setLevel(Level.ERROR);
assertTrue(logger.isWarnEnabled());
}
+ @Test
public void testIsErrorEnabledWithYesFilter() {
addYesFilter();
logger.setLevel(Level.OFF);
assertTrue(logger.isErrorEnabled());
}
+ @Test
public void testIsEnabledForWithYesFilter() {
addYesFilter();
logger.setLevel(Level.ERROR);
assertTrue(logger.isEnabledFor(Level.INFO));
}
+ @Test
public void testIsEnabledForWithNoFilter() {
addNoFilter();
logger.setLevel(Level.DEBUG);
assertFalse(logger.isEnabledFor(Level.INFO));
}
+ @Test
public void testIsDebugEnabledWithNoFilter() {
addNoFilter();
logger.setLevel(Level.DEBUG);
assertFalse(logger.isDebugEnabled());
}
+ @Test
public void testIsInfoEnabledWithNoFilter() {
addNoFilter();
logger.setLevel(Level.DEBUG);
assertFalse(logger.isInfoEnabled());
}
+ @Test
public void testIsWarnEnabledWithNoFilter() {
addNoFilter();
logger.setLevel(Level.DEBUG);
assertFalse(logger.isWarnEnabled());
}
+ @Test
public void testIsErrorEnabledWithNoFilter() {
addNoFilter();
logger.setLevel(Level.DEBUG);
assertFalse(logger.isErrorEnabled());
}
+ @Test
public void testIsErrorEnabledWithAcceptBlueFilter() {
addAcceptBLUEFilter();
logger.setLevel(Level.ERROR);
assertTrue(logger.isDebugEnabled(blueMarker));
}
+ @Test
public void testIsErrorEnabledWithDenyBlueFilter() {
addDenyBLUEFilter();
logger.setLevel(Level.ALL);
assertFalse(logger.isDebugEnabled(blueMarker));
}
+ @Test
public void testLoggingContextReset() {
addYesFilter();
assertNotNull(context.getTurboFilterList().get(0));
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java Thu Dec 4 20:39:39 2008
@@ -9,7 +9,9 @@
*/
package ch.qos.logback.classic.pattern;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.List;
@@ -66,7 +68,7 @@
StringBuffer buf = new StringBuffer();
converter.write(buf, le);
// the number below should be the line number of the previous line
- assertEquals("67", buf.toString());
+ assertEquals("69", buf.toString());
}
}
@@ -132,14 +134,14 @@
@Test
public void testLogger() {
{
- DynamicConverter<LoggingEvent> converter = new LoggerConverter();
+ ClassicConverter converter = new LoggerConverter();
StringBuffer buf = new StringBuffer();
converter.write(buf, le);
assertEquals(this.getClass().getName(), buf.toString());
}
{
- DynamicConverter<LoggingEvent> converter = new LoggerConverter();
+ ClassicConverter converter = new LoggerConverter();
this.optionList.add("20");
converter.setOptionList(this.optionList);
converter.start();
@@ -317,4 +319,14 @@
assertEquals("someValue", result);
}
+ @Test
+ public void contextNameConverter() {
+ ClassicConverter converter = new ContextNameConverter();
+ converter.setContext(lc);
+ lc.setName("aValue");
+ LoggingEvent event = makeLoggingEvent(null);
+
+ String result = converter.convert(event);
+ assertEquals("aValue", result);
+ }
}
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java Thu Dec 4 20:39:39 2008
@@ -10,7 +10,6 @@
package ch.qos.logback.core.joran.action;
-
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
@@ -19,47 +18,46 @@
import ch.qos.logback.core.joran.spi.Interpreter;
import ch.qos.logback.core.spi.ContextAwareBase;
-
-
/**
- *
+ *
* Most of the work for configuring log4j is done by Actions.
- *
+ *
* <p>Methods of an Action are invoked while an XML file is parsed through.
- *
- * <p>This class is largely inspired from the relevant class in the commons-digester
- * project of the Apache Software Foundation.
- *
+ *
+ * <p>This class is largely inspired from the relevant class in the
+ * commons-digester project of the Apache Software Foundation.
+ *
* @author Craig McClanahan
* @author Christopher Lenz
* @author Ceki Gülcü
- *
+ *
*/
public abstract class Action extends ContextAwareBase {
-
+
public static final String NAME_ATTRIBUTE = "name";
public static final String VALUE_ATTRIBUTE = "value";
public static final String FILE_ATTRIBUTE = "file";
public static final String CLASS_ATTRIBUTE = "class";
public static final String PATTERN_ATTRIBUTE = "pattern";
-
+
public static final String ACTION_CLASS_ATTRIBUTE = "actionClass";
/**
* Called when the parser first encounters an element.
- *
+ *
* The return value indicates whether child elements should be processed. If
* the returned value is 'false', then child elements are ignored.
*/
- public abstract void begin(
- InterpretationContext ec, String name, Attributes attributes) throws ActionException ;
-
+ public abstract void begin(InterpretationContext ec, String name,
+ Attributes attributes) throws ActionException;
- public void body(InterpretationContext ec, String body) throws ActionException {
+ public void body(InterpretationContext ec, String body)
+ throws ActionException {
// NOP
}
- public abstract void end(InterpretationContext ec, String name) throws ActionException;
+ public abstract void end(InterpretationContext ec, String name)
+ throws ActionException;
public String toString() {
return this.getClass().getName();
@@ -82,4 +80,10 @@
}
return -1;
}
+
+ protected String getLineColStr(InterpretationContext ec) {
+ String line = "line: " + getLineNumber(ec) + ", column: "
+ + getColumnNumber(ec);
+ return line;
+ }
}
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/pattern/LiteralConverter.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/pattern/LiteralConverter.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/pattern/LiteralConverter.java Thu Dec 4 20:39:39 2008
@@ -1,11 +1,11 @@
/**
- * LOGBack: the reliable, fast and flexible logging library for Java.
- *
- * Copyright (C) 1999-2005, QOS.ch, LOGBack.com
- *
- * 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.
+ * Logback: the generic, reliable, fast and flexible logging framework.
+ *
+ * Copyright (C) 2000-2008, 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.core.pattern;
More information about the logback-dev
mailing list