diff artifact-database/src/main/java/de/intevation/artifactdatabase/SQL.java @ 17:5a6b6a3debc7

Integrated logging into artifact database. artifacts/trunk@33 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 08 Sep 2009 06:29:52 +0000
parents 0d16d1bb2df0
children 4ae4dc99127d
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/SQL.java	Mon Sep 07 13:22:48 2009 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/SQL.java	Tue Sep 08 06:29:52 2009 +0000
@@ -5,11 +5,15 @@
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.log4j.Logger;
+
 /**
  *  @author Sascha L. Teichmann
  */
 public final class SQL
 {
+    private static Logger logger = Logger.getLogger(SQL.class);
+
     private SQL() {
     }
 
@@ -35,19 +39,18 @@
             in = SQL.class.getResourceAsStream(res);
 
             if (in == null) {
-                System.err.println("WARNING: no SQL file for driver '"
-                    + driver + "' found.");
+                logger.warn("No SQL file for driver '" + driver + "' found.");
                 res = "/sql/" + DBConnection.DEFAULT_DRIVER.replace('.', '-').toLowerCase()
                     + ".properties";
                 if ((in = SQL.class.getResourceAsStream(res)) == null) {
-                    System.err.println("ERROR: no SQL file found");
+                    logger.error("No SQL file found");
                 }
             }
 
             properties.load(in);
         }
         catch (IOException ioe) {
-            ioe.printStackTrace(System.err);
+            logger.error(ioe.getLocalizedMessage(), ioe);
         }
         finally {
             if (in != null) {

http://dive4elements.wald.intevation.org