[logback-dev] svn commit: r1029 - in logback/trunk: . logback-access/src/main/java/ch/qos/logback/access/db logback-access/src/test/java/ch/qos/logback/access/db logback-classic/src/test/java/ch/qos/logback/classic/db

noreply.seb at qos.ch noreply.seb at qos.ch
Wed Nov 29 10:41:29 CET 2006


Author: seb
Date: Wed Nov 29 10:41:28 2006
New Revision: 1029

Modified:
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTestBase.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestBase.java
   logback/trunk/pom.xml

Log:
Added an option to let the user choose if she wants to add the headers to the DB or not


Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java	Wed Nov 29 10:41:28 2006
@@ -35,6 +35,8 @@
   protected final String insertHeaderSQL = "INSERT INTO  access_event_header (event_id, header_key, header_value) VALUES (?, ?, ?)";
   protected static final Method GET_GENERATED_KEYS_METHOD; 
 
+  private boolean insertHeaders = false;
+  
   static {
     StringBuffer sql = new StringBuffer();
     sql.append("INSERT INTO access_event (");
@@ -76,8 +78,10 @@
       addWarn("Failed to insert access event");
     }
     
-    int eventId = getEventId(insertStatement, connection);
-    addRequestHeaders(event, connection, eventId);
+    if (insertHeaders) {
+      int eventId = getEventId(insertStatement, connection);
+      addRequestHeaders(event, connection, eventId);
+    }
   }
   
   void addAccessEvent(PreparedStatement stmt, AccessEvent event)
@@ -135,4 +139,8 @@
   protected String getInsertSQL() {
     return insertSQL;
   }
+  
+  public void setInsertHeaders(boolean insertHeaders) {
+    this.insertHeaders = insertHeaders;
+  }
 }

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTestBase.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTestBase.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTestBase.java	Wed Nov 29 10:41:28 2006
@@ -41,6 +41,8 @@
       server.setDatabasePath(0, "mem:test;sql.enforce_strict_size=true");
       server.setLogWriter(null);
       server.setErrWriter(null);
+      server.setTrace(false);
+      server.setSilent(true);
       server.start();
     } else {
       if (url == null) {

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestBase.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestBase.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTestBase.java	Wed Nov 29 10:41:28 2006
@@ -44,6 +44,8 @@
       server.setDatabasePath(0, "mem:test;sql.enforce_strict_size=true");
       server.setLogWriter(null);
       server.setErrWriter(null);
+      server.setTrace(false);
+      server.setSilent(true);
       server.start();
     } else {
       if (url == null) {

Modified: logback/trunk/pom.xml
==============================================================================
--- logback/trunk/pom.xml	(original)
+++ logback/trunk/pom.xml	Wed Nov 29 10:41:28 2006
@@ -89,7 +89,7 @@
 		  <dependency>
 	  		<groupId>hsqldb</groupId>
   			<artifactId>hsqldb</artifactId>
-				<version>1.8.0.5</version>
+				<version>1.8.0.7</version>
 		  </dependency>
 			<dependency>
 				<groupId>tomcat</groupId>



More information about the logback-dev mailing list