logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r821364 - in /logging/log4j/companions: component/trunk/ extras/trunk/ extras/trunk/src/test/java/org/apache/log4j/ receivers/trunk/ receivers/trunk/src/main/java/org/apache/log4j/db/ receivers/trunk/src/main/java/org/apache/log4j/db/dialect/
Date Sat, 03 Oct 2009 17:06:45 GMT
Author: sdeboy
Date: Sat Oct  3 17:06:45 2009
New Revision: 821364

URL: http://svn.apache.org/viewvc?rev=821364&view=rev
Log:
Commit patches provided by Antonio Petrelli - thanks Antonio

Bugzilla issues: 
47595: POMs of companions have problems
47599: TestLogMF fails with Italian locale
47600: ConnectionSourceSkeleton does not close connection after discovery
47615: The DB Appender does not work under Oracle

Modified:
    logging/log4j/companions/component/trunk/pom.xml
    logging/log4j/companions/extras/trunk/pom.xml
    logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/TestLogMF.java
    logging/log4j/companions/receivers/trunk/pom.xml
    logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/ConnectionSourceSkeleton.java
    logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/dialect/oracle.sql

Modified: logging/log4j/companions/component/trunk/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/companions/component/trunk/pom.xml?rev=821364&r1=821363&r2=821364&view=diff
==============================================================================
--- logging/log4j/companions/component/trunk/pom.xml (original)
+++ logging/log4j/companions/component/trunk/pom.xml Sat Oct  3 17:06:45 2009
@@ -86,8 +86,8 @@
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-            <source>1.2</source>
-            <target>1.1</target>
+            <source>1.4</source>
+            <target>1.4</target>
         </configuration>
       </plugin>
 	  <plugin>
@@ -115,7 +115,7 @@
             <id>untag-site</id>
             <configuration>
                 <tasks>
-                    <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp"
/>                
+                    <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp"
/>
                    <replaceregexp file="target/site/source-repository.html" match="/tags/[^
&quot;&apos;&lt;]*" replace="/trunk" flags="g"/>
                 <replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated
by \1 --" flags="g">
 					<fileset dir="target/site/apidocs" includes="**/*.html"/>
@@ -163,7 +163,7 @@
             <version>1.0b2</version>
           </dependency>
         </dependencies>
-      </plugin>	 
+      </plugin>
 	  <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <configuration>
@@ -174,6 +174,7 @@
         </configuration>
         <executions>
             <execution>
+            	<phase>package</phase>
                 <goals>
                     <goal>assembly</goal>
                 </goals>
@@ -200,7 +201,7 @@
                 </goals>
             </execution>
         </executions>
-      </plugin>     
+      </plugin>
     </plugins>
 </build>
   <dependencies>
@@ -214,10 +215,28 @@
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.15</version>
-    </dependency>    
+      <exclusions>
+        <exclusion>
+          <groupId>javax.jms</groupId>
+          <artifactId>jms</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jdmk</groupId>
+          <artifactId>jmxtools</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jmx</groupId>
+          <artifactId>jmxri</artifactId>
+        </exclusion>
+        <exclusion>
+          <artifactId>mail</artifactId>
+          <groupId>javax.mail</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
   </dependencies>
   <reporting>
-    <excludeDefaults>true</excludeDefaults>  
+    <excludeDefaults>true</excludeDefaults>
     <plugins>
       <plugin>
         <artifactId>maven-project-info-reports-plugin</artifactId>
@@ -256,7 +275,7 @@
         <configuration>
         	<issueLinkTemplate>%URL%/show_bug.cgi?id=%ISSUE%</issueLinkTemplate>
         </configuration>
-      </plugin>      
+      </plugin>
       <plugin>
         <artifactId>maven-pmd-plugin</artifactId>
       </plugin>
@@ -274,5 +293,5 @@
       <id>logging.site</id>
       <url>scp://localhost/${user.dir}/target/site-deploy</url>
     </site>
-  </distributionManagement> 
+  </distributionManagement>
 </project>

Modified: logging/log4j/companions/extras/trunk/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/pom.xml?rev=821364&r1=821363&r2=821364&view=diff
==============================================================================
--- logging/log4j/companions/extras/trunk/pom.xml (original)
+++ logging/log4j/companions/extras/trunk/pom.xml Sat Oct  3 17:06:45 2009
@@ -85,8 +85,8 @@
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-            <source>1.2</source>
-            <target>1.1</target>
+            <source>1.4</source>
+            <target>1.4</target>
         </configuration>
       </plugin>
 	  <plugin>
@@ -114,7 +114,7 @@
             <id>untag-site</id>
             <configuration>
                 <tasks>
-                    <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp"
/>                
+                    <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp"
/>
                    <replaceregexp file="target/site/source-repository.html" match="/tags/[^
&quot;&apos;&lt;]*" replace="/trunk" flags="g"/>
                 <replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated
by \1 --" flags="g">
 					<fileset dir="target/site/apidocs" includes="**/*.html" />
@@ -162,7 +162,7 @@
             <version>1.0b2</version>
           </dependency>
         </dependencies>
-      </plugin>	 
+      </plugin>
 	  <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <configuration>
