changed logging 06/4506/1
authorDavid Goldberg <david.goldberg@contextream.com>
Mon, 20 Jan 2014 07:55:31 +0000 (09:55 +0200)
committerDavid Goldberg <david.goldberg@contextream.com>
Mon, 20 Jan 2014 07:55:53 +0000 (09:55 +0200)
Signed-off-by: David Goldberg <david.goldberg@contextream.com>
Change-Id: Ib645645ee6861b71733afd38b2c8099d0279c061
Signed-off-by: David Goldberg <david.goldberg@contextream.com>
12 files changed:
commons/unittest_tools/src/main/java/org/opendaylight/lispflowmapping/tools/junit/BaseExpectations.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/Activator.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/authentication/LispMACAuthentication.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/dao/ClusterDAOService.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/dao/MappingServiceKeyUtil.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/lisp/MapServer.java
mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java
mappingservice/northbound/src/main/java/org/opendaylight/lispflowmapping/northbound/Activator.java
mappingservice/northbound/src/main/java/org/opendaylight/lispflowmapping/northbound/LispMappingNorthbound.java
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPlugin.java
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/lisp/LispSouthboundService.java

index 1fed8ee442fb354ceeb3ccb0608b2b52f848e556..a70f003e05fdc31e0d87522b7648882c2b916909 100644 (file)
@@ -236,7 +236,7 @@ public class BaseExpectations extends Expectations {
             values.add(lastValue);
             boolean match = match(lastValue);
             if (match && (logMatch != null)) {
-                logger.debug("Match: " + logMatch + " " + value);
+                logger.trace("Match: " + logMatch + " " + value);
             }
             return match;
         }
@@ -262,7 +262,7 @@ public class BaseExpectations extends Expectations {
 
         public Object invoke(Invocation invocation) throws Throwable {
             if (logInvocation) {
-                logger.debug("Invoke: returning " + lastValue);
+                logger.trace("Invoke: returning " + lastValue);
             }
             return lastValue;
         }
index c834ac4a52d4dfaf3eacbca4671b343ee546a8c8..d89b49ea607a23a3aeed662994694b9ec09d39f0 100644 (file)
@@ -18,8 +18,6 @@ import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.opendaylight.lispflowmapping.implementation.dao.ClusterDAOService;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Main application activator class for registering the dependencies and
@@ -29,11 +27,6 @@ import org.slf4j.LoggerFactory;
 
 public class Activator extends ComponentActivatorAbstractBase {
 
-    /*
-     * Logger instance
-     */
-    protected static final Logger logger = LoggerFactory.getLogger(Activator.class);
-
     /**
      * Function called when the activator starts just after some initializations
      * are done by the ComponentActivatorAbstractBase.
index c27406297e7600b117891db73ff9a320cdeed7d5..5da7d31fb028bd47dee4c08c55822ce20f443ee3 100644 (file)
@@ -89,7 +89,7 @@ public class LispMappingService implements CommandProvider, IFlowMapping, Bindin
     }
 
     void setBindingAwareBroker(BindingAwareBroker bindingAwareBroker) {
-        logger.debug("BindingAwareBroker set!");
+        logger.trace("BindingAwareBroker set!");
         BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
         bindingAwareBroker.registerConsumer(this, bundleContext);
     }
@@ -105,20 +105,20 @@ public class LispMappingService implements CommandProvider, IFlowMapping, Bindin
     }
 
     void setLispDao(ILispDAO dao) {
-        logger.debug("LispDAO set in LispMappingService");
+        logger.trace("LispDAO set in LispMappingService");
         basicInit(dao);
-        logger.debug("Registering LispIpv4Address");
+        logger.trace("Registering LispIpv4Address");
         lispDao.register(LispIpv4AddressInMemoryConverter.class);
-        logger.debug("Registering LispIpv6Address");
+        logger.trace("Registering LispIpv6Address");
         lispDao.register(LispIpv6AddressInMemoryConverter.class);
-        logger.debug("Registering MappingServiceKey");
+        logger.trace("Registering MappingServiceKey");
         lispDao.register(MappingServiceKeyConvertor.class);
-        logger.debug("Registering MappingServiceNoMaskKey");
+        logger.trace("Registering MappingServiceNoMaskKey");
         lispDao.register(MappingServiceNoMaskKeyConvertor.class);
     }
 
     void unsetLispDao(ILispDAO dao) {
-        logger.debug("LispDAO was unset in LispMappingService");
+        logger.trace("LispDAO was unset in LispMappingService");
         mapServer = null;
         mapResolver = null;
         lispDao = null;
@@ -139,7 +139,7 @@ public class LispMappingService implements CommandProvider, IFlowMapping, Bindin
     }
 
     public void destroy() {
-        logger.debug("LISP (RFC6830) Mapping Service is destroyed!");
+        logger.info("LISP (RFC6830) Mapping Service is destroyed!");
         mapResolver = null;
         mapServer = null;
     }
@@ -235,7 +235,7 @@ public class LispMappingService implements CommandProvider, IFlowMapping, Bindin
     }
 
     public void onSessionInitialized(ConsumerContext session) {
-        logger.debug("Lisp Consumer session initialized!");
+        logger.info("Lisp Consumer session initialized!");
         NotificationService notificationService = session.getSALService(NotificationService.class);
         // notificationService.registerNotificationListener(LispNotification.class,
         // this);
index 3f1dad54aa9736475557caee00662fb02619eb2f..1b929ae46e6541c6440250257dc0a8655eb655c0 100644 (file)
@@ -36,7 +36,7 @@ public class LispMACAuthentication implements ILispAuthentication {
             authenticationLength = Mac.getInstance(algorithm).getMacLength();
             tempAuthenticationData = new byte[authenticationLength];
         } catch (NoSuchAlgorithmException e) {
-            logger.error("No such MAC algorithm" + algorithm);
+            logger.warn("No such MAC algorithm" + algorithm);
         }
     }
 
@@ -64,9 +64,9 @@ public class LispMACAuthentication implements ILispAuthentication {
 
             return mac.doFinal(data);
         } catch (InvalidKeyException e) {
-            logger.error("Invalid password" + key);
+            logger.warn("Invalid password" + key);
         } catch (NoSuchAlgorithmException e) {
-            logger.error("No such MAC algorithm" + algorithm);
+            logger.warn("No such MAC algorithm" + algorithm);
         }
         return null;
     }
index 56563701fdf69b87de1cdaba8635bbbc84dbefd4..dff8ddef35efccadd86188a81a0cbfad69273189 100644 (file)
@@ -58,7 +58,7 @@ public class ClusterDAOService implements ILispDAO, IQueryAll {
     }
 
     void unsetClusterContainerService(IClusterContainerServices s) {
-        logger.debug("Cluster Service unset");
+        logger.trace("Cluster Service unset");
         if (this.clusterContainerService == s) {
             this.clusterContainerService = null;
         }
@@ -68,32 +68,32 @@ public class ClusterDAOService implements ILispDAO, IQueryAll {
     @SuppressWarnings("deprecation")
     private void allocateCache() {
         if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't create cache");
+            logger.warn("un-initialized clusterContainerService, can't create cache");
             return;
         }
-        logger.debug("Creating Cache for ClusterDAOService");
+        logger.trace("Creating Cache for ClusterDAOService");
         try {
             this.clusterContainerService.createCache(CACHE_NAME, EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
         } catch (CacheConfigException cce) {
-            logger.error("Cache couldn't be created for ClusterDAOService -  check cache mode");
+            logger.warn("Cache couldn't be created for ClusterDAOService -  check cache mode");
         } catch (CacheExistException cce) {
-            logger.error("Cache for ClusterDAOService already exists, destroy and recreate");
+            logger.warn("Cache for ClusterDAOService already exists, destroy and recreate");
         }
-        logger.debug("Cache successfully created for ClusterDAOService");
+        logger.trace("Cache successfully created for ClusterDAOService");
     }
 
     @SuppressWarnings({ "unchecked", "deprecation" })
     private void retrieveCache() {
         if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterContainerService, can't retrieve cache");
+            logger.warn("un-initialized clusterContainerService, can't retrieve cache");
             return;
         }
-        logger.debug("Retrieving cache for ClusterDAOService");
+        logger.trace("Retrieving cache for ClusterDAOService");
         typeToKeysToValues = (ConcurrentMap<Class<?>, Map<Object, Map<String, Object>>>) this.clusterContainerService.getCache(CACHE_NAME);
         if (typeToKeysToValues == null) {
-            logger.error("Cache couldn't be retrieved for ClusterDAOService");
+            logger.warn("Cache couldn't be retrieved for ClusterDAOService");
         }
-        logger.debug("Cache was successfully retrieved for ClusterDAOService");
+        logger.trace("Cache was successfully retrieved for ClusterDAOService");
     }
 
     public void getAll(IRowVisitor visitor) {
index 19fa080c09db8532f86b316c5d806cfad32dbb74..4f5b047fa527f9fe8e84d6f0bbd5d6cac5b25527 100644 (file)
@@ -11,13 +11,9 @@ import org.opendaylight.lispflowmapping.implementation.util.MaskUtil;
 import org.opendaylight.lispflowmapping.interfaces.dao.IMappingServiceKey;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainer;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainerBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class MappingServiceKeyUtil {
 
-    protected static final Logger logger = LoggerFactory.getLogger(MappingServiceKeyUtil.class);
-
     public static IMappingServiceKey generateMappingServiceKey(LispAddressContainer lispAddressContainer, int mask) {
         if (MaskUtil.isMaskable(lispAddressContainer.getAddress())) {
             LispAddressContainerBuilder normalizedBuilder = new LispAddressContainerBuilder();
index e73cbc7f7c0c2c2cf700491ec96cdabafdeefb71..4a42136381e3725e9816af71c8c2202500238e83 100644 (file)
@@ -63,7 +63,7 @@ public class MapServer implements IMapServerAsync {
                 if (shouldAuthenticate) {
                     password = getPassword(eidRecord.getLispAddressContainer(), eidRecord.getMaskLength());
                     if (!LispAuthenticationUtil.validate(mapRegister, password)) {
-                        logger.debug("Authentication failed");
+                        logger.warn("Authentication failed");
                         failed = true;
                         break;
                     }
index 5d943b35812afd52ef722c4170de488953aa8d2f..080759b013b3712009eb0ccdecda029e59d90f37 100644 (file)
@@ -544,8 +544,8 @@ public class MappingServiceIntegrationTest {
 
         String jsonAuthData = createAuthKeyJSON(pass, address, mask);
 
-        logger.info("Sending this JSON to LISP server: \n" + jsonAuthData);
-        logger.info("Address: " + address);
+        logger.trace("Sending this JSON to LISP server: \n" + jsonAuthData);
+        logger.trace("Address: " + address);
 
         byte[] expectedSha = new byte[] { (byte) 146, (byte) 234, (byte) 52, (byte) 247, (byte) 186, (byte) 232, (byte) 31, (byte) 249, (byte) 87,
                 (byte) 73, (byte) 234, (byte) 54, (byte) 225, (byte) 160, (byte) 129, (byte) 251, (byte) 73, (byte) 53, (byte) 196, (byte) 62 };
@@ -838,8 +838,8 @@ public class MappingServiceIntegrationTest {
         Integer httpResponseCode = connection.getResponseCode();
 
         if (httpResponseCode > 299) {
-            logger.info("HTTP Address: " + url);
-            logger.info("HTTP Response Code: " + httpResponseCode);
+            logger.trace("HTTP Address: " + url);
+            logger.trace("HTTP Response Code: " + httpResponseCode);
             fail();
         }
 
@@ -1454,7 +1454,7 @@ public class MappingServiceIntegrationTest {
         try {
             DatagramPacket packet = new DatagramPacket(bytesToSend, bytesToSend.length);
             initPacketAddress(packet);
-            logger.info("Sending MapRegister to LispPlugin on socket");
+            logger.trace("Sending MapRegister to LispPlugin on socket");
             socket.send(packet);
         } catch (Throwable t) {
             fail();
@@ -1469,10 +1469,10 @@ public class MappingServiceIntegrationTest {
         try {
             byte[] buffer = new byte[4096];
             DatagramPacket receivePacket = new DatagramPacket(buffer, buffer.length);
-            logger.info("Waiting for packet from socket...");
+            logger.trace("Waiting for packet from socket...");
             socket.setSoTimeout(timeout);
             socket.receive(receivePacket);
-            logger.info("Recieved packet from socket!");
+            logger.trace("Recieved packet from socket!");
             return receivePacket;
         } catch (SocketTimeoutException ste) {
             throw ste;
@@ -1535,10 +1535,10 @@ public class MappingServiceIntegrationTest {
         Bundle b[] = bc.getBundles();
         for (Bundle element : b) {
             int state = element.getState();
-            logger.debug("Bundle[" + element.getBundleId() + "]:" + element.getSymbolicName() + ",v" + element.getVersion() + ", state:"
+            logger.trace("Bundle[" + element.getBundleId() + "]:" + element.getSymbolicName() + ",v" + element.getVersion() + ", state:"
                     + stateToString(state));
             if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
-                logger.debug("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state));
+                logger.trace("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state));
 
                 try {
                     String host = element.getHeaders().get(Constants.FRAGMENT_HOST);
@@ -1600,8 +1600,8 @@ public class MappingServiceIntegrationTest {
         // BundleContext
         /*
          * for (ServiceReference sr : bc.getAllServiceReferences(null, null)) {
-         * logger.info(sr.getBundle().getSymbolicName());
-         * logger.info(sr.toString()); }
+         * logger.trace(sr.getBundle().getSymbolicName());
+         * logger.trace(sr.toString()); }
          */
     }
 
index e6541a325fe2fc627f5b3644d26cae5c054fb528..3daa29680ffa0863edae9f6bde3bf6705e5b03bc 100644 (file)
@@ -14,8 +14,6 @@ import java.util.Hashtable;
 import org.apache.felix.dm.Component;
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Main application activator class for registering the dependencies and
@@ -25,11 +23,6 @@ import org.slf4j.LoggerFactory;
 
 public class Activator extends ComponentActivatorAbstractBase {
 
-    /*
-     * Logger instance
-     */
-    protected static final Logger logger = LoggerFactory.getLogger(Activator.class);
-
     /**
      * Function called when the activator starts just after some initializations
      * are done by the ComponentActivatorAbstractBase.
index a9c1d6fc7e4fba81c71e9b3b258bbfe6b5220001..c781e89c405c3ce636d07cd35c6f29122ec1e83e 100644 (file)
@@ -75,17 +75,17 @@ public class LispMappingNorthbound implements ILispmappingNorthbound {
     }
 
     void setFlowMappingService(IFlowMapping mappingService) {
-        logger.debug("FlowMapping set in LispNorthbound");
+        logger.trace("FlowMapping set in LispNorthbound");
         this.mappingService = mappingService;
     }
 
     void unsetFlowMappingService(IFlowMapping mappingService) {
-        logger.debug("LispDAO was unset in LISP Northbound");
+        logger.trace("LispDAO was unset in LISP Northbound");
         this.mappingService = null;
     }
 
     public void init() {
-        logger.debug("LISP Northbound Service is initialized!");
+        logger.trace("LISP Northbound Service is initialized!");
     }
 
     public void start() {
@@ -97,7 +97,7 @@ public class LispMappingNorthbound implements ILispmappingNorthbound {
     }
 
     public void destroy() {
-        logger.debug("LISP Northbound Service is destroyed!");
+        logger.trace("LISP Northbound Service is destroyed!");
         mappingService = null;
     }
 
index 7cdd97b995f8c7ac8b99af6def2199ad0c775034..92a596ae3b3db60c36277e31e5c73a045194abb9 100644 (file)
@@ -96,7 +96,7 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
                 socket = new DatagramSocket(new InetSocketAddress(bindingAddress, lispPortNumber));
                 socket.setSoTimeout(lispReceiveTimeout);
             } catch (SocketException e) {
-                logger.warn("Cannot open socket on UDP port " + lispPortNumber, e);
+                logger.error("Cannot open socket on UDP port " + lispPortNumber, e);
                 return;
             }
 
@@ -105,24 +105,24 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
                 DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
                 try {
                     socket.receive(packet);
-                    logger.debug("Received a packet!");
+                    logger.trace("Received a packet!");
                 } catch (SocketTimeoutException ste) {
                     continue;
                 } catch (IOException e) {
-                    logger.error("IO Exception while trying to recieve packet", e);
+                    logger.warn("IO Exception while trying to recieve packet", e);
                 }
-                logger.debug(String.format("Handling packet from {%s}:{%d} (len={%d})", packet.getAddress().getHostAddress(), packet.getPort(),
+                logger.trace(String.format("Handling packet from {%s}:{%d} (len={%d})", packet.getAddress().getHostAddress(), packet.getPort(),
                         packet.getLength()));
 
                 try {
                     lispSouthboundService.handlePacket(packet);
                 } catch (Throwable t) {
-                    logger.error("Error while handling packet", t);
+                    logger.warn("Error while handling packet", t);
                 }
             }
 
             socket.close();
-            logger.info("Socket closed");
+            logger.trace("Socket closed");
             stillRunning = false;
         }
 
@@ -158,7 +158,7 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
                 lispSouthboundService = new LispSouthboundService();
                 registerWithOSGIConsole();
                 registerRPCs(session);
-                logger.debug("Provider Session initialized");
+                logger.trace("Provider Session initialized");
                 if (bindingAddress == null) {
                     setLispAddress("0.0.0.0");
                 }
@@ -182,7 +182,7 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
             ByteBuffer outBuffer = MapNotifySerializer.getInstance().serialize(mapNotify);
             handleSerializedLispBuffer(address, outBuffer, MAP_NOTIFY);
         } else {
-            logger.debug("MapNotify was null");
+            logger.warn("MapNotify was null");
         }
         return null;
     }
@@ -193,11 +193,11 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
         packet.setAddress(address);
         try {
             if (logger.isDebugEnabled()) {
-                logger.debug("Sending " + packetType + " on port " + LispMessage.PORT_NUM + " to address: " + address);
+                logger.trace("Sending " + packetType + " on port " + LispMessage.PORT_NUM + " to address: " + address);
             }
             socket.send(packet);
         } catch (IOException e) {
-            logger.error("Failed to send " + packetType, e);
+            logger.warn("Failed to send " + packetType, e);
         }
     }
 
@@ -207,7 +207,7 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
             ByteBuffer outBuffer = MapReplySerializer.getInstance().serialize(mapReply);
             handleSerializedLispBuffer(address, outBuffer, MAP_REPlY);
         } else {
-            logger.debug("MapReply was null");
+            logger.warn("MapReply was null");
         }
         return null;
     }
@@ -215,10 +215,10 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
     public void setLispAddress(String address) {
         synchronized (startLock) {
             if (bindingAddress != null && bindingAddress.equals(address)) {
-                logger.debug("configured lisp binding address didn't change.");
+                logger.trace("configured lisp binding address didn't change.");
             } else {
                 String action = (bindingAddress == null ? "Setting" : "Resetting");
-                logger.info(action + " lisp binding address to: " + address);
+                logger.trace(action + " lisp binding address to: " + address);
                 bindingAddress = address;
                 if (thread != null) {
                     thread.stopRunning();
index 4705f0e2daca12a41314ca57734187fb06d96979..c27281a84ab6a37eceeb75b7dbed6ab307207404 100644 (file)
@@ -53,16 +53,16 @@ public class LispSouthboundService implements ILispSouthboundService {
         ByteBuffer inBuffer = ByteBuffer.wrap(packet.getData(), 0, packet.getLength());
         Object lispType = LispMessageEnum.valueOf((byte) (ByteUtil.getUnsignedByte(inBuffer, LispMessage.Pos.TYPE) >> 4));
         if (lispType == LispMessageEnum.EncapsulatedControlMessage) {
-            logger.debug("Recieved packet of type EncapsulatedControlMessage");
+            logger.trace("Recieved packet of type EncapsulatedControlMessage");
             handleEncapsulatedControlMessage(inBuffer, packet.getAddress());
         } else if (lispType == LispMessageEnum.MapRequest) {
-            logger.debug("Recieved packet of type MapRequest");
+            logger.trace("Recieved packet of type MapRequest");
             handleMapRequest(inBuffer);
         } else if (lispType == LispMessageEnum.MapRegister) {
-            logger.debug("Recieved packet of type MapRegister");
+            logger.trace("Recieved packet of type MapRegister");
             handleMapRegister(inBuffer, packet.getAddress());
         }
-        logger.debug("Recieved unknown packet type");
+        logger.warn("Recieved unknown packet type");
     }
 
     private void handleEncapsulatedControlMessage(ByteBuffer inBuffer, InetAddress sourceAddress) {
@@ -106,9 +106,9 @@ public class LispSouthboundService implements ILispSouthboundService {
             requestMappingBuilder.setTransportAddress(transportAddressBuilder.build());
             if (notificationProvider != null) {
                 notificationProvider.publish(requestMappingBuilder.build());
-                logger.debug("MapRequest was published!");
+                logger.trace("MapRequest was published!");
             } else {
-                logger.error("Notification Provider is null!");
+                logger.warn("Notification Provider is null!");
             }
         } catch (RuntimeException re) {
             throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
@@ -143,9 +143,9 @@ public class LispSouthboundService implements ILispSouthboundService {
             addMappingBuilder.setTransportAddress(transportAddressBuilder.build());
             if (notificationProvider != null) {
                 notificationProvider.publish(addMappingBuilder.build());
-                logger.debug("MapRegister was published!");
+                logger.trace("MapRegister was published!");
             } else {
-                logger.error("Notification Provider is null!");
+                logger.warn("Notification Provider is null!");
             }
         } catch (RuntimeException re) {
             throw new LispMalformedPacketException("Couldn't deserialize Map-Register (len=" + inBuffer.capacity() + ")", re);