[vlma-devel] commit: Logging modifications. (Adrien Grand )

git version control git at videolan.org
Sun Sep 7 22:32:33 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Sep  6 17:03:10 2008 +0200| [6df21c7930baad116dd18d9baedeec5f9843e0eb] | committer: Adrien Grand 

Logging modifications.

Do not print the stack when it is not relevant and say which server caused a
problem.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=6df21c7930baad116dd18d9baedeec5f9843e0eb
---

 .../java/org/videolan/vlma/VLMaServiceImpl.java    |   24 ++++++-------------
 .../videolan/vlma/retriever/SnmpDataRetriever.java |    2 +-
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
index c4d9166..dbe0af2 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
@@ -85,8 +85,6 @@ public class VLMaServiceImpl implements VLMaService {
         return vlmaDao.getMedias();
     }
 
-
-
     public Set<Order> getOrders() {
         synchronized (orders) {
             return orders;
@@ -187,10 +185,8 @@ public class VLMaServiceImpl implements VLMaService {
         try {
             rrdDb = rrdPool.requestRrdDb(rrdFile);
             sample = rrdDb.createSample();
-        } catch (IOException e) {
-            logger.error("Cannot instanciate the RRD database", e);
-        } catch (RrdException e) {
-            logger.error("Cannot instanciate the RRD database", e);
+        } catch (Exception e) {
+            logger.error("Cannot instanciate the RRD database for server" + server.getName(), e);
         }
 
         for(Data data : Data.values()) {
@@ -206,7 +202,7 @@ public class VLMaServiceImpl implements VLMaService {
                     sample.setValue(data.name().toLowerCase(), Double.parseDouble(value.trim()));
                 }
             } catch (NumberFormatException e) {
-                logger.error("Cannot convert value to the expected format", e);
+                logger.error("Cannot convert value to the expected format (Server " + server.getName() + ")", e);
             } catch (RrdException e) {
                 logger.error("Error while adding value to the RRD database", e);
             }
@@ -214,17 +210,13 @@ public class VLMaServiceImpl implements VLMaService {
 
         try {
             sample.update();
-        } catch (IOException e) {
-            logger.error("Cannot update sample", e);
-        } catch (RrdException e) {
-            logger.error("Cannot update sample", e);
+        } catch (Exception e) {
+            logger.error("Cannot update sample of server " + server.getName(), e);
         }
         try {
             rrdPool.release(rrdDb);
-        } catch (IOException e) {
-            logger.error("Cannot release RRD database", e);
-        } catch (RrdException e) {
-            logger.error("Cannot release RRD database", e);
+        } catch (Exception e) {
+            logger.error("Cannot release RRD database for server " + server.getName(), e);
         }
     }
 
@@ -284,7 +276,7 @@ public class VLMaServiceImpl implements VLMaService {
             server.setUp(true);
             logger.debug("VLC of " + server.getName() + " is reachable");
         } catch (IOException e) {
-            logger.error("Unable to contact VLC server of " + server.getName() + " through telnet interface", e);
+            logger.info("Unable to contact VLC server of " + server.getName() + " through telnet interface");
             server.setUp(false);
         }
         boolean newState = server.isUp();
diff --git a/vlma-core/src/main/java/org/videolan/vlma/retriever/SnmpDataRetriever.java b/vlma-core/src/main/java/org/videolan/vlma/retriever/SnmpDataRetriever.java
index 44fe7bc..fbd341f 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/retriever/SnmpDataRetriever.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/retriever/SnmpDataRetriever.java
@@ -41,7 +41,7 @@ public class SnmpDataRetriever implements DataRetriever {
         try {
             comm = new SNMPv1CommunicationInterface(0, server.getIp(), configuration.getString("vlc.snmp.community"));
         } catch (SocketException e) {
-            logger.error("Cannot contact SNMP server of " + server, e);
+            logger.error("Cannot contact SNMP server of " + server);
             return null;
         }
         String[] oid = {



More information about the vlma-devel mailing list