You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2006/03/01 20:43:05 UTC

svn commit: r382135 - in /db/ddlutils/trunk/src: java/org/apache/ddlutils/platform/ java/org/apache/ddlutils/task/ test/org/apache/ddlutils/ test/org/apache/ddlutils/io/

Author: tomdz
Date: Wed Mar  1 11:43:04 2006
New Revision: 382135

URL: http://svn.apache.org/viewcvs?rev=382135&view=rev
Log:
Replaced System.out.println/System.err.println with logging

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java
    db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatabaseIO.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java?rev=382135&r1=382134&r2=382135&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java Wed Mar  1 11:43:04 2006
@@ -210,7 +210,7 @@
                 {
                     if (continueOnError)
                     {
-                        System.err.println("SQL Command " + command + " failed with " + ex.getMessage());
+                        _log.warn("SQL Command " + command + " failed with ", ex);
                         errors++;
                     }
                     else

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java?rev=382135&r1=382134&r2=382135&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DumpMetadataTask.java Wed Mar  1 11:43:04 2006
@@ -197,7 +197,7 @@
     {
         if (_dataSource == null)
         {
-            System.out.println("No data source specified, so there is nothing to do.");
+            log("No data source specified, so there is nothing to do.", Project.MSG_INFO);
             return;
         }
 

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java?rev=382135&r1=382134&r2=382135&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/TestPlatformBase.java Wed Mar  1 11:43:04 2006
@@ -23,6 +23,8 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.ddlutils.io.DatabaseIO;
 import org.apache.ddlutils.model.Database;
 import org.xml.sax.SAXException;
@@ -124,10 +126,22 @@
         "  </table>\n" +
         "</database>";
 
+    /** The log for the tests. */
+    private final Log _log = LogFactory.getLog(getClass());
     /** The tested platform. */
     private Platform _platform;
     /** The writer that the builder of the platform writes to. */
     private StringWriter _writer;
+
+    /**
+     * Returns the log.
+     * 
+     * @return The log
+     */
+    protected Log getLog()
+    {
+        return _log;
+    }
 
     /**
      * {@inheritDoc}

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java?rev=382135&r1=382134&r2=382135&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java Wed Mar  1 11:43:04 2006
@@ -320,12 +320,12 @@
 
             dbIo.write(expected, writer);
 
-            System.err.println("Expected model:\n"+writer.toString());
+            getLog().error("Expected model:\n" + writer.toString());
             
             writer = new StringWriter();
             dbIo.write(actual, writer);
 
-            System.err.println("Actual model:\n"+writer.toString());
+            getLog().error("Actual model:\n" + writer.toString());
 
             if (ex instanceof Error)
             {

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatabaseIO.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatabaseIO.java?rev=382135&r1=382134&r2=382135&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatabaseIO.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatabaseIO.java Wed Mar  1 11:43:04 2006
@@ -24,6 +24,8 @@
 import junit.framework.TestCase;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.ddlutils.model.Column;
 import org.apache.ddlutils.model.Database;
 import org.apache.ddlutils.model.ForeignKey;
@@ -41,6 +43,9 @@
  */
 public class TestDatabaseIO extends TestCase
 {
+    /** The log for the tests. */
+    private final Log _log = LogFactory.getLog(TestDatabaseIO.class);
+
     /**
      * Reads the database model from the given string.
      * 
@@ -1255,8 +1260,8 @@
                 "<database name='db' >\n" +
                 "  <index name='NotATable'/>\n" +
                 "</database>");
-        
-        System.out.println("Table : " + Arrays.asList(database.getTables()));
+
+        _log.debug("Table : " + Arrays.asList(database.getTables()));
         assertEquals(0, database.getTableCount());
     }