@@ -173,6 +173,7 @@
         </configuration>
         <executions>
             <execution>
+                <phase>package</phase>
                 <goals>
                     <goal>assembly</goal>
                 </goals>
@@ -199,11 +200,11 @@
                 </goals>
             </execution>
         </executions>
-      </plugin>     
+      </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>rat-maven-plugin</artifactId>
-      </plugin>    
+      </plugin>
     </plugins>
 </build>
   <dependencies>
@@ -217,11 +218,11 @@
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.9</version>
-    </dependency>    
+    </dependency>
   </dependencies>
   <reporting>
-  
-    <excludeDefaults>true</excludeDefaults>  
+
+    <excludeDefaults>true</excludeDefaults>
     <plugins>
       <plugin>
         <artifactId>maven-project-info-reports-plugin</artifactId>
@@ -261,7 +262,7 @@
         <configuration>
         	<issueLinkTemplate>%URL%/show_bug.cgi?id=%ISSUE%</issueLinkTemplate>
         </configuration>
-      </plugin>      
+      </plugin>
       <plugin>
         <artifactId>maven-pmd-plugin</artifactId>
       </plugin>
@@ -279,5 +280,5 @@
       <id>logging.site</id>
       <url>scp://localhost/${user.dir}/target/site-deploy</url>
     </site>
-  </distributionManagement> 
+  </distributionManagement>
 </project>

Modified: logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/TestLogMF.java
URL: http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/TestLogMF.java?rev=821364&r1=821363&r2=821364&view=diff
==============================================================================
--- logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/TestLogMF.java (original)
+++ logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/TestLogMF.java Sat
Oct  3 17:06:45 2009
@@ -20,6 +20,7 @@
 
 import java.io.CharArrayWriter;
 import java.text.MessageFormat;
+import java.text.NumberFormat;
 import java.util.Date;
 
 
@@ -221,8 +222,9 @@
         logger.setLevel(TRACE);
 
         float val = 3.14f;
+        NumberFormat format = NumberFormat.getInstance();
         LogMF.trace(logger, "Iteration {0}", val);
-        assertEquals("Iteration 3.14", capture.getMessage());
+        assertEquals("Iteration "+ format.format(val), capture.getMessage());
     }
 
     /**
@@ -233,8 +235,9 @@
         logger.setLevel(TRACE);
 
         double val = 3.14;
+        NumberFormat format = NumberFormat.getInstance();
         LogMF.trace(logger, "Iteration {0}", val);
-        assertEquals("Iteration 3.14", capture.getMessage());
+        assertEquals("Iteration "+ format.format(val), capture.getMessage());
     }
 
     /**

Modified: logging/log4j/companions/receivers/trunk/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/companions/receivers/trunk/pom.xml?rev=821364&r1=821363&r2=821364&view=diff
==============================================================================
--- logging/log4j/companions/receivers/trunk/pom.xml (original)
+++ logging/log4j/companions/receivers/trunk/pom.xml Sat Oct  3 17:06:45 2009
@@ -83,8 +83,8 @@
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-            <source>1.2</source>
-            <target>1.1</target>
+            <source>1.4</source>
+            <target>1.4</target>
         </configuration>
       </plugin>
 	  <plugin>
@@ -112,7 +112,7 @@
             <id>untag-site</id>
             <configuration>
                 <tasks>
-                    <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp"
/>                
+                    <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp"
/>
                    <replaceregexp file="target/site/source-repository.html" match="/tags/[^
&quot;&apos;&lt;]*" replace="/trunk" flags="g"/>
                 <replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated
by \1 --" flags="g">
 					<fileset dir="target/site/apidocs" includes="**/*.html"/>
@@ -160,7 +160,7 @@
             <version>1.0b2</version>
           </dependency>
         </dependencies>
-      </plugin>	 
+      </plugin>
 	  <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <configuration>
@@ -171,6 +171,7 @@
         </configuration>
         <executions>
             <execution>
+                <phase>package</phase>
                 <goals>
                     <goal>assembly</goal>
                 </goals>
@@ -197,7 +198,7 @@
                 </goals>
             </execution>
         </executions>
-      </plugin>     
+      </plugin>
     </plugins>
 </build>
   <dependencies>
@@ -216,13 +217,31 @@
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
-      <version>1.2.16-SNAPSHOT</version>
-    </dependency>    
+      <version>1.2.15</version>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.jms</groupId>
+          <artifactId>jms</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jdmk</groupId>
+          <artifactId>jmxtools</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jmx</groupId>
+          <artifactId>jmxri</artifactId>
+        </exclusion>
+        <exclusion>
+          <artifactId>mail</artifactId>
+          <groupId>javax.mail</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>apache-log4j-component</artifactId>
       <version>1.0-SNAPSHOT</version>
-    </dependency>    
+    </dependency>
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>apache-log4j-extras</artifactId>
@@ -232,7 +251,7 @@
       <groupId>oro</groupId>
       <artifactId>oro</artifactId>
       <version>2.0.8</version>
-    </dependency>  
+    </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-jms_1.1_spec</artifactId>
@@ -241,7 +260,7 @@
     </dependency>
   </dependencies>
   <reporting>
