[logback-dev] svn commit: r2181 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic/sift logback-core/src/main/java/ch/qos/logback/core/sift
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Thu Mar 5 17:58:27 CET 2009
Author: ceki
Date: Thu Mar 5 17:58:27 2009
New Revision: 2181
Modified:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderFactoryBase.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/Discriminator.java
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java
Log:
- cosmetic changes in variable names
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java Thu Mar 5 17:58:27 2009
@@ -19,15 +19,15 @@
public class AppenderFactory extends AppenderFactoryBase<ILoggingEvent>{
- String mdcKey;
+ String key;
- AppenderFactory(Context context, List<SaxEvent> eventList, String mdcKey) {
+ AppenderFactory(Context context, List<SaxEvent> eventList, String key) {
super(context, eventList);
- this.mdcKey = mdcKey;
+ this.key = key;
}
- public SiftingJoranConfiguratorBase<ILoggingEvent> getSiftingJoranConfigurator(String k) {
- return new SiftingJoranConfigurator(mdcKey, k);
+ public SiftingJoranConfiguratorBase<ILoggingEvent> getSiftingJoranConfigurator(String discriminatingValue) {
+ return new SiftingJoranConfigurator(key, discriminatingValue);
}
}
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java Thu Mar 5 17:58:27 2009
@@ -36,7 +36,7 @@
}
/**
- * Return the value associated with an MDC entry desginated by the Key
+ * Return the value associated with an MDC entry designated by the Key
* property. If that value is null, then return the value assigned to the
* DefaultValue property.
*/
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderFactoryBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderFactoryBase.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderFactoryBase.java Thu Mar 5 17:58:27 2009
@@ -36,8 +36,8 @@
public abstract SiftingJoranConfiguratorBase<E> getSiftingJoranConfigurator(String k);
- Appender<E> buildAppender(Context context, String k) throws JoranException {
- SiftingJoranConfiguratorBase<E> sjc = getSiftingJoranConfigurator(k);
+ Appender<E> buildAppender(Context context, String discriminatingValue) throws JoranException {
+ SiftingJoranConfiguratorBase<E> sjc = getSiftingJoranConfigurator(discriminatingValue);
sjc.setContext(context);
sjc.doConfigure(eventList);
return sjc.getAppender();
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/Discriminator.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/Discriminator.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/Discriminator.java Thu Mar 5 17:58:27 2009
@@ -11,8 +11,30 @@
import ch.qos.logback.core.spi.LifeCycle;
-
+/**
+ * Implement this interface in order to compute a discriminating value for a
+ * given event of type <E>.
+ *
+ * <p>The returned value can depend on any data available at the time of the
+ * call, including data contained within the currently running thread.
+ *
+ * @author Ceki Gülcü
+ *
+ * @param <E>
+ */
public interface Discriminator<E> extends LifeCycle {
+
+ /**
+ * Given event 'e' return a discriminating value.
+ *
+ * @param e
+ * @return
+ */
String getDiscriminatingValue(E e);
+
+ /**
+ *
+ * @return
+ */
String getKey();
}
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java Thu Mar 5 17:58:27 2009
@@ -65,19 +65,19 @@
return;
}
- String value = discriminator.getDiscriminatingValue(event);
+ String discriminatingValue = discriminator.getDiscriminatingValue(event);
long timestamp = getTimestamp(event);
- Appender<E> appender = appenderTracker.get(value, timestamp);
+ Appender<E> appender = appenderTracker.get(discriminatingValue, timestamp);
if (appender == null) {
try {
- appender = appenderFactory.buildAppender(context, value);
+ appender = appenderFactory.buildAppender(context, discriminatingValue);
if (appender != null) {
- appenderTracker.put(value, appender, timestamp);
+ appenderTracker.put(discriminatingValue, appender, timestamp);
}
} catch (JoranException e) {
- addError("Failed to build appender for [" + value + "]", e);
+ addError("Failed to build appender for [" + discriminatingValue + "]", e);
return;
}
}
More information about the logback-dev
mailing list