diff flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.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 6de435235927
children bc06a671ef60
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java	Tue Oct 25 11:07:14 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/StepForwardServiceImpl.java	Tue Oct 25 12:31:15 2011 +0000
@@ -2,6 +2,8 @@
 
 import org.w3c.dom.Document;
 
+import org.apache.log4j.Logger;
+
 import de.intevation.artifacts.common.ArtifactNamespaceContext;
 import de.intevation.artifacts.common.utils.ClientProtocolUtils;
 import de.intevation.artifacts.common.utils.XMLUtils;
@@ -29,6 +31,10 @@
 extends      AdvanceServiceImpl
 implements   StepForwardService
 {
+    private static final Logger logger =
+        Logger.getLogger(StepForwardServiceImpl.class);
+
+
     /** XPath that points to the result type of a feed or advance operation.*/
     public static final String XPATH_RESULT = "/art:result/@art:type";
 
@@ -57,12 +63,12 @@
     public Artifact go(String url, String locale, Artifact artifact, Data[] data)
     throws ServerException
     {
-        System.out.println("StepForwardServiceImpl.go");
+        logger.info("StepForwardServiceImpl.go");
 
         Artifact afterFeed = feed(url, locale, artifact, data);
 
         if (afterFeed == null) {
-            System.err.println("StepForwardService.feed() - FAILED");
+            logger.warn("StepForwardService.feed() - FAILED");
             throw new ServerException(ERROR_FEED_DATA);
         }
 
@@ -70,7 +76,7 @@
         String[] reachable       = desc.getReachableStates();
 
         if (reachable == null || reachable.length == 0) {
-            System.out.println("Did not find any reachable state.");
+            logger.debug("Did not find any reachable state.");
             return afterFeed;
         }
 
@@ -97,7 +103,7 @@
         Data[]   data)
     throws    ServerException
     {
-        System.out.println("StepForwardServiceImpl.feed");
+        logger.info("StepForwardServiceImpl.feed");
 
         Document feed = ClientProtocolUtils.newFeedDocument(
             artifact.getUuid(),
@@ -115,7 +121,7 @@
                 new DocumentResponseHandler());
 
             if (description == null) {
-                System.err.println("StepForwardService.feed() - FAILED");
+                logger.warn("StepForwardService.feed() - FAILED");
                 throw new ServerException(ERROR_FEED_DATA);
             }
 
@@ -125,7 +131,7 @@
                 ArtifactNamespaceContext.INSTANCE);
 
             if (result == null || !result.equals(OPERATION_FAILURE)) {
-                System.out.println("StepForwardService.feed() - SUCCESS");
+                logger.debug("StepForwardService.feed() - SUCCESS");
                 return (Artifact) new FLYSArtifactCreator().create(description);
             }
             else if (result != null && result.equals(OPERATION_FAILURE)) {
@@ -137,10 +143,10 @@
             }
         }
         catch (ConnectionException ce) {
-            System.err.println(ce.getLocalizedMessage());
+            logger.error(ce, ce);
         }
 
-        System.err.println("StepForwardService.feed() - FAILED");
+        logger.warn("StepForwardService.feed() - FAILED");
         throw new ServerException(ERROR_FEED_DATA);
     }
 

http://dive4elements.wald.intevation.org