[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.21-4-ga3d37a0

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Thu May 27 14:18:26 CEST 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  a3d37a0a47c061d7c8fa5185f2c1948ff9cf053d (commit)
      from  2e841425b8fc704719db6d1f1e18af2215ea1fb5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=a3d37a0a47c061d7c8fa5185f2c1948ff9cf053d
http://github.com/ceki/logback/commit/a3d37a0a47c061d7c8fa5185f2c1948ff9cf053d

commit a3d37a0a47c061d7c8fa5185f2c1948ff9cf053d
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu May 27 14:16:10 2010 +0200

    ongoing work on the docs

diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/GEventEvaluator.java b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/GEventEvaluator.java
index 72a7bad..04687e2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/GEventEvaluator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/GEventEvaluator.java
@@ -1,86 +1,86 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- *   or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-
-package ch.qos.logback.classic.boolex;
-
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.boolex.EvaluationException;
-import ch.qos.logback.core.boolex.EventEvaluator;
-import ch.qos.logback.core.boolex.EventEvaluatorBase;
-import ch.qos.logback.core.util.FileUtil;
-import groovy.lang.*;
-import org.codehaus.groovy.control.CompilationFailedException;
-
-/**
- * @author Ceki G&uuml;lc&uuml;
- */
-public class GEventEvaluator extends EventEvaluatorBase<ILoggingEvent> {
-
-  String expression;
-
-  IEvaluator delegateEvaluator;
-  Script script;
-
-  public String getExpression() {
-    return expression;
-  }
-
-  public void setExpression(String expression) {
-    this.expression = expression;
-  }
-
-  public void start() {
-    if (expression == null || expression.length() == 0) {
-      addError("Empty expression");
-      return;
-    } else {
-      addInfo("Expression to evaluate [" + expression + "]");
-    }
-
-
-    ClassLoader classLoader = getClass().getClassLoader();
-    String currentPackageName = this.getClass().getPackage().getName();
-    currentPackageName = currentPackageName.replace('.', '/');
-
-    String scriptText = FileUtil.resourceAsString(this, classLoader, currentPackageName + "/EvaluatorTemplate.groovy");
-    if(scriptText == null) {
-      return;
-    }
-
-    // insert the expression into script text
-    scriptText = scriptText.replace("//EXPRESSION", expression);
-
-    GroovyClassLoader gLoader = new GroovyClassLoader(classLoader);
-    try {
-      Class scriptClass = gLoader.parseClass(scriptText);
-
-      GroovyObject goo = (GroovyObject) scriptClass.newInstance();
-      delegateEvaluator = (IEvaluator) goo;
-
-    } catch (CompilationFailedException cfe) {
-      addError("Failed to compile expression [" + expression + "]", cfe);
-    } catch (Exception e) {
-      addError("Failed to compile expression [" + expression + "]", e);
-    }
-  }
-
-  public boolean evaluate(ILoggingEvent event) throws NullPointerException, EvaluationException {
-    if(delegateEvaluator == null) {
-      return false;
-    }
-    return delegateEvaluator.doEvaluate(event);
-  }
-
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ *   or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+
+package ch.qos.logback.classic.boolex;
+
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.boolex.EvaluationException;
+import ch.qos.logback.core.boolex.EventEvaluator;
+import ch.qos.logback.core.boolex.EventEvaluatorBase;
+import ch.qos.logback.core.util.FileUtil;
+import groovy.lang.*;
+import org.codehaus.groovy.control.CompilationFailedException;
+
+/**
+ * @author Ceki G&uuml;lc&uuml;
+ */
+public class GEventEvaluator extends EventEvaluatorBase<ILoggingEvent> {
+
+  String expression;
+
+  IEvaluator delegateEvaluator;
+  Script script;
+
+  public String getExpression() {
+    return expression;
+  }
+
+  public void setExpression(String expression) {
+    this.expression = expression;
+  }
+
+  public void start() {
+    if (expression == null || expression.length() == 0) {
+      addError("Empty expression");
+      return;
+    } else {
+      addInfo("Expression to evaluate [" + expression + "]");
+    }
+
+
+    ClassLoader classLoader = getClass().getClassLoader();
+    String currentPackageName = this.getClass().getPackage().getName();
+    currentPackageName = currentPackageName.replace('.', '/');
+
+    String scriptText = FileUtil.resourceAsString(this, classLoader, currentPackageName + "/EvaluatorTemplate.groovy");
+    if(scriptText == null) {
+      return;
+    }
+
+    // insert the expression into script text
+    scriptText = scriptText.replace("//EXPRESSION", expression);
+
+    GroovyClassLoader gLoader = new GroovyClassLoader(classLoader);
+    try {
+      Class scriptClass = gLoader.parseClass(scriptText);
+
+      GroovyObject goo = (GroovyObject) scriptClass.newInstance();
+      delegateEvaluator = (IEvaluator) goo;
+
+    } catch (CompilationFailedException cfe) {
+      addError("Failed to compile expression [" + expression + "]", cfe);
+    } catch (Exception e) {
+      addError("Failed to compile expression [" + expression + "]", e);
+    }
+  }
+
+  public boolean evaluate(ILoggingEvent event) throws NullPointerException, EvaluationException {
+    if(delegateEvaluator == null) {
+      return false;
+    }
+    return delegateEvaluator.doEvaluate(event);
+  }
+
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicy.java
index cab4c4b..1847422 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicy.java
@@ -1,84 +1,84 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- *   or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.core.rolling;
-
-import ch.qos.logback.core.rolling.helper.ArchiveRemover;
-import ch.qos.logback.core.spi.ContextAware;
-
-/**
- * This interface lists the set of methods that need to be implemented by
- * triggering policies which are nested within a {@link TimeBasedRollingPolicy}.
- * 
- * @author Ceki G&uuml;lc&uuml;
- * 
- * @param <E>
- */
-public interface TimeBasedFileNamingAndTriggeringPolicy<E> extends
-    TriggeringPolicy<E>, ContextAware {
-
-  /**
-   * Set the host/parent {@link TimeBasedRollingPolicy}.
-   * 
-   * @param tbrp
-   *                parent TimeBasedRollingPolicy
-   */
-  void setTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> tbrp);
-
-  /**
-   * Return the file name for the elapsed periods file name.
-   * 
-   * @return
-   */
-  String getElapsedPeriodsFileName();
-
-  /**
-   * Return the current periods file name without the compression suffix. This
-   * value is equivalent to the active file name.
-   * 
-   * @return current period's file name (without compression suffix)
-   */
-  String getCurrentPeriodsFileNameWithoutCompressionSuffix();
-
-  /**
-   * Return the archive remover appropriate for this instance.
-   */
-  public ArchiveRemover getArchiveRemover();
-  
-  /**
-   * Return the current time which is usually the value returned by
-   * System.currentMillis(). However, for <b>testing</b> purposed this value
-   * may be different than the real time.
-   * 
-   * @return current time value
-   */
-  long getCurrentTime();
-
-  /**
-   * Set the current time. Only unit tests should invoke this method.
-   * 
-   * @param now
-   */
-  void setCurrentTime(long now);
-
-  /**
-   * Set some date in the current period. Only unit tests should invoke this
-   * method.
-   * 
-   * WARNING: method removed. A unit test should not set the
-   * date in current period. It is the job of the FNATP to compute that.
-   * 
-   * @param date
-   */
-  //void setDateInCurrentPeriod(Date date); 
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ *   or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.rolling;
+
+import ch.qos.logback.core.rolling.helper.ArchiveRemover;
+import ch.qos.logback.core.spi.ContextAware;
+
+/**
+ * This interface lists the set of methods that need to be implemented by
+ * triggering policies which are nested within a {@link TimeBasedRollingPolicy}.
+ * 
+ * @author Ceki G&uuml;lc&uuml;
+ * 
+ * @param <E>
+ */
+public interface TimeBasedFileNamingAndTriggeringPolicy<E> extends
+    TriggeringPolicy<E>, ContextAware {
+
+  /**
+   * Set the host/parent {@link TimeBasedRollingPolicy}.
+   * 
+   * @param tbrp
+   *                parent TimeBasedRollingPolicy
+   */
+  void setTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> tbrp);
+
+  /**
+   * Return the file name for the elapsed periods file name.
+   * 
+   * @return
+   */
+  String getElapsedPeriodsFileName();
+
+  /**
+   * Return the current periods file name without the compression suffix. This
+   * value is equivalent to the active file name.
+   * 
+   * @return current period's file name (without compression suffix)
+   */
+  String getCurrentPeriodsFileNameWithoutCompressionSuffix();
+
+  /**
+   * Return the archive remover appropriate for this instance.
+   */
+  public ArchiveRemover getArchiveRemover();
+  
+  /**
+   * Return the current time which is usually the value returned by
+   * System.currentMillis(). However, for <b>testing</b> purposed this value
+   * may be different than the real time.
+   * 
+   * @return current time value
+   */
+  long getCurrentTime();
+
+  /**
+   * Set the current time. Only unit tests should invoke this method.
+   * 
+   * @param now
+   */
+  void setCurrentTime(long now);
+
+  /**
+   * Set some date in the current period. Only unit tests should invoke this
+   * method.
+   * 
+   * WARNING: method removed. A unit test should not set the
+   * date in current period. It is the job of the FNATP to compute that.
+   * 
+   * @param date
+   */
+  //void setDateInCurrentPeriod(Date date); 
+}
diff --git a/logback-site/src/site/pages/css/common.css b/logback-site/src/site/pages/css/common.css
index bc6a4fa..1d3489b 100644
--- a/logback-site/src/site/pages/css/common.css
+++ b/logback-site/src/site/pages/css/common.css
@@ -76,7 +76,7 @@ h2 {
 }
 
 h3 {
-  font-weight: normal;
+  font-weight: bold;
   font-size: large;
 }
 
diff --git a/logback-site/src/site/pages/manual/groovy.html b/logback-site/src/site/pages/manual/groovy.html
index 78d89b8..440aa78 100644
--- a/logback-site/src/site/pages/manual/groovy.html
+++ b/logback-site/src/site/pages/manual/groovy.html
@@ -42,23 +42,68 @@
 
 
     <p>Domains-specific languages are rather pervasive. The XML-based
-    logback configuration can be be viewed as an example of a DSL. By
-    the very nature of XML, XML-based configuration files are quite
-    verbose and bulky. Moreover, a relatively large body of code in
-    logback, namely Joran, is dedicated to processes these XML-based
+    logback configuration can be viewed as an example DSL. By the very
+    nature of XML, XML-based configuration files are quite verbose and
+    bulky. Moreover, a relatively large body of code in logback,
+    namely Joran, is dedicated to processes these XML-based
     configuration files. Joran supports nifty features such as
-    variable subsitution, conditional processing and on-the-fly
-    extensibility. Not only Joran is a complex beast, the
+    variable substitution, conditional processing and on-the-fly
+    extensibility. However, not only Joran is a complex beast, the
     user-experience it provides can be described as unsatisfactory or
     at the very least unintuitive.
     </p>
 
     <p>The Groovy-based DSL described in this chapter aims to be
     consistent, intuitive, and powerful. Everything you can do XML in
-    configuration files, you can do in Groovy in a much shorter
-    syntax. There is even a tool to automatically migrate XML
+    configuration files, you can do in Groovy with a much shorter
+    syntax. To help you migrate to Groovy style configuration, we have
+    developped a <a
+    href="http://logback.qos.ch/translator/asGroovy.html">tool to
+    automatically migrate your <em>logback.xml</em> files to
+    <em>logback.groovy</em></a>.
+    </p>
+
+
+    <h2>General philosophy</h2>
+    
+    <p>As a general rule, <em>logback.groovy</em> files are groovy
+    programs. And since groovy is a super-set of Java, whatever
+    configuration actions you can perform in Java, you can do the same
+    within a <em>logback.groovy</em> file. However, since configuring
+    logback progammatically using Java syntax can be very cumbersome,
+    we added a few logback-specific extensions to make your life
+    easier. We limited the number of such logback-specific extensions
+    to an absolute minimum. If you are already familiar with groovy,
+    you should be able to read, understand and even write your own
+    logback.groovy files with great ease. Those unfamiliar with Groovy
+    should still find logback.groovy syntax much more comfortable to
+    use than logback.xml.
+    </p>
+
+    <p>Logback.groovy syntax consists of 6 methods described next in
+    their customary order of appearance. Strictly speaking the order
+    of invocation of the methods does matter except that appenders
+    MUST be defined before they can be attached to a logger.</p>
+
+    <h3><code>scan(String scanPeriodStr = null)</code> method</h3>
+
+    <p>Invoking the scan() method instructs logback to periodically
+    scan the logback.groovy file for changes. Whenever a change is
+    detected, the logback.groovy file is reloaded.</p>
+
+    <h3>statusListener(Class listenerClass)</h3>
+    
+    <h3>conversionRule(String conversionWord, Class converterClass)</h3>
+
+
+    <h3> root(Level level, List<String> appenderNames = [])</String>
+
+    <h3>logger(String name, Level level, List<String> appenderNames = [], Boolean additivity = null)</String>
+
+    <h3>appender(String name, Class clazz, Closure closure = null)</h3>
 
 
+    <script src="../templates/footer.js" type="text/javascript"></script>
 
     </div>
   </body>

-----------------------------------------------------------------------

Summary of changes:
 .../logback/classic/boolex/GEventEvaluator.java    |  172 ++++++++++----------
 .../TimeBasedFileNamingAndTriggeringPolicy.java    |  168 ++++++++++----------
 logback-site/src/site/pages/css/common.css         |    2 +-
 logback-site/src/site/pages/manual/groovy.html     |   61 ++++++-
 4 files changed, 224 insertions(+), 179 deletions(-)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list