[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-104-gd3a98f9

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Mon Mar 22 15:07:23 CET 2010


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

The branch, master has been updated
       via  d3a98f905ea1bffb7afda7fb4405c28238635a57 (commit)
      from  66fb7325add00aea9f037fc9e813f07df4648518 (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=d3a98f905ea1bffb7afda7fb4405c28238635a57
http://github.com/ceki/logback/commit/d3a98f905ea1bffb7afda7fb4405c28238635a57

commit d3a98f905ea1bffb7afda7fb4405c28238635a57
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Mon Mar 22 15:05:52 2010 +0100

    - added req. MDCInsertingServletFilter
    - minor refactoring in DBAppenderBase

diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java b/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
index 12fedc5..8958016 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
@@ -36,6 +36,7 @@ public class ClassicConstants {
   public final static String REQUEST_REMOTE_HOST_MDC_KEY = "req.remoteHost";
   public final static String REQUEST_USER_AGENT_MDC_KEY = "req.userAgent";
   public final static String REQUEST_REQUEST_URI = "req.requestURI";
+  public final static String REQUEST_QUERY_STRING = "req.queryString";
   public final static String REQUEST_REQUEST_URL = "req.requestURL";
   public final static String REQUEST_X_FORWARDED_FOR = "req.xForwardedFor";
   
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java
index 5efae36..ce2d74f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java
@@ -67,6 +67,7 @@ public class MDCInsertingServletFilter implements Filter {
       if (requestURL != null) {
         MDC.put(ClassicConstants.REQUEST_REQUEST_URL, requestURL.toString());
       }
+      MDC.put(ClassicConstants.REQUEST_QUERY_STRING, httpServletRequest.getQueryString());
       MDC.put(ClassicConstants.REQUEST_USER_AGENT_MDC_KEY, httpServletRequest
           .getHeader("User-Agent"));
       MDC.put(ClassicConstants.REQUEST_X_FORWARDED_FOR, httpServletRequest
@@ -78,6 +79,7 @@ public class MDCInsertingServletFilter implements Filter {
   void clearMDC() {
     MDC.remove(ClassicConstants.REQUEST_REMOTE_HOST_MDC_KEY);
     MDC.remove(ClassicConstants.REQUEST_REQUEST_URI);
+    MDC.remove(ClassicConstants.REQUEST_QUERY_STRING);
     // removing possibly inexistent item is OK
     MDC.remove(ClassicConstants.REQUEST_REQUEST_URL);
     MDC.remove(ClassicConstants.REQUEST_USER_AGENT_MDC_KEY);
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
index bee265d..bcac3ef 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
@@ -98,10 +98,9 @@ public abstract class DBAppenderBase<E> extends AppenderBase<E> {
       subAppend(eventObject, connection, insertStatement);
 
       // we no longer need the insertStatement
-      if (insertStatement != null) {
-        insertStatement.close();
-        insertStatement = null;
-      }
+      close(insertStatement);
+      insertStatement = null;
+      
       connection.commit();
     } catch (Throwable sqle) {
       addError("problem appending event", sqle);
@@ -137,9 +136,6 @@ public abstract class DBAppenderBase<E> extends AppenderBase<E> {
     }
 
     if (!gotGeneratedKeys) {
-      insertStatement.close();
-      insertStatement = null;
-
       idStatement = connection.createStatement();
       idStatement.setMaxRows(1);
       rs = idStatement.executeQuery(sqlDialect.getSelectInsertId());
@@ -152,14 +148,18 @@ public abstract class DBAppenderBase<E> extends AppenderBase<E> {
 
     rs.close();
 
-    if (idStatement != null) {
-      idStatement.close();
-      idStatement = null;
-    }
-
+    close(idStatement);
+    idStatement = null;
+    
     return eventId;
   }
 
+  void close(Statement statement) throws SQLException {
+    if(statement != null) {
+      statement.close();
+    }
+  }
+  
   @Override
   public void stop() {
     super.stop();
diff --git a/logback-site/src/site/pages/manual/mdc.html b/logback-site/src/site/pages/manual/mdc.html
index 9cf843b..b887d21 100644
--- a/logback-site/src/site/pages/manual/mdc.html
+++ b/logback-site/src/site/pages/manual/mdc.html
@@ -687,6 +687,14 @@ public class UserServletFilter implements Filter {
     </tr>
 
     <tr class="alt">
+      <td><code>req.queryString</code></td>
+      <td>
+        as returned by <a
+        href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html#getQueryString%28%29">getQueryString()</a>        method
+      </td>
+    </tr>
+
+    <tr>
       <td><code>req.userAgent</code></td>
       <td>value of the "User-Agent" header
       </td>
diff --git a/pom.xml b/pom.xml
index 3fcf402..d083acf 100755
--- a/pom.xml
+++ b/pom.xml
@@ -93,6 +93,12 @@
         <artifactId>hsqldb</artifactId>
         <version>1.8.0.7</version>
       </dependency>
+
+      <dependency>
+        <groupId>com.h2database</groupId>
+        <artifactId>h2</artifactId>
+        <version>1.2.131</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.tomcat</groupId>
         <artifactId>catalina</artifactId>

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

Summary of changes:
 .../ch/qos/logback/classic/ClassicConstants.java   |    1 +
 .../classic/helpers/MDCInsertingServletFilter.java |    2 +
 .../ch/qos/logback/core/db/DBAppenderBase.java     |   24 ++++++++++----------
 logback-site/src/site/pages/manual/mdc.html        |    8 ++++++
 pom.xml                                            |    6 +++++
 5 files changed, 29 insertions(+), 12 deletions(-)


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


More information about the logback-dev mailing list