Fix logs in how it should use exceptions. 26/13726/3
authorFlavio Fernandes <ffernand@redhat.com>
Thu, 18 Dec 2014 00:06:40 +0000 (19:06 -0500)
committerFlavio Fernandes <ffernand@redhat.com>
Thu, 18 Dec 2014 12:50:32 +0000 (07:50 -0500)
While debugging issue with openstack CI, I identified a number of places where
exception was not doing the logging properly. Thus, this change set.

Ref link on logging:
https://wiki.opendaylight.org/view/Logging_Best_Practices

Patch 2: minimize the changes, but yet follow the Logging_Best_Practices.
Patch 3: missed change in same file, to keep changes consistent on patch 2.

Change-Id: Ie3dae66f24467ee2dd1113e9c0dd6a5d6ab0df5a
Signed-off-by: Flavio Fernandes <ffernand@redhat.com>
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandler.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandler.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandler.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/VlanConfigurationCacheImpl.java

index 5a20b1d792fb0718771d706e839707bfc4ef9e57..9a06f944789661a7dbb28134eb5b23dfc6aa4f94 100644 (file)
@@ -201,7 +201,7 @@ public class NetworkHandler extends AbstractHandler
                             }
                         }
                     } catch (Exception e) {
-                        logger.error("Exception during handlingNeutron network delete");
+                        logger.error("Exception during handlingNeutron network delete", e);
                     }
                 }
             }
index 6c1699b111da7ac91f1174fbd1e81622e7e534e2..0784aaf4df7b148282f35b09007860c93f8ce579 100644 (file)
@@ -193,7 +193,7 @@ public class PortHandler extends AbstractHandler
                     }
                 }
             } catch (Exception e) {
-                logger.error("Exception during handlingNeutron network delete");
+                logger.error("Exception during handlingNeutron port delete", e);
             }
         }
         logger.debug(" PORT delete successful for tenant-id - {}, " +
index 8305ca524250a0fa89fe2d436be06d7400ae8a67..07380b8574fb8dc05a29d9b78f3e0fa8f632d927 100644 (file)
@@ -289,7 +289,7 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
                 }
             }
         } catch (Exception e) {
-            logger.debug("Failed to get Port tag for for Intf {}:{}", intf, e);
+            logger.debug("Failed to get Port tag for for Intf " + intf, e);
         }
         return null;
     }
index b8f84eed2021b558fc09e4edb96abdfe3dbce534..adadf0cfde33b3b583ba56d48f2d5129545e50e2 100644 (file)
@@ -206,7 +206,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
                 try {
                     isCreated = this.createBridges(node, network);
                 } catch (Exception e) {
-                    logger.error("Error creating internal net network ", node, e);
+                    logger.error("Error creating internal net network " + node, e);
                 }
             } else {
                 isCreated = true;
@@ -217,7 +217,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
                 try {
                     isCreated = this.createBridges(node, network);
                 } catch (Exception e) {
-                    logger.error("Error creating internal net network ", node, e);
+                    logger.error("Error creating internal net network " + node, e);
                 }
             } else {
                 isCreated = true;
@@ -319,8 +319,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
                 }
             }
         } catch (Exception e) {
-            logger.error("Unable to find physical interface for Node: {}",
-                         node, e);
+            logger.error("Unable to find physical interface for Node: " + node, e);
         }
 
         logger.debug("Physical interface for Node: {}, If: {}",
index 0684e570cacaf8e428b29e565256895a7f1b1e2b..8c87aa4a74fef28d8deeacebbe2414c5dd49f760 100644 (file)
@@ -58,7 +58,7 @@ public class VlanConfigurationCacheImpl implements VlanConfigurationCache {
             nodeUuid = (String)ovsTable.keySet().toArray()[0];
         }
         catch (Exception e) {
-            logger.error("Unable to get the Open_vSwitch table for Node {}: {}", node, e);
+            logger.error("Unable to get the Open_vSwitch table for Node {}", node, e);
         }
 
         return nodeUuid;
@@ -122,7 +122,7 @@ public class VlanConfigurationCacheImpl implements VlanConfigurationCache {
             configurationCache.put(nodeUuid, nodeConfiguration);
         }
         catch (Exception e) {
-            logger.debug("Error getting Port table for Node {}: {}", node, e);
+            logger.debug("Error getting Port table for Node {}", node, e);
         }
     }