-    <excludeDefaults>true</excludeDefaults>  
+    <excludeDefaults>true</excludeDefaults>
     <plugins>
       <plugin>
         <artifactId>maven-project-info-reports-plugin</artifactId>
@@ -280,7 +299,7 @@
         <configuration>
         	<issueLinkTemplate>%URL%/show_bug.cgi?id=%ISSUE%</issueLinkTemplate>
         </configuration>
-      </plugin>      
+      </plugin>
       <plugin>
         <artifactId>maven-pmd-plugin</artifactId>
       </plugin>
@@ -298,6 +317,6 @@
       <id>logging.site</id>
       <url>scp://localhost/${user.dir}/target/site-deploy</url>
     </site>
-  </distributionManagement> 
+  </distributionManagement>
 </project>
 

Modified: logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/ConnectionSourceSkeleton.java
URL: http://svn.apache.org/viewvc/logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/ConnectionSourceSkeleton.java?rev=821364&r1=821363&r2=821364&view=diff
==============================================================================
--- logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/ConnectionSourceSkeleton.java
(original)
+++ logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/ConnectionSourceSkeleton.java
Sat Oct  3 17:06:45 2009
@@ -17,18 +17,21 @@
 
 package org.apache.log4j.db;
 
-import org.apache.log4j.db.dialect.Util;
-import org.apache.log4j.spi.ComponentBase;
-
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.SQLException;
 
+import org.apache.log4j.db.dialect.Util;
+import org.apache.log4j.spi.ComponentBase;
+
 
 /**
  * @author Ceki G&uuml;lc&uuml;
  */
 public abstract class ConnectionSourceSkeleton extends ComponentBase implements ConnectionSource
{
+  
+  private Boolean overriddenSupportsGetGeneratedKeys = null;
+  
   private String user = null;
   private String password = null;
 
@@ -43,8 +46,9 @@
    *
    */
   public void discoverConnnectionProperties() {
+    Connection connection = null;
     try {
-      Connection connection = getConnection();
+      connection = getConnection();
       if (connection == null) {
         getLogger().warn("Could not get a conneciton");
         return;
@@ -52,11 +56,18 @@
       DatabaseMetaData meta = connection.getMetaData();
       Util util = new Util();
       util.setLoggerRepository(repository);
-      supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
+      if (overriddenSupportsGetGeneratedKeys != null) {
+        supportsGetGeneratedKeys = overriddenSupportsGetGeneratedKeys
+            .booleanValue();
+      } else {
+        supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
+      }
       supportsBatchUpdates = util.supportsBatchUpdates(meta);
       dialectCode = Util.discoverSQLDialect(meta);
     } catch (SQLException se) {
       getLogger().warn("Could not discover the dialect to use.", se);
+    } finally {
+      DBHelper.closeConnection(connection);
     }
   }
 
@@ -102,6 +113,35 @@
   }
 
   /**
+   * Returns the "overridden" value of "supportsGetGeneratedKeys" property of
+   * the JDBC driver. In certain cases, getting (e.g. Oracle 10g) generated keys
+   * does not work because it returns the ROWID, not the value of the sequence.
+   * 
+   * @return A non null string, with "true" or "false" value, if overridden,
+   *         <code>null</code> if not overridden.
+   */
+  public String getOverriddenSupportsGetGeneratedKeys() {
+    return overriddenSupportsGetGeneratedKeys != null ? overriddenSupportsGetGeneratedKeys
+        .toString()
+        : null;
+  }
+
+  /**
+   * Sets the "overridden" value of "supportsGetGeneratedKeys" property of the
+   * JDBC driver. In certain cases, getting (e.g. Oracle 10g) generated keys
+   * does not work because it returns the ROWID, not the value of the sequence.
+   * 
+   * @param overriddenSupportsGetGeneratedKeys
+   *          A non null string, with "true" or "false" value, if overridden,
+   *          <code>null</code> if not overridden.
+   */
+  public void setOverriddenSupportsGetGeneratedKeys(
+      String overriddenSupportsGetGeneratedKeys) {
+    this.overriddenSupportsGetGeneratedKeys = Boolean
+        .valueOf(overriddenSupportsGetGeneratedKeys);
+  }
+  
+  /**
    * Does this connection support batch updates?
    */
   public final boolean supportsBatchUpdates() {

Modified: logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/dialect/oracle.sql
URL: http://svn.apache.org/viewvc/logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/dialect/oracle.sql?rev=821364&r1=821363&r2=821364&view=diff
==============================================================================
--- logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/dialect/oracle.sql
(original)
+++ logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/dialect/oracle.sql
Sat Oct  3 17:06:45 2009
@@ -38,7 +38,7 @@
 FOR EACH ROW
 BEGIN
    SELECT logging_event_id_seq.nextval
-   INTO :new.sequence_number$ FROM dual
+   INTO :new.sequence_number FROM dual;
 END;
 
 CREATE TABLE logging_event_property
@@ -58,4 +58,4 @@
     PRIMARY KEY(event_id, i),
     FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
   );
-  
\ No newline at end of file
+  



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message