Redirecting Caught and Uncaught Exceptions to OSGI Console and Log File
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / packet / Packet.java
index 61d6d248c8108c9fd4b263d8cca9207ea1ffd3ef..bbe85ec66ae639c1221c39fa4b2b977a3de5ac1f 100644 (file)
@@ -17,6 +17,8 @@ import java.util.Map.Entry;
 import org.apache.commons.lang3.tuple.Pair;
 import org.opendaylight.controller.sal.utils.HexEncode;
 import org.opendaylight.controller.sal.utils.NetUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Abstract class which represents the generic network packet object
@@ -27,6 +29,8 @@ import org.opendaylight.controller.sal.utils.NetUtils;
  */
 
 public abstract class Packet {
+    protected static final Logger logger = LoggerFactory
+    .getLogger(Packet.class);
     // Access level granted to this packet
     protected boolean writeAccess;
     // When deserialized from wire, packet could result corrupted
@@ -260,7 +264,7 @@ public abstract class Packet {
                             .getHostAddress()
                             + " ");
                 } catch (UnknownHostException e) {
-                    e.printStackTrace();
+                    logger.error("",e);
                 }
             } else {
                 ret.append(((Long) BitBufferHelper.getLong(entry.getValue()))