diff flys-client/src/main/java/de/intevation/flys/client/server/UserCollectionsServiceImpl.java @ 1367:ab8eb2f544f2

Replaced stdout and stderr logging with log4j loggers in server classes. flys-client/trunk@3069 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 25 Oct 2011 12:31:15 +0000
parents ba1b27b7d282
children 07b9404d7170
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/UserCollectionsServiceImpl.java	Tue Oct 25 11:07:14 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/UserCollectionsServiceImpl.java	Tue Oct 25 12:31:15 2011 +0000
@@ -10,6 +10,8 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
+import org.apache.log4j.Logger;
+
 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
 
 import de.intevation.artifacts.common.ArtifactNamespaceContext;
@@ -36,12 +38,16 @@
 extends      RemoteServiceServlet
 implements   UserCollectionsService
 {
+    private static final Logger logger = Logger.getLogger(
+        UserCollectionsServiceImpl.class);
+
+
     public Collection[] getUserCollections(
         String serverUrl,
         String locale,
         String userid)
     {
-        System.out.println("UserCollectionsServiceImpl.getUserCollections");
+        logger.info("UserCollectionsServiceImpl.getUserCollections");
 
         HttpClient client = new HttpClientImpl(serverUrl, locale);
 
@@ -55,7 +61,7 @@
                 ArtifactNamespaceContext.INSTANCE);
 
             if (list == null || list.getLength() == 0) {
-                System.out.println("No collection found for user: " + userid);
+                logger.debug("No collection found for user: " + userid);
                 return null;
             }
 
@@ -71,15 +77,15 @@
                 }
             }
 
-            System.out.println("User has " + all.size() + " collections.");
+            logger.debug("User has " + all.size() + " collections.");
 
             return (Collection[]) all.toArray(new Collection[all.size()]);
         }
         catch (ConnectionException ce) {
-            System.err.println(ce.getLocalizedMessage());
+            logger.error(ce, ce);
         }
 
-        System.err.println("No user collections found.");
+        logger.debug("No user collections found.");
         return null;
     }
 
@@ -106,12 +112,12 @@
                 return new DefaultCollection(uuid, ttl, name, new Date(time));
             }
             catch (NumberFormatException nfe) {
-                System.err.println("Error while parsing collection attributes.");
+                logger.warn("Error while parsing collection attributes.");
                 return null;
             }
         }
 
-        System.err.println("Found an invalid Collection.");
+        logger.warn("Found an invalid Collection.");
         return null;
     }
 }

http://dive4elements.wald.intevation.org