From e1568a090ae0b5d6221a38f234945017e6d34c95 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Mon, 28 Dec 2020 09:27:32 +0000
Subject: [PATCH] Logging angepasst

---
 src/de/uhilger/baselink/PersistenceManager.java |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/de/uhilger/baselink/PersistenceManager.java b/src/de/uhilger/baselink/PersistenceManager.java
index 66d2147..eb12e31 100644
--- a/src/de/uhilger/baselink/PersistenceManager.java
+++ b/src/de/uhilger/baselink/PersistenceManager.java
@@ -121,6 +121,7 @@
    * @throws NamingException  when JNDI lookup fails
    */
   public void setDataSourceName(String dataSourceName) throws NamingException {
+    logger.finest(dataSourceName);
     Context initCtx = new InitialContext();
     Context envCtx = (Context) initCtx.lookup("java:comp/env");
     ds = (DataSource) envCtx.lookup(dataSourceName);
@@ -134,14 +135,18 @@
     Connection c = null;
     try {
       if (dburl != null) {
+        logger.finest("getting Connection for URL " + dburl);
         c = DriverManager.getConnection(dburl);
       } else if(ds != null) {
+        logger.finest("getting Connection for DataSource " + ds.toString());
         c = ds.getConnection();
       } else {
         //throw new SQLException("Unable to get connection, DataSource and database URL are null.");
+        logger.finest("Unable to get connection, DataSource and database URL are null.");
       }
     } catch(Exception ex) {
-      ex.printStackTrace();
+      //ex.printStackTrace();
+      logger.log(Level.FINEST, ex.getLocalizedMessage(), ex);
     }
     return c;
   }

--
Gitblit v1.9.3