diff --git a/rw_core/core/adapter_manager.go b/rw_core/core/adapter_manager.go
index 45a0ff5..9706cfb 100644
--- a/rw_core/core/adapter_manager.go
+++ b/rw_core/core/adapter_manager.go
@@ -70,7 +70,7 @@
 func (aa *AdapterAgent) getAdapter() *voltha.Adapter {
 	aa.lock.RLock()
 	defer aa.lock.RUnlock()
-	log.Debugw("getAdapter", log.Fields{"adapter": aa.adapter})
+	logger.Debugw("getAdapter", log.Fields{"adapter": aa.adapter})
 	return aa.adapter
 }
 
@@ -130,25 +130,25 @@
 }
 
 func (aMgr *AdapterManager) start(ctx context.Context) error {
-	log.Info("starting-adapter-manager")
+	logger.Info("starting-adapter-manager")
 
 	// Load the existing adapterAgents and device types - this will also ensure the correct paths have been
 	// created if there are no data in the dB to start
 	err := aMgr.loadAdaptersAndDevicetypesInMemory()
 	if err != nil {
-		log.Errorw("Failed-to-load-adapters-and-device-types-in-memeory", log.Fields{"error": err})
+		logger.Errorw("Failed-to-load-adapters-and-device-types-in-memeory", log.Fields{"error": err})
 		return err
 	}
 
 	//// Create the proxies
 	aMgr.adapterProxy, err = aMgr.clusterDataProxy.CreateProxy(ctx, "/adapters", false)
 	if err != nil {
-		log.Errorw("Failed-to-create-adapter-proxy", log.Fields{"error": err})
+		logger.Errorw("Failed-to-create-adapter-proxy", log.Fields{"error": err})
 		return err
 	}
 	aMgr.deviceTypeProxy, err = aMgr.clusterDataProxy.CreateProxy(ctx, "/device_types", false)
 	if err != nil {
-		log.Errorw("Failed-to-create-device-proxy", log.Fields{"error": err})
+		logger.Errorw("Failed-to-create-device-proxy", log.Fields{"error": err})
 		return err
 	}
 
@@ -156,7 +156,7 @@
 	aMgr.adapterProxy.RegisterCallback(model.PostUpdate, aMgr.adapterUpdated)
 	aMgr.deviceTypeProxy.RegisterCallback(model.PostUpdate, aMgr.deviceTypesUpdated)
 	probe.UpdateStatusFromContext(ctx, "adapter-manager", probe.ServiceStatusRunning)
-	log.Info("adapter-manager-started")
+	logger.Info("adapter-manager-started")
 	return nil
 }
 
@@ -165,21 +165,21 @@
 	// Load the adapters
 	adaptersIf, err := aMgr.clusterDataProxy.List(context.Background(), "/adapters", 0, false, "")
 	if err != nil {
-		log.Errorw("Failed-to-list-adapters-from-cluster-data-proxy", log.Fields{"error": err})
+		logger.Errorw("Failed-to-list-adapters-from-cluster-data-proxy", log.Fields{"error": err})
 		return err
 	}
 	if adaptersIf != nil {
 		for _, adapterIf := range adaptersIf.([]interface{}) {
 			if adapter, ok := adapterIf.(*voltha.Adapter); ok {
 				if err := aMgr.addAdapter(adapter, false); err != nil {
-					log.Errorw("failed to add adapter", log.Fields{"adapterId": adapter.Id})
+					logger.Errorw("failed to add adapter", log.Fields{"adapterId": adapter.Id})
 				} else {
-					log.Debugw("adapter added successfully", log.Fields{"adapterId": adapter.Id})
+					logger.Debugw("adapter added successfully", log.Fields{"adapterId": adapter.Id})
 				}
 			}
 		}
 	} else {
-		log.Debug("no-existing-adapter-found")
+		logger.Debug("no-existing-adapter-found")
 		//	No adapter data.   In order to have a proxy setup for that path let's create a fake adapter
 		return aMgr.addAdapter(&voltha.Adapter{Id: SentinelAdapterID}, true)
 	}
@@ -187,23 +187,23 @@
 	// Load the device types
 	deviceTypesIf, err := aMgr.clusterDataProxy.List(context.Background(), "/device_types", 0, false, "")
 	if err != nil {
-		log.Errorw("Failed-to-list-device-types-from-cluster-data-proxy", log.Fields{"error": err})
+		logger.Errorw("Failed-to-list-device-types-from-cluster-data-proxy", log.Fields{"error": err})
 		return err
 	}
 	if deviceTypesIf != nil {
 		dTypes := &voltha.DeviceTypes{Items: []*voltha.DeviceType{}}
 		for _, deviceTypeIf := range deviceTypesIf.([]interface{}) {
 			if dType, ok := deviceTypeIf.(*voltha.DeviceType); ok {
-				log.Debugw("found-existing-device-types", log.Fields{"deviceTypes": dTypes})
+				logger.Debugw("found-existing-device-types", log.Fields{"deviceTypes": dTypes})
 				dTypes.Items = append(dTypes.Items, dType)
 			} else {
-				log.Errorw("not an voltha device type", log.Fields{"interface": deviceTypeIf})
+				logger.Errorw("not an voltha device type", log.Fields{"interface": deviceTypeIf})
 			}
 		}
 		return aMgr.addDeviceTypes(dTypes, false)
 	}
 
-	log.Debug("no-existing-device-type-found")
+	logger.Debug("no-existing-device-type-found")
 	//	No device types data.   In order to have a proxy setup for that path let's create a fake device type
 	return aMgr.addDeviceTypes(&voltha.DeviceTypes{Items: []*voltha.DeviceType{{Id: SentinelDevicetypeID, Adapter: SentinelAdapterID}}}, true)
 }
@@ -229,7 +229,7 @@
 			go func() {
 				err := aMgr.deviceMgr.adapterRestarted(ctx, adapter)
 				if err != nil {
-					log.Errorw("unable-to-restart-adapter", log.Fields{"error": err})
+					logger.Errorw("unable-to-restart-adapter", log.Fields{"error": err})
 				}
 			}()
 			return
@@ -239,13 +239,13 @@
 	// Update the adapters
 	adaptersIf, err := aMgr.clusterDataProxy.List(ctx, "/adapters", 0, false, "")
 	if err != nil {
-		log.Errorw("failed-to-list-adapters-from-cluster-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-list-adapters-from-cluster-proxy", log.Fields{"error": err})
 		return
 	}
 	if adaptersIf != nil {
 		for _, adapterIf := range adaptersIf.([]interface{}) {
 			if adapter, ok := adapterIf.(*voltha.Adapter); ok {
-				log.Debugw("found-existing-adapter", log.Fields{"adapterId": adapter.Id})
+				logger.Debugw("found-existing-adapter", log.Fields{"adapterId": adapter.Id})
 				aMgr.updateAdapterWithoutLock(adapter)
 			}
 		}
@@ -255,14 +255,14 @@
 	// Update the device types
 	deviceTypesIf, err := aMgr.clusterDataProxy.List(context.Background(), "/device_types", 0, false, "")
 	if err != nil {
-		log.Errorw("Failed-to-list-device-types-in-cluster-data-proxy", log.Fields{"error": err})
+		logger.Errorw("Failed-to-list-device-types-in-cluster-data-proxy", log.Fields{"error": err})
 		return
 	}
 	if deviceTypesIf != nil {
 		dTypes := &voltha.DeviceTypes{Items: []*voltha.DeviceType{}}
 		for _, deviceTypeIf := range deviceTypesIf.([]interface{}) {
 			if dType, ok := deviceTypeIf.(*voltha.DeviceType); ok {
-				log.Debugw("found-existing-device-types", log.Fields{"deviceTypes": dTypes})
+				logger.Debugw("found-existing-device-types", log.Fields{"deviceTypes": dTypes})
 				aMgr.updateDeviceTypeWithoutLock(dType)
 			}
 		}
@@ -272,7 +272,7 @@
 func (aMgr *AdapterManager) addAdapter(adapter *voltha.Adapter, saveToDb bool) error {
 	aMgr.lockAdaptersMap.Lock()
 	defer aMgr.lockAdaptersMap.Unlock()
-	log.Debugw("adding-adapter", log.Fields{"adapter": adapter})
+	logger.Debugw("adding-adapter", log.Fields{"adapter": adapter})
 	if _, exist := aMgr.adapterAgents[adapter.Id]; !exist {
 		clonedAdapter := (proto.Clone(adapter)).(*voltha.Adapter)
 		aMgr.adapterAgents[adapter.Id] = newAdapterAgent(clonedAdapter, nil)
@@ -280,20 +280,20 @@
 			// Save the adapter to the KV store - first check if it already exist
 			kvAdapter, err := aMgr.clusterDataProxy.Get(context.Background(), "/adapters/"+adapter.Id, 0, false, "")
 			if err != nil {
-				log.Errorw("failed-to-get-adapters-from-cluster-proxy", log.Fields{"error": err})
+				logger.Errorw("failed-to-get-adapters-from-cluster-proxy", log.Fields{"error": err})
 				return err
 			}
 			if kvAdapter == nil {
 				added, err := aMgr.clusterDataProxy.AddWithID(context.Background(), "/adapters", adapter.Id, clonedAdapter, "")
 				if err != nil {
-					log.Errorw("failed-to-save-adapter-to-cluster-proxy", log.Fields{"error": err})
+					logger.Errorw("failed-to-save-adapter-to-cluster-proxy", log.Fields{"error": err})
 					return err
 				}
 				if added == nil {
 					//TODO:  Errors when saving to KV would require a separate go routine to be launched and try the saving again
-					log.Errorw("failed-to-save-adapter", log.Fields{"adapter": adapter})
+					logger.Errorw("failed-to-save-adapter", log.Fields{"adapter": adapter})
 				} else {
-					log.Debugw("adapter-saved-to-KV-Store", log.Fields{"adapter": adapter})
+					logger.Debugw("adapter-saved-to-KV-Store", log.Fields{"adapter": adapter})
 				}
 			}
 		}
@@ -305,7 +305,7 @@
 	if deviceTypes == nil {
 		return fmt.Errorf("no-device-type")
 	}
-	log.Debugw("adding-device-types", log.Fields{"deviceTypes": deviceTypes})
+	logger.Debugw("adding-device-types", log.Fields{"deviceTypes": deviceTypes})
 	aMgr.lockAdaptersMap.Lock()
 	defer aMgr.lockAdaptersMap.Unlock()
 	aMgr.lockdDeviceTypeToAdapterMap.Lock()
@@ -315,7 +315,7 @@
 		if adapterAgent, exist := aMgr.adapterAgents[clonedDType.Adapter]; exist {
 			adapterAgent.updateDeviceType(clonedDType)
 		} else {
-			log.Debugw("adapter-not-exist", log.Fields{"deviceTypes": deviceTypes, "adapterId": clonedDType.Adapter})
+			logger.Debugw("adapter-not-exist", log.Fields{"deviceTypes": deviceTypes, "adapterId": clonedDType.Adapter})
 			aMgr.adapterAgents[clonedDType.Adapter] = newAdapterAgent(&voltha.Adapter{Id: clonedDType.Adapter}, deviceTypes)
 		}
 		aMgr.deviceTypeToAdapterMap[clonedDType.Id] = clonedDType.Adapter
@@ -325,7 +325,7 @@
 		for _, deviceType := range deviceTypes.Items {
 			dType, err := aMgr.clusterDataProxy.Get(context.Background(), "/device_types/"+deviceType.Id, 0, false, "")
 			if err != nil {
-				log.Errorw("Failed-to--device-types-from-cluster-data-proxy", log.Fields{"error": err})
+				logger.Errorw("Failed-to--device-types-from-cluster-data-proxy", log.Fields{"error": err})
 				return err
 			}
 			if dType == nil {
@@ -333,13 +333,13 @@
 				clonedDType := (proto.Clone(deviceType)).(*voltha.DeviceType)
 				added, err := aMgr.clusterDataProxy.AddWithID(context.Background(), "/device_types", deviceType.Id, clonedDType, "")
 				if err != nil {
-					log.Errorw("Failed-to-add-device-types-to-cluster-data-proxy", log.Fields{"error": err})
+					logger.Errorw("Failed-to-add-device-types-to-cluster-data-proxy", log.Fields{"error": err})
 					return err
 				}
 				if added == nil {
-					log.Errorw("failed-to-save-deviceType", log.Fields{"deviceType": deviceType})
+					logger.Errorw("failed-to-save-deviceType", log.Fields{"deviceType": deviceType})
 				} else {
-					log.Debugw("device-type-saved-to-KV-Store", log.Fields{"deviceType": deviceType})
+					logger.Debugw("device-type-saved-to-KV-Store", log.Fields{"deviceType": deviceType})
 				}
 			}
 		}
@@ -405,29 +405,29 @@
 }
 
 func (aMgr *AdapterManager) registerAdapter(adapter *voltha.Adapter, deviceTypes *voltha.DeviceTypes) (*voltha.CoreInstance, error) {
-	log.Debugw("registerAdapter", log.Fields{"adapter": adapter, "deviceTypes": deviceTypes.Items})
+	logger.Debugw("registerAdapter", log.Fields{"adapter": adapter, "deviceTypes": deviceTypes.Items})
 
 	if aMgr.getAdapter(adapter.Id) != nil {
 		//	Already registered - Adapter may have restarted.  Trigger the reconcile process for that adapter
 		go func() {
 			err := aMgr.deviceMgr.adapterRestarted(context.Background(), adapter)
 			if err != nil {
-				log.Errorw("unable-to-restart-adapter", log.Fields{"error": err})
+				logger.Errorw("unable-to-restart-adapter", log.Fields{"error": err})
 			}
 		}()
 		return &voltha.CoreInstance{InstanceId: aMgr.coreInstanceID}, nil
 	}
 	// Save the adapter and the device types
 	if err := aMgr.addAdapter(adapter, true); err != nil {
-		log.Errorw("failed-to-add-adapter", log.Fields{"error": err})
+		logger.Errorw("failed-to-add-adapter", log.Fields{"error": err})
 		return nil, err
 	}
 	if err := aMgr.addDeviceTypes(deviceTypes, true); err != nil {
-		log.Errorw("failed-to-add-device-types", log.Fields{"error": err})
+		logger.Errorw("failed-to-add-device-types", log.Fields{"error": err})
 		return nil, err
 	}
 
-	log.Debugw("adapter-registered", log.Fields{"adapter": adapter.Id})
+	logger.Debugw("adapter-registered", log.Fields{"adapter": adapter.Id})
 
 	return &voltha.CoreInstance{InstanceId: aMgr.coreInstanceID}, nil
 }
@@ -474,24 +474,24 @@
 
 //adapterUpdated is a callback invoked when an adapter change has been noticed
 func (aMgr *AdapterManager) adapterUpdated(ctx context.Context, args ...interface{}) interface{} {
-	log.Debugw("updateAdapter-callback", log.Fields{"argsLen": len(args)})
+	logger.Debugw("updateAdapter-callback", log.Fields{"argsLen": len(args)})
 
 	var previousData *voltha.Adapters
 	var latestData *voltha.Adapters
 
 	var ok bool
 	if previousData, ok = args[0].(*voltha.Adapters); !ok {
-		log.Errorw("invalid-args", log.Fields{"args0": args[0]})
+		logger.Errorw("invalid-args", log.Fields{"args0": args[0]})
 		return nil
 	}
 	if latestData, ok = args[1].(*voltha.Adapters); !ok {
-		log.Errorw("invalid-args", log.Fields{"args1": args[1]})
+		logger.Errorw("invalid-args", log.Fields{"args1": args[1]})
 		return nil
 	}
 
 	if previousData != nil && latestData != nil {
 		if reflect.DeepEqual(previousData.Items, latestData.Items) {
-			log.Debug("update-not-required")
+			logger.Debug("update-not-required")
 			return nil
 		}
 	}
@@ -507,25 +507,25 @@
 
 //deviceTypesUpdated is a callback invoked when a device type change has been noticed
 func (aMgr *AdapterManager) deviceTypesUpdated(ctx context.Context, args ...interface{}) interface{} {
-	log.Debugw("deviceTypesUpdated-callback", log.Fields{"argsLen": len(args)})
+	logger.Debugw("deviceTypesUpdated-callback", log.Fields{"argsLen": len(args)})
 
 	var previousData *voltha.DeviceTypes
 	var latestData *voltha.DeviceTypes
 
 	var ok bool
 	if previousData, ok = args[0].(*voltha.DeviceTypes); !ok {
-		log.Errorw("invalid-args", log.Fields{"args0": args[0]})
+		logger.Errorw("invalid-args", log.Fields{"args0": args[0]})
 		return nil
 	}
 
 	if latestData, ok = args[1].(*voltha.DeviceTypes); !ok {
-		log.Errorw("invalid-args", log.Fields{"args1": args[1]})
+		logger.Errorw("invalid-args", log.Fields{"args1": args[1]})
 		return nil
 	}
 
 	if previousData != nil && latestData != nil {
 		if reflect.DeepEqual(previousData.Items, latestData.Items) {
-			log.Debug("update-not-required")
+			logger.Debug("update-not-required")
 			return nil
 		}
 	}
diff --git a/rw_core/core/adapter_proxy.go b/rw_core/core/adapter_proxy.go
index d0a2e3f..4c9837b 100755
--- a/rw_core/core/adapter_proxy.go
+++ b/rw_core/core/adapter_proxy.go
@@ -58,7 +58,7 @@
 	// Wait for first response which would indicate whether the request was successfully sent to kafka.
 	firstResponse, ok := <-respChnl
 	if !ok || firstResponse.MType != kafka.RpcSent {
-		log.Errorw("failure to request to kafka", log.Fields{"rpc": rpc, "device-id": deviceID, "error": firstResponse.Err})
+		logger.Errorw("failure to request to kafka", log.Fields{"rpc": rpc, "device-id": deviceID, "error": firstResponse.Err})
 		return nil, firstResponse.Err
 	}
 	// return the kafka channel for the caller to wait for the response of the RPC call
@@ -67,7 +67,7 @@
 
 // adoptDevice invokes adopt device rpc
 func (ap *AdapterProxy) adoptDevice(ctx context.Context, device *voltha.Device) (chan *kafka.RpcResponse, error) {
-	log.Debugw("adoptDevice", log.Fields{"device-id": device.Id})
+	logger.Debugw("adoptDevice", log.Fields{"device-id": device.Id})
 	rpc := "adopt_device"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -80,7 +80,7 @@
 
 // disableDevice invokes disable device rpc
 func (ap *AdapterProxy) disableDevice(ctx context.Context, device *voltha.Device) (chan *kafka.RpcResponse, error) {
-	log.Debugw("disableDevice", log.Fields{"device-id": device.Id})
+	logger.Debugw("disableDevice", log.Fields{"device-id": device.Id})
 	rpc := "disable_device"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -92,7 +92,7 @@
 
 // reEnableDevice invokes reenable device rpc
 func (ap *AdapterProxy) reEnableDevice(ctx context.Context, device *voltha.Device) (chan *kafka.RpcResponse, error) {
-	log.Debugw("reEnableDevice", log.Fields{"device-id": device.Id})
+	logger.Debugw("reEnableDevice", log.Fields{"device-id": device.Id})
 	rpc := "reenable_device"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -104,7 +104,7 @@
 
 // rebootDevice invokes reboot device rpc
 func (ap *AdapterProxy) rebootDevice(ctx context.Context, device *voltha.Device) (chan *kafka.RpcResponse, error) {
-	log.Debugw("rebootDevice", log.Fields{"device-id": device.Id})
+	logger.Debugw("rebootDevice", log.Fields{"device-id": device.Id})
 	rpc := "reboot_device"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -116,7 +116,7 @@
 
 // deleteDevice invokes delete device rpc
 func (ap *AdapterProxy) deleteDevice(ctx context.Context, device *voltha.Device) (chan *kafka.RpcResponse, error) {
-	log.Debugw("deleteDevice", log.Fields{"device-id": device.Id})
+	logger.Debugw("deleteDevice", log.Fields{"device-id": device.Id})
 	rpc := "delete_device"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -128,7 +128,7 @@
 
 // getOfpDeviceInfo invokes get ofp device info rpc
 func (ap *AdapterProxy) getOfpDeviceInfo(ctx context.Context, device *voltha.Device) (chan *kafka.RpcResponse, error) {
-	log.Debugw("getOfpDeviceInfo", log.Fields{"device-id": device.Id})
+	logger.Debugw("getOfpDeviceInfo", log.Fields{"device-id": device.Id})
 	rpc := "get_ofp_device_info"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -140,7 +140,7 @@
 
 // getOfpPortInfo invokes get ofp port info rpc
 func (ap *AdapterProxy) getOfpPortInfo(ctx context.Context, device *voltha.Device, portNo uint32) (chan *kafka.RpcResponse, error) {
-	log.Debugw("getOfpPortInfo", log.Fields{"device-id": device.Id, "port-no": portNo})
+	logger.Debugw("getOfpPortInfo", log.Fields{"device-id": device.Id, "port-no": portNo})
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
 		{Key: "device", Value: device},
@@ -152,7 +152,7 @@
 
 // reconcileDevice invokes reconcile device rpc
 func (ap *AdapterProxy) reconcileDevice(ctx context.Context, device *voltha.Device) (chan *kafka.RpcResponse, error) {
-	log.Debugw("reconcileDevice", log.Fields{"device-id": device.Id})
+	logger.Debugw("reconcileDevice", log.Fields{"device-id": device.Id})
 	rpc := "reconcile_device"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -164,7 +164,7 @@
 
 // downloadImage invokes download image rpc
 func (ap *AdapterProxy) downloadImage(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) (chan *kafka.RpcResponse, error) {
-	log.Debugw("downloadImage", log.Fields{"device-id": device.Id, "image": download.Name})
+	logger.Debugw("downloadImage", log.Fields{"device-id": device.Id, "image": download.Name})
 	rpc := "download_image"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -177,7 +177,7 @@
 
 // getImageDownloadStatus invokes get image download status rpc
 func (ap *AdapterProxy) getImageDownloadStatus(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) (chan *kafka.RpcResponse, error) {
-	log.Debugw("getImageDownloadStatus", log.Fields{"device-id": device.Id, "image": download.Name})
+	logger.Debugw("getImageDownloadStatus", log.Fields{"device-id": device.Id, "image": download.Name})
 	rpc := "get_image_download_status"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -190,7 +190,7 @@
 
 // cancelImageDownload invokes cancel image download rpc
 func (ap *AdapterProxy) cancelImageDownload(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) (chan *kafka.RpcResponse, error) {
-	log.Debugw("cancelImageDownload", log.Fields{"device-id": device.Id, "image": download.Name})
+	logger.Debugw("cancelImageDownload", log.Fields{"device-id": device.Id, "image": download.Name})
 	rpc := "cancel_image_download"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -203,7 +203,7 @@
 
 // activateImageUpdate invokes activate image update rpc
 func (ap *AdapterProxy) activateImageUpdate(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) (chan *kafka.RpcResponse, error) {
-	log.Debugw("activateImageUpdate", log.Fields{"device-id": device.Id, "image": download.Name})
+	logger.Debugw("activateImageUpdate", log.Fields{"device-id": device.Id, "image": download.Name})
 	rpc := "activate_image_update"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -216,7 +216,7 @@
 
 // revertImageUpdate invokes revert image update rpc
 func (ap *AdapterProxy) revertImageUpdate(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) (chan *kafka.RpcResponse, error) {
-	log.Debugw("revertImageUpdate", log.Fields{"device-id": device.Id, "image": download.Name})
+	logger.Debugw("revertImageUpdate", log.Fields{"device-id": device.Id, "image": download.Name})
 	rpc := "revert_image_update"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -228,7 +228,7 @@
 }
 
 func (ap *AdapterProxy) packetOut(ctx context.Context, deviceType string, deviceID string, outPort uint32, packet *openflow_13.OfpPacketOut) (chan *kafka.RpcResponse, error) {
-	log.Debugw("packetOut", log.Fields{"device-id": deviceID, "device-type": deviceType, "out-port": outPort})
+	logger.Debugw("packetOut", log.Fields{"device-id": deviceID, "device-type": deviceType, "out-port": outPort})
 	toTopic := ap.getAdapterTopic(deviceType)
 	rpc := "receive_packet_out"
 	args := []*kafka.KVArg{
@@ -242,7 +242,7 @@
 
 // updateFlowsBulk invokes update flows bulk rpc
 func (ap *AdapterProxy) updateFlowsBulk(ctx context.Context, device *voltha.Device, flows *voltha.Flows, groups *voltha.FlowGroups, flowMetadata *voltha.FlowMetadata) (chan *kafka.RpcResponse, error) {
-	log.Debugw("updateFlowsBulk", log.Fields{"device-id": device.Id, "flow-count": len(flows.Items), "group-count": len(groups.Items), "flow-metadata": flowMetadata})
+	logger.Debugw("updateFlowsBulk", log.Fields{"device-id": device.Id, "flow-count": len(flows.Items), "group-count": len(groups.Items), "flow-metadata": flowMetadata})
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	rpc := "update_flows_bulk"
 	args := []*kafka.KVArg{
@@ -257,7 +257,7 @@
 
 // updateFlowsIncremental invokes update flows incremental rpc
 func (ap *AdapterProxy) updateFlowsIncremental(ctx context.Context, device *voltha.Device, flowChanges *openflow_13.FlowChanges, groupChanges *openflow_13.FlowGroupChanges, flowMetadata *voltha.FlowMetadata) (chan *kafka.RpcResponse, error) {
-	log.Debugw("updateFlowsIncremental",
+	logger.Debugw("updateFlowsIncremental",
 		log.Fields{
 			"device-id":             device.Id,
 			"flow-to-add-count":     len(flowChanges.ToAdd.Items),
@@ -280,7 +280,7 @@
 
 // updatePmConfigs invokes update pm configs rpc
 func (ap *AdapterProxy) updatePmConfigs(ctx context.Context, device *voltha.Device, pmConfigs *voltha.PmConfigs) (chan *kafka.RpcResponse, error) {
-	log.Debugw("updatePmConfigs", log.Fields{"device-id": device.Id, "pm-configs-id": pmConfigs.Id})
+	logger.Debugw("updatePmConfigs", log.Fields{"device-id": device.Id, "pm-configs-id": pmConfigs.Id})
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	rpc := "Update_pm_config"
 	args := []*kafka.KVArg{
@@ -293,7 +293,7 @@
 
 // simulateAlarm invokes simulate alarm rpc
 func (ap *AdapterProxy) simulateAlarm(ctx context.Context, device *voltha.Device, simulateReq *voltha.SimulateAlarmRequest) (chan *kafka.RpcResponse, error) {
-	log.Debugw("simulateAlarm", log.Fields{"device-id": device.Id, "simulate-req-id": simulateReq.Id})
+	logger.Debugw("simulateAlarm", log.Fields{"device-id": device.Id, "simulate-req-id": simulateReq.Id})
 	rpc := "simulate_alarm"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -306,7 +306,7 @@
 }
 
 func (ap *AdapterProxy) disablePort(ctx context.Context, device *voltha.Device, port *voltha.Port) (chan *kafka.RpcResponse, error) {
-	log.Debugw("disablePort", log.Fields{"device-id": device.Id, "port-no": port.PortNo})
+	logger.Debugw("disablePort", log.Fields{"device-id": device.Id, "port-no": port.PortNo})
 	rpc := "disable_port"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -318,7 +318,7 @@
 }
 
 func (ap *AdapterProxy) enablePort(ctx context.Context, device *voltha.Device, port *voltha.Port) (chan *kafka.RpcResponse, error) {
-	log.Debugw("enablePort", log.Fields{"device-id": device.Id, "port-no": port.PortNo})
+	logger.Debugw("enablePort", log.Fields{"device-id": device.Id, "port-no": port.PortNo})
 	rpc := "enable_port"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	args := []*kafka.KVArg{
@@ -331,7 +331,7 @@
 
 // childDeviceLost invokes child device_lost rpc
 func (ap *AdapterProxy) childDeviceLost(ctx context.Context, deviceType string, pDeviceID string, pPortNo uint32, onuID uint32) (chan *kafka.RpcResponse, error) {
-	log.Debugw("childDeviceLost", log.Fields{"parent-device-id": pDeviceID, "parent-port-no": pPortNo, "onu-id": onuID})
+	logger.Debugw("childDeviceLost", log.Fields{"parent-device-id": pDeviceID, "parent-port-no": pPortNo, "onu-id": onuID})
 	rpc := "child_device_lost"
 	toTopic := ap.getAdapterTopic(deviceType)
 	args := []*kafka.KVArg{
@@ -344,7 +344,7 @@
 }
 
 func (ap *AdapterProxy) startOmciTest(ctx context.Context, device *voltha.Device, omcitestrequest *voltha.OmciTestRequest) (chan *kafka.RpcResponse, error) {
-	log.Debugw("Omci_test_Request_adapter_proxy", log.Fields{"device": device, "omciTestRequest": omcitestrequest})
+	logger.Debugw("Omci_test_Request_adapter_proxy", log.Fields{"device": device, "omciTestRequest": omcitestrequest})
 	rpc := "start_omci_test"
 	toTopic := ap.getAdapterTopic(device.Adapter)
 	// Use a device specific topic as we are the only core handling requests for this device
diff --git a/rw_core/core/adapter_proxy_test.go b/rw_core/core/adapter_proxy_test.go
index 36e5e51..8784ff2 100755
--- a/rw_core/core/adapter_proxy_test.go
+++ b/rw_core/core/adapter_proxy_test.go
@@ -68,10 +68,10 @@
 		kafka.DefaultTopic(&kafka.Topic{Name: coreName}))
 
 	if err = coreKafkaICProxy.Start(); err != nil {
-		log.Fatalw("Failure-starting-core-kafka-intercontainerProxy", log.Fields{"error": err})
+		logger.Fatalw("Failure-starting-core-kafka-intercontainerProxy", log.Fields{"error": err})
 	}
 	if err = coreKafkaICProxy.SubscribeWithDefaultRequestHandler(kafka.Topic{Name: coreName}, 0); err != nil {
-		log.Fatalw("Failure-subscribing-core-request-handler", log.Fields{"error": err})
+		logger.Fatalw("Failure-subscribing-core-request-handler", log.Fields{"error": err})
 	}
 
 	// Setup adapter inter-container proxy and adapter request handler
@@ -84,10 +84,10 @@
 		kafka.RequestHandlerInterface(adapterReqHandler))
 
 	if err = adapterKafkaICProxy.Start(); err != nil {
-		log.Fatalw("Failure-starting-adapter-kafka-intercontainerProxy", log.Fields{"error": err})
+		logger.Fatalw("Failure-starting-adapter-kafka-intercontainerProxy", log.Fields{"error": err})
 	}
 	if err = adapterKafkaICProxy.SubscribeWithDefaultRequestHandler(kafka.Topic{Name: adapterName}, 0); err != nil {
-		log.Fatalw("Failure-subscribing-adapter-request-handler", log.Fields{"error": err})
+		logger.Fatalw("Failure-subscribing-adapter-request-handler", log.Fields{"error": err})
 	}
 }
 
diff --git a/rw_core/core/adapter_request_handler.go b/rw_core/core/adapter_request_handler.go
index 85af539..3c1c5d0 100644
--- a/rw_core/core/adapter_request_handler.go
+++ b/rw_core/core/adapter_request_handler.go
@@ -78,7 +78,7 @@
 	if devID != "" {
 		var ownedByMe bool
 		if ownedByMe, err = rhp.core.deviceOwnership.OwnedByMe(ctx, &utils.DeviceID{ID: devID}); err != nil {
-			log.Warnw("getting-ownership-failed", log.Fields{"deviceId": devID, "error": err})
+			logger.Warnw("getting-ownership-failed", log.Fields{"deviceId": devID, "error": err})
 			return nil, kafka.ErrorTransactionInvalidId
 		}
 		acquired, err = txn.Acquired(ctx, timeout, ownedByMe)
@@ -86,10 +86,10 @@
 		acquired, err = txn.Acquired(ctx, timeout)
 	}
 	if err == nil && acquired {
-		log.Debugw("transaction-acquired", log.Fields{"transactionId": txn.txnID})
+		logger.Debugw("transaction-acquired", log.Fields{"transactionId": txn.txnID})
 		return txn, nil
 	}
-	log.Debugw("transaction-not-acquired", log.Fields{"transactionId": txn.txnID, "error": err})
+	logger.Debugw("transaction-not-acquired", log.Fields{"transactionId": txn.txnID, "error": err})
 	return nil, kafka.ErrorTransactionNotAcquired
 }
 
@@ -102,7 +102,7 @@
 // Register registers the adapter
 func (rhp *AdapterRequestHandlerProxy) Register(args []*ic.Argument) (*voltha.CoreInstance, error) {
 	if len(args) < 3 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -113,29 +113,29 @@
 		switch arg.Key {
 		case "adapter":
 			if err := ptypes.UnmarshalAny(arg.Value, adapter); err != nil {
-				log.Warnw("cannot-unmarshal-adapter", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-adapter", log.Fields{"error": err})
 				return nil, err
 			}
 		case "deviceTypes":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceTypes); err != nil {
-				log.Warnw("cannot-unmarshal-device-types", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-types", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("Register", log.Fields{"adapter": *adapter, "device-types": deviceTypes, "transaction-id": transactionID.Val, "core-id": rhp.coreInstanceID})
+	logger.Debugw("Register", log.Fields{"adapter": *adapter, "device-types": deviceTypes, "transaction-id": transactionID.Val, "core-id": rhp.coreInstanceID})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, "")
 		if err != nil {
 			if err.Error() == kafka.ErrorTransactionNotAcquired.Error() {
-				log.Debugw("Another core handled the request", log.Fields{"transactionId": transactionID})
+				logger.Debugw("Another core handled the request", log.Fields{"transactionId": transactionID})
 				// Update our adapters in memory
 				go rhp.adapterMgr.updateAdaptersAndDevicetypesInMemory(context.TODO(), adapter)
 			}
@@ -149,7 +149,7 @@
 // GetDevice returns device info
 func (rhp *AdapterRequestHandlerProxy) GetDevice(args []*ic.Argument) (*voltha.Device, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -160,23 +160,23 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, pID); err != nil {
-				log.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("GetDevice", log.Fields{"deviceID": pID.Id, "transactionID": transactionID.Val})
+	logger.Debugw("GetDevice", log.Fields{"deviceID": pID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, pID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -185,7 +185,7 @@
 	// Get the device via the device manager
 	device, err := rhp.deviceMgr.GetDevice(context.TODO(), pID.Id)
 	if err != nil {
-		log.Debugw("get-device-failed", log.Fields{"deviceID": pID.Id, "error": err})
+		logger.Debugw("get-device-failed", log.Fields{"deviceID": pID.Id, "error": err})
 	}
 	return device, err
 }
@@ -193,7 +193,7 @@
 // DeviceUpdate updates device using adapter data
 func (rhp *AdapterRequestHandlerProxy) DeviceUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -204,32 +204,32 @@
 		switch arg.Key {
 		case "device":
 			if err := ptypes.UnmarshalAny(arg.Value, device); err != nil {
-				log.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("DeviceUpdate", log.Fields{"deviceID": device.Id, "transactionID": transactionID.Val})
+	logger.Debugw("DeviceUpdate", log.Fields{"deviceID": device.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, device.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
-	log.Debugw("DeviceUpdate got txn", log.Fields{"deviceID": device.Id, "transactionID": transactionID.Val})
+	logger.Debugw("DeviceUpdate got txn", log.Fields{"deviceID": device.Id, "transactionID": transactionID.Val})
 
 	if err := rhp.deviceMgr.updateDeviceUsingAdapterData(context.TODO(), device); err != nil {
-		log.Debugw("unable-to-update-device-using-adapter-data", log.Fields{"error": err})
+		logger.Debugw("unable-to-update-device-using-adapter-data", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -238,7 +238,7 @@
 // GetChildDevice returns details of child device
 func (rhp *AdapterRequestHandlerProxy) GetChildDevice(args []*ic.Argument) (*voltha.Device, error) {
 	if len(args) < 3 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -252,38 +252,38 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, pID); err != nil {
-				log.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		case "serial_number":
 			if err := ptypes.UnmarshalAny(arg.Value, serialNumber); err != nil {
-				log.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		case "onu_id":
 			if err := ptypes.UnmarshalAny(arg.Value, onuID); err != nil {
-				log.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		case "parent_port_no":
 			if err := ptypes.UnmarshalAny(arg.Value, parentPortNo); err != nil {
-				log.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("GetChildDevice", log.Fields{"parentDeviceID": pID.Id, "args": args, "transactionID": transactionID.Val})
+	logger.Debugw("GetChildDevice", log.Fields{"parentDeviceID": pID.Id, "args": args, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, pID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -295,7 +295,7 @@
 // GetChildDeviceWithProxyAddress returns details of child device with proxy address
 func (rhp *AdapterRequestHandlerProxy) GetChildDeviceWithProxyAddress(args []*ic.Argument) (*voltha.Device, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -306,23 +306,23 @@
 		switch arg.Key {
 		case "proxy_address":
 			if err := ptypes.UnmarshalAny(arg.Value, proxyAddress); err != nil {
-				log.Warnw("cannot-unmarshal-proxy-address", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-proxy-address", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("GetChildDeviceWithProxyAddress", log.Fields{"proxyAddress": proxyAddress, "transactionID": transactionID.Val})
+	logger.Debugw("GetChildDeviceWithProxyAddress", log.Fields{"proxyAddress": proxyAddress, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, proxyAddress.DeviceId)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -334,7 +334,7 @@
 // GetPorts returns the ports information of the device based on the port type.
 func (rhp *AdapterRequestHandlerProxy) GetPorts(args []*ic.Argument) (*voltha.Ports, error) {
 	if len(args) < 3 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -345,28 +345,28 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "port_type":
 			if err := ptypes.UnmarshalAny(arg.Value, pt); err != nil {
-				log.Warnw("cannot-unmarshal-porttype", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-porttype", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("GetPorts", log.Fields{"deviceID": deviceID.Id, "portype": pt.Val, "transactionID": transactionID.Val})
+	logger.Debugw("GetPorts", log.Fields{"deviceID": deviceID.Id, "portype": pt.Val, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -378,7 +378,7 @@
 // GetChildDevices gets all the child device IDs from the device passed as parameter
 func (rhp *AdapterRequestHandlerProxy) GetChildDevices(args []*ic.Argument) (*voltha.Devices, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -389,23 +389,23 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, pID); err != nil {
-				log.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("GetChildDevices", log.Fields{"deviceID": pID.Id, "transactionID": transactionID.Val})
+	logger.Debugw("GetChildDevices", log.Fields{"deviceID": pID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, pID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -418,7 +418,7 @@
 // {parent_device_id, parent_port_no, child_device_type, channel_id, vendor_id, serial_number)
 func (rhp *AdapterRequestHandlerProxy) ChildDeviceDetected(args []*ic.Argument) (*voltha.Device, error) {
 	if len(args) < 5 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -435,47 +435,47 @@
 		switch arg.Key {
 		case "parent_device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, pID); err != nil {
-				log.Warnw("cannot-unmarshal-parent-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-parent-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "parent_port_no":
 			if err := ptypes.UnmarshalAny(arg.Value, portNo); err != nil {
-				log.Warnw("cannot-unmarshal-parent-port", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-parent-port", log.Fields{"error": err})
 				return nil, err
 			}
 		case "child_device_type":
 			if err := ptypes.UnmarshalAny(arg.Value, dt); err != nil {
-				log.Warnw("cannot-unmarshal-child-device-type", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-child-device-type", log.Fields{"error": err})
 				return nil, err
 			}
 		case "channel_id":
 			if err := ptypes.UnmarshalAny(arg.Value, chnlID); err != nil {
-				log.Warnw("cannot-unmarshal-channel-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-channel-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "vendor_id":
 			if err := ptypes.UnmarshalAny(arg.Value, vendorID); err != nil {
-				log.Warnw("cannot-unmarshal-vendor-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-vendor-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "serial_number":
 			if err := ptypes.UnmarshalAny(arg.Value, serialNumber); err != nil {
-				log.Warnw("cannot-unmarshal-serial-number", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-serial-number", log.Fields{"error": err})
 				return nil, err
 			}
 		case "onu_id":
 			if err := ptypes.UnmarshalAny(arg.Value, onuID); err != nil {
-				log.Warnw("cannot-unmarshal-onu-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-onu-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("ChildDeviceDetected", log.Fields{"parentDeviceID": pID.Id, "parentPortNo": portNo.Val,
+	logger.Debugw("ChildDeviceDetected", log.Fields{"parentDeviceID": pID.Id, "parentPortNo": portNo.Val,
 		"deviceType": dt.Val, "channelID": chnlID.Val, "serialNumber": serialNumber.Val,
 		"vendorID": vendorID.Val, "onuID": onuID.Val, "transactionID": transactionID.Val})
 
@@ -483,7 +483,7 @@
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, pID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -491,7 +491,7 @@
 
 	device, err := rhp.deviceMgr.childDeviceDetected(context.TODO(), pID.Id, portNo.Val, dt.Val, chnlID.Val, vendorID.Val, serialNumber.Val, onuID.Val)
 	if err != nil {
-		log.Debugw("child-detection-failed", log.Fields{"parentID": pID.Id, "onuID": onuID.Val, "error": err})
+		logger.Debugw("child-detection-failed", log.Fields{"parentID": pID.Id, "onuID": onuID.Val, "error": err})
 	}
 	return device, err
 }
@@ -499,7 +499,7 @@
 // DeviceStateUpdate updates device status
 func (rhp *AdapterRequestHandlerProxy) DeviceStateUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -511,34 +511,34 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "oper_status":
 			if err := ptypes.UnmarshalAny(arg.Value, operStatus); err != nil {
-				log.Warnw("cannot-unmarshal-operStatus", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-operStatus", log.Fields{"error": err})
 				return nil, err
 			}
 		case "connect_status":
 			if err := ptypes.UnmarshalAny(arg.Value, connStatus); err != nil {
-				log.Warnw("cannot-unmarshal-connStatus", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-connStatus", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("DeviceStateUpdate", log.Fields{"deviceID": deviceID.Id, "oper-status": operStatus,
+	logger.Debugw("DeviceStateUpdate", log.Fields{"deviceID": deviceID.Id, "oper-status": operStatus,
 		"conn-status": connStatus, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -546,7 +546,7 @@
 
 	if err := rhp.deviceMgr.updateDeviceStatus(context.TODO(), deviceID.Id, voltha.OperStatus_Types(operStatus.Val),
 		voltha.ConnectStatus_Types(connStatus.Val)); err != nil {
-		log.Debugw("unable-to-update-device-status", log.Fields{"error": err})
+		logger.Debugw("unable-to-update-device-status", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -555,7 +555,7 @@
 // ChildrenStateUpdate updates child device status
 func (rhp *AdapterRequestHandlerProxy) ChildrenStateUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -567,34 +567,34 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "oper_status":
 			if err := ptypes.UnmarshalAny(arg.Value, operStatus); err != nil {
-				log.Warnw("cannot-unmarshal-operStatus", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-operStatus", log.Fields{"error": err})
 				return nil, err
 			}
 		case "connect_status":
 			if err := ptypes.UnmarshalAny(arg.Value, connStatus); err != nil {
-				log.Warnw("cannot-unmarshal-connStatus", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-connStatus", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("ChildrenStateUpdate", log.Fields{"deviceID": deviceID.Id, "oper-status": operStatus,
+	logger.Debugw("ChildrenStateUpdate", log.Fields{"deviceID": deviceID.Id, "oper-status": operStatus,
 		"conn-status": connStatus, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -603,7 +603,7 @@
 	// When the enum is not set (i.e. -1), Go still convert to the Enum type with the value being -1
 	if err := rhp.deviceMgr.updateChildrenStatus(context.TODO(), deviceID.Id, voltha.OperStatus_Types(operStatus.Val),
 		voltha.ConnectStatus_Types(connStatus.Val)); err != nil {
-		log.Debugw("unable-to-update-children-status", log.Fields{"error": err})
+		logger.Debugw("unable-to-update-children-status", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -612,7 +612,7 @@
 // PortsStateUpdate updates the ports state related to the device
 func (rhp *AdapterRequestHandlerProxy) PortsStateUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -623,35 +623,35 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "oper_status":
 			if err := ptypes.UnmarshalAny(arg.Value, operStatus); err != nil {
-				log.Warnw("cannot-unmarshal-operStatus", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-operStatus", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("PortsStateUpdate", log.Fields{"deviceID": deviceID.Id, "operStatus": operStatus, "transactionID": transactionID.Val})
+	logger.Debugw("PortsStateUpdate", log.Fields{"deviceID": deviceID.Id, "operStatus": operStatus, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.updatePortsState(context.TODO(), deviceID.Id, voltha.OperStatus_Types(operStatus.Val)); err != nil {
-		log.Debugw("unable-to-update-ports-state", log.Fields{"error": err})
+		logger.Debugw("unable-to-update-ports-state", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -660,7 +660,7 @@
 // PortStateUpdate updates the port state of the device
 func (rhp *AdapterRequestHandlerProxy) PortStateUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -673,39 +673,39 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "oper_status":
 			if err := ptypes.UnmarshalAny(arg.Value, operStatus); err != nil {
-				log.Warnw("cannot-unmarshal-operStatus", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-operStatus", log.Fields{"error": err})
 				return nil, err
 			}
 		case "port_type":
 			if err := ptypes.UnmarshalAny(arg.Value, portType); err != nil {
-				log.Warnw("cannot-unmarshal-porttype", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-porttype", log.Fields{"error": err})
 				return nil, err
 			}
 		case "port_no":
 			if err := ptypes.UnmarshalAny(arg.Value, portNo); err != nil {
-				log.Warnw("cannot-unmarshal-portno", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-portno", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("PortStateUpdate", log.Fields{"deviceID": deviceID.Id, "operStatus": operStatus,
+	logger.Debugw("PortStateUpdate", log.Fields{"deviceID": deviceID.Id, "operStatus": operStatus,
 		"portType": portType, "portNo": portNo, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
@@ -716,7 +716,7 @@
 		// If the error doesn't change behavior and is essentially ignored, it is not an error, it is a
 		// warning.
 		// TODO: VOL-2707
-		log.Debugw("unable-to-update-port-state", log.Fields{"error": err})
+		logger.Debugw("unable-to-update-port-state", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -725,7 +725,7 @@
 // DeleteAllPorts deletes all ports of device
 func (rhp *AdapterRequestHandlerProxy) DeleteAllPorts(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -735,30 +735,30 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("DeleteAllPorts", log.Fields{"deviceID": deviceID.Id, "transactionID": transactionID.Val})
+	logger.Debugw("DeleteAllPorts", log.Fields{"deviceID": deviceID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.deleteAllPorts(context.TODO(), deviceID.Id); err != nil {
-		log.Debugw("unable-to-delete-ports", log.Fields{"error": err})
+		logger.Debugw("unable-to-delete-ports", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -768,7 +768,7 @@
 // This will trigger the Core to disable all the child devices.
 func (rhp *AdapterRequestHandlerProxy) ChildDevicesLost(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -778,30 +778,30 @@
 		switch arg.Key {
 		case "parent_device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("ChildDevicesLost", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
+	logger.Debugw("ChildDevicesLost", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, parentDeviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.childDevicesLost(context.TODO(), parentDeviceID.Id); err != nil {
-		log.Debugw("unable-to-disable-child-devices", log.Fields{"error": err})
+		logger.Debugw("unable-to-disable-child-devices", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -811,7 +811,7 @@
 // This will trigger the Core to Enable all the child devices of that parent.
 func (rhp *AdapterRequestHandlerProxy) ChildDevicesDetected(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -821,30 +821,30 @@
 		switch arg.Key {
 		case "parent_device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("ChildDevicesDetected", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
+	logger.Debugw("ChildDevicesDetected", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, parentDeviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.childDevicesDetected(context.TODO(), parentDeviceID.Id); err != nil {
-		log.Debugw("child-devices-detection-failed", log.Fields{"parentID": parentDeviceID.Id, "error": err})
+		logger.Debugw("child-devices-detection-failed", log.Fields{"parentID": parentDeviceID.Id, "error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -853,7 +853,7 @@
 // PortCreated adds port to device
 func (rhp *AdapterRequestHandlerProxy) PortCreated(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -864,35 +864,35 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "port":
 			if err := ptypes.UnmarshalAny(arg.Value, port); err != nil {
-				log.Warnw("cannot-unmarshal-port", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-port", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("PortCreated", log.Fields{"deviceID": deviceID.Id, "port": port, "transactionID": transactionID.Val})
+	logger.Debugw("PortCreated", log.Fields{"deviceID": deviceID.Id, "port": port, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.addPort(context.TODO(), deviceID.Id, port); err != nil {
-		log.Debugw("unable-to-add-port", log.Fields{"error": err})
+		logger.Debugw("unable-to-add-port", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -901,7 +901,7 @@
 // DevicePMConfigUpdate initializes the pm configs as defined by the adapter.
 func (rhp *AdapterRequestHandlerProxy) DevicePMConfigUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -911,31 +911,31 @@
 		switch arg.Key {
 		case "device_pm_config":
 			if err := ptypes.UnmarshalAny(arg.Value, pmConfigs); err != nil {
-				log.Warnw("cannot-unmarshal-pm-config", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-pm-config", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("DevicePMConfigUpdate", log.Fields{"deviceID": pmConfigs.Id, "configs": pmConfigs,
+	logger.Debugw("DevicePMConfigUpdate", log.Fields{"deviceID": pmConfigs.Id, "configs": pmConfigs,
 		"transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, pmConfigs.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.initPmConfigs(context.TODO(), pmConfigs.Id, pmConfigs); err != nil {
-		log.Debugw("unable-to-initialize-pm-configs", log.Fields{"error": err})
+		logger.Debugw("unable-to-initialize-pm-configs", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -944,7 +944,7 @@
 // PacketIn sends the incoming packet of device
 func (rhp *AdapterRequestHandlerProxy) PacketIn(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 4 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -956,27 +956,27 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "port":
 			if err := ptypes.UnmarshalAny(arg.Value, portNo); err != nil {
-				log.Warnw("cannot-unmarshal-port-no", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-port-no", log.Fields{"error": err})
 				return nil, err
 			}
 		case "packet":
 			if err := ptypes.UnmarshalAny(arg.Value, packet); err != nil {
-				log.Warnw("cannot-unmarshal-packet", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-packet", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("PacketIn", log.Fields{"deviceID": deviceID.Id, "port": portNo.Val, "packet": packet,
+	logger.Debugw("PacketIn", log.Fields{"deviceID": deviceID.Id, "port": portNo.Val, "packet": packet,
 		"transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
@@ -985,14 +985,14 @@
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.PacketIn(context.TODO(), deviceID.Id, uint32(portNo.Val), transactionID.Val, packet.Payload); err != nil {
-		log.Debugw("unable-to-receive-packet-from-adapter", log.Fields{"error": err})
+		logger.Debugw("unable-to-receive-packet-from-adapter", log.Fields{"error": err})
 		return nil, err
 
 	}
@@ -1002,7 +1002,7 @@
 // UpdateImageDownload updates image download
 func (rhp *AdapterRequestHandlerProxy) UpdateImageDownload(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -1013,36 +1013,36 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "image_download":
 			if err := ptypes.UnmarshalAny(arg.Value, img); err != nil {
-				log.Warnw("cannot-unmarshal-imgaeDownload", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-imgaeDownload", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("UpdateImageDownload", log.Fields{"deviceID": deviceID.Id, "image-download": img,
+	logger.Debugw("UpdateImageDownload", log.Fields{"deviceID": deviceID.Id, "image-download": img,
 		"transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.updateImageDownload(context.TODO(), deviceID.Id, img); err != nil {
-		log.Debugw("unable-to-update-image-download", log.Fields{"error": err})
+		logger.Debugw("unable-to-update-image-download", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -1051,7 +1051,7 @@
 // ReconcileChildDevices reconciles child devices
 func (rhp *AdapterRequestHandlerProxy) ReconcileChildDevices(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
-		log.Warn("invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
@@ -1061,30 +1061,30 @@
 		switch arg.Key {
 		case "parent_device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("ReconcileChildDevices", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
+	logger.Debugw("ReconcileChildDevices", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, parentDeviceID.Id)
 		if err != nil {
-			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.reconcileChildDevices(context.TODO(), parentDeviceID.Id); err != nil {
-		log.Debugw("unable-to-reconcile-child-devices", log.Fields{"error": err})
+		logger.Debugw("unable-to-reconcile-child-devices", log.Fields{"error": err})
 		return nil, err
 	}
 	return &empty.Empty{}, nil
@@ -1093,7 +1093,7 @@
 // DeviceReasonUpdate updates device reason
 func (rhp *AdapterRequestHandlerProxy) DeviceReasonUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
-		log.Warn("DeviceReasonUpdate: invalid-number-of-args", log.Fields{"args": args})
+		logger.Warn("DeviceReasonUpdate: invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("DeviceReasonUpdate: invalid-number-of-args")
 		return nil, err
 	}
@@ -1104,36 +1104,36 @@
 		switch arg.Key {
 		case "device_id":
 			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
-				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "device_reason":
 			if err := ptypes.UnmarshalAny(arg.Value, reason); err != nil {
-				log.Warnw("cannot-unmarshal-reason", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-reason", log.Fields{"error": err})
 				return nil, err
 			}
 		case kafka.TransactionKey:
 			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
-				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+				logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("DeviceReasonUpdate", log.Fields{"deviceId": deviceID.Id, "reason": reason.Val,
+	logger.Debugw("DeviceReasonUpdate", log.Fields{"deviceId": deviceID.Id, "reason": reason.Val,
 		"transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
 		txn, err := rhp.takeRequestOwnership(context.TODO(), transactionID.Val, deviceID.Id)
 		if err != nil {
-			log.Debugw("DeviceReasonUpdate: Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
+			logger.Debugw("DeviceReasonUpdate: Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
 		}
 		defer txn.Close(context.TODO())
 	}
 
 	if err := rhp.deviceMgr.updateDeviceReason(context.TODO(), deviceID.Id, reason.Val); err != nil {
-		log.Debugw("unable-to-update-device-reason", log.Fields{"error": err})
+		logger.Debugw("unable-to-update-device-reason", log.Fields{"error": err})
 		return nil, err
 
 	}
diff --git a/rw_core/core/common.go b/rw_core/core/common.go
new file mode 100644
index 0000000..93d82f1
--- /dev/null
+++ b/rw_core/core/common.go
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2020-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Package core Common Logger initialization
+package core
+
+import (
+	"github.com/opencord/voltha-lib-go/v3/pkg/log"
+)
+
+var logger log.Logger
+
+func init() {
+	// Setup this package so that it's log level can be modified at run time
+	var err error
+	logger, err = log.AddPackage(log.JSON, log.ErrorLevel, log.Fields{"pkg": "core"})
+	if err != nil {
+		panic(err)
+	}
+}
diff --git a/rw_core/core/common_test.go b/rw_core/core/common_test.go
index 8375f70..f2cf3da 100644
--- a/rw_core/core/common_test.go
+++ b/rw_core/core/common_test.go
@@ -39,7 +39,6 @@
 )
 
 const (
-	logLevel              = log.FatalLevel
 	volthaSerialNumberKey = "voltha_serial_number"
 	retryInterval         = 50 * time.Millisecond
 )
@@ -60,13 +59,6 @@
 type isConditionSatisfied func() bool
 
 func init() {
-	_, err := log.AddPackage(log.JSON, logLevel, log.Fields{"instanceId": "coreTests"})
-	if err != nil {
-		panic(err)
-	}
-	// Update all loggers to log level specified as input parameter
-	log.SetAllLogLevel(log.ErrorLevel)
-
 	//Default mode is two rw-core running in a pair of competing cores
 	coreInCompeteMode = true
 }
@@ -117,7 +109,7 @@
 		txnPrefix,
 		client,
 		cf.KVStoreTimeout); err != nil {
-		log.Fatal("creating-transaction-context-failed")
+		logger.Fatal("creating-transaction-context-failed")
 	}
 	return client
 }
@@ -136,16 +128,16 @@
 	case OnuAdapter:
 		adapter = cm.NewONUAdapter(adapterCoreProxy)
 	default:
-		log.Fatalf("invalid-adapter-type-%d", adapterType)
+		logger.Fatalf("invalid-adapter-type-%d", adapterType)
 	}
 	adapterReqHandler = com.NewRequestHandlerProxy(coreInstanceID, adapter, adapterCoreProxy)
 
 	if err = adapterKafkaICProxy.Start(); err != nil {
-		log.Errorw("Failure-starting-adapter-intercontainerProxy", log.Fields{"error": err})
+		logger.Errorw("Failure-starting-adapter-intercontainerProxy", log.Fields{"error": err})
 		return nil, err
 	}
 	if err = adapterKafkaICProxy.SubscribeWithRequestHandlerInterface(kafka.Topic{Name: adapterName}, adapterReqHandler); err != nil {
-		log.Errorw("Failure-to-subscribe-onu-request-handler", log.Fields{"error": err})
+		logger.Errorw("Failure-to-subscribe-onu-request-handler", log.Fields{"error": err})
 		return nil, err
 	}
 	return adapter, nil
diff --git a/rw_core/core/core.go b/rw_core/core/core.go
index 0206ee0..57d00cf 100644
--- a/rw_core/core/core.go
+++ b/rw_core/core/core.go
@@ -58,13 +58,6 @@
 	deviceOwnership   *DeviceOwnership
 }
 
-func init() {
-	_, err := log.AddPackage(log.JSON, log.WarnLevel, nil)
-	if err != nil {
-		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
-	}
-}
-
 // NewCore creates instance of rw core
 func NewCore(ctx context.Context, id string, cf *config.RWCoreFlags, kvClient kvstore.Client, kafkaClient kafka.Client) *Core {
 	var core Core
@@ -111,11 +104,11 @@
 		}
 	}
 
-	log.Info("starting-core-services", log.Fields{"coreId": core.instanceID})
+	logger.Info("starting-core-services", log.Fields{"coreId": core.instanceID})
 
 	// Wait until connection to KV Store is up
 	if err := core.waitUntilKVStoreReachableOrMaxTries(ctx, core.config.MaxConnectionRetries, core.config.ConnectionRetryInterval); err != nil {
-		log.Fatal("Unable-to-connect-to-KV-store")
+		logger.Fatal("Unable-to-connect-to-KV-store")
 	}
 	if p != nil {
 		p.UpdateStatus("kv-store", probe.ServiceStatusRunning)
@@ -137,7 +130,7 @@
 	// private copies of the poiner to core.kmp.
 	core.initKafkaManager(ctx)
 
-	log.Debugw("values", log.Fields{"kmp": core.kmp})
+	logger.Debugw("values", log.Fields{"kmp": core.kmp})
 	core.deviceMgr = newDeviceManager(core)
 	core.adapterMgr = newAdapterManager(core.clusterDataProxy, core.instanceID, core.kafkaClient, core.deviceMgr)
 	core.deviceMgr.adapterMgr = core.adapterMgr
@@ -162,14 +155,14 @@
 	core.deviceOwnership = NewDeviceOwnership(core.instanceID, core.kvClient, core.deviceMgr, core.logicalDeviceMgr,
 		"service/voltha/owns_device", 10)
 
-	log.Info("core-services-started")
+	logger.Info("core-services-started")
 	return nil
 }
 
 // Stop brings down core services
 func (core *Core) Stop(ctx context.Context) {
 	core.stopOnce.Do(func() {
-		log.Info("stopping-adaptercore")
+		logger.Info("stopping-adaptercore")
 		// Signal to the KVStoreMonitor that we are stopping.
 		close(core.exitChannel)
 		// Stop all the started services
@@ -185,7 +178,7 @@
 		if core.kmp != nil {
 			core.kmp.Stop()
 		}
-		log.Info("adaptercore-stopped")
+		logger.Info("adaptercore-stopped")
 	})
 }
 
@@ -193,10 +186,10 @@
 func (core *Core) startGRPCService(ctx context.Context) {
 	//	create an insecure gserver server
 	core.grpcServer = grpcserver.NewGrpcServer(core.config.GrpcHost, core.config.GrpcPort, nil, false, probe.GetProbeFromContext(ctx))
-	log.Info("grpc-server-created")
+	logger.Info("grpc-server-created")
 
 	core.grpcNBIAPIHandler = NewAPIHandler(core)
-	log.Infow("grpc-handler", log.Fields{"core_binding_key": core.config.CoreBindingKey})
+	logger.Infow("grpc-handler", log.Fields{"core_binding_key": core.config.CoreBindingKey})
 	core.logicalDeviceMgr.setGrpcNbiHandler(core.grpcNBIAPIHandler)
 	//	Create a function to register the core GRPC service with the GRPC server
 	f := func(gs *grpc.Server) {
@@ -207,7 +200,7 @@
 	}
 
 	core.grpcServer.AddService(f)
-	log.Info("grpc-service-added")
+	logger.Info("grpc-service-added")
 
 	/*
 	 * Start the GRPC server
@@ -221,14 +214,14 @@
 	 * ready, when it really isn't.
 	 */
 	probe.UpdateStatusFromContext(ctx, "grpc-service", probe.ServiceStatusRunning)
-	log.Info("grpc-server-started")
+	logger.Info("grpc-server-started")
 	core.grpcServer.Start(ctx)
 	probe.UpdateStatusFromContext(ctx, "grpc-service", probe.ServiceStatusStopped)
 }
 
 // Initialize the kafka manager, but we will start it later
 func (core *Core) initKafkaManager(ctx context.Context) {
-	log.Infow("initialize-kafka-manager", log.Fields{"host": core.config.KafkaAdapterHost,
+	logger.Infow("initialize-kafka-manager", log.Fields{"host": core.config.KafkaAdapterHost,
 		"port": core.config.KafkaAdapterPort, "topic": core.config.CoreTopic})
 
 	probe.UpdateStatusFromContext(ctx, "message-bus", probe.ServiceStatusPreparing)
@@ -278,51 +271,51 @@
  */
 
 func (core *Core) startKafkaManager(ctx context.Context, startupRetryInterval time.Duration, liveProbeInterval time.Duration, notLiveProbeInterval time.Duration) {
-	log.Infow("starting-kafka-manager-thread", log.Fields{"host": core.config.KafkaAdapterHost,
+	logger.Infow("starting-kafka-manager-thread", log.Fields{"host": core.config.KafkaAdapterHost,
 		"port": core.config.KafkaAdapterPort, "topic": core.config.CoreTopic})
 
 	started := false
 	for !started {
 		// If we haven't started yet, then try to start
-		log.Infow("starting-kafka-proxy", log.Fields{})
+		logger.Infow("starting-kafka-proxy", log.Fields{})
 		if err := core.kmp.Start(); err != nil {
 			// We failed to start. Delay and then try again later.
 			// Don't worry about liveness, as we can't be live until we've started.
 			probe.UpdateStatusFromContext(ctx, "message-bus", probe.ServiceStatusNotReady)
-			log.Infow("error-starting-kafka-messaging-proxy", log.Fields{"error": err})
+			logger.Infow("error-starting-kafka-messaging-proxy", log.Fields{"error": err})
 			time.Sleep(startupRetryInterval)
 		} else {
 			// We started. We only need to do this once.
 			// Next we'll fall through and start checking liveness.
-			log.Infow("started-kafka-proxy", log.Fields{})
+			logger.Infow("started-kafka-proxy", log.Fields{})
 
 			// cannot do this until after the kmp is started
 			if err := core.registerAdapterRequestHandlers(ctx, core.instanceID, core.deviceMgr, core.logicalDeviceMgr, core.adapterMgr, core.clusterDataProxy, core.localDataProxy); err != nil {
-				log.Fatal("Failure-registering-adapterRequestHandler")
+				logger.Fatal("Failure-registering-adapterRequestHandler")
 			}
 
 			started = true
 		}
 	}
 
-	log.Info("started-kafka-message-proxy")
+	logger.Info("started-kafka-message-proxy")
 
 	livenessChannel := core.kmp.EnableLivenessChannel(true)
 
-	log.Info("enabled-kafka-liveness-channel")
+	logger.Info("enabled-kafka-liveness-channel")
 
 	timeout := liveProbeInterval
 	for {
 		timeoutTimer := time.NewTimer(timeout)
 		select {
 		case liveness := <-livenessChannel:
-			log.Infow("kafka-manager-thread-liveness-event", log.Fields{"liveness": liveness})
+			logger.Infow("kafka-manager-thread-liveness-event", log.Fields{"liveness": liveness})
 			// there was a state change in Kafka liveness
 			if !liveness {
 				probe.UpdateStatusFromContext(ctx, "message-bus", probe.ServiceStatusNotReady)
 
 				if core.grpcServer != nil {
-					log.Info("kafka-manager-thread-set-server-notready")
+					logger.Info("kafka-manager-thread-set-server-notready")
 				}
 
 				// retry frequently while life is bad
@@ -331,7 +324,7 @@
 				probe.UpdateStatusFromContext(ctx, "message-bus", probe.ServiceStatusRunning)
 
 				if core.grpcServer != nil {
-					log.Info("kafka-manager-thread-set-server-ready")
+					logger.Info("kafka-manager-thread-set-server-ready")
 				}
 
 				// retry infrequently while life is good
@@ -341,14 +334,14 @@
 				<-timeoutTimer.C
 			}
 		case <-timeoutTimer.C:
-			log.Info("kafka-proxy-liveness-recheck")
+			logger.Info("kafka-proxy-liveness-recheck")
 			// send the liveness probe in a goroutine; we don't want to deadlock ourselves as
 			// the liveness probe may wait (and block) writing to our channel.
 			go func() {
 				err := core.kmp.SendLiveness()
 				if err != nil {
 					// Catch possible error case if sending liveness after Sarama has been stopped.
-					log.Warnw("error-kafka-send-liveness", log.Fields{"error": err})
+					logger.Warnw("error-kafka-send-liveness", log.Fields{"error": err})
 				}
 			}()
 		}
@@ -357,12 +350,12 @@
 
 // waitUntilKVStoreReachableOrMaxTries will wait until it can connect to a KV store or until maxtries has been reached
 func (core *Core) waitUntilKVStoreReachableOrMaxTries(ctx context.Context, maxRetries int, retryInterval time.Duration) error {
-	log.Infow("verifying-KV-store-connectivity", log.Fields{"host": core.config.KVStoreHost,
+	logger.Infow("verifying-KV-store-connectivity", log.Fields{"host": core.config.KVStoreHost,
 		"port": core.config.KVStorePort, "retries": maxRetries, "retryInterval": retryInterval})
 	count := 0
 	for {
 		if !core.kvClient.IsConnectionUp(ctx) {
-			log.Info("KV-store-unreachable")
+			logger.Info("KV-store-unreachable")
 			if maxRetries != -1 {
 				if count >= maxRetries {
 					return status.Error(codes.Unavailable, "kv store unreachable")
@@ -371,13 +364,13 @@
 			count++
 			//	Take a nap before retrying
 			time.Sleep(retryInterval)
-			log.Infow("retry-KV-store-connectivity", log.Fields{"retryCount": count, "maxRetries": maxRetries, "retryInterval": retryInterval})
+			logger.Infow("retry-KV-store-connectivity", log.Fields{"retryCount": count, "maxRetries": maxRetries, "retryInterval": retryInterval})
 
 		} else {
 			break
 		}
 	}
-	log.Info("KV-store-reachable")
+	logger.Info("KV-store-reachable")
 	return nil
 }
 
@@ -389,39 +382,39 @@
 
 	// Register the broadcast topic to handle any core-bound broadcast requests
 	if err := core.kmp.SubscribeWithRequestHandlerInterface(kafka.Topic{Name: core.config.CoreTopic}, requestProxy); err != nil {
-		log.Fatalw("Failed-registering-broadcast-handler", log.Fields{"topic": core.config.CoreTopic})
+		logger.Fatalw("Failed-registering-broadcast-handler", log.Fields{"topic": core.config.CoreTopic})
 		return err
 	}
 
 	// Register the core-pair topic to handle core-bound requests destined to the core pair
 	if err := core.kmp.SubscribeWithDefaultRequestHandler(kafka.Topic{Name: core.config.CorePairTopic}, kafka.OffsetNewest); err != nil {
-		log.Fatalw("Failed-registering-pair-handler", log.Fields{"topic": core.config.CorePairTopic})
+		logger.Fatalw("Failed-registering-pair-handler", log.Fields{"topic": core.config.CorePairTopic})
 		return err
 	}
 
-	log.Info("request-handler-registered")
+	logger.Info("request-handler-registered")
 	return nil
 }
 
 func (core *Core) startDeviceManager(ctx context.Context) {
-	log.Info("DeviceManager-Starting...")
+	logger.Info("DeviceManager-Starting...")
 	core.deviceMgr.start(ctx, core.logicalDeviceMgr)
-	log.Info("DeviceManager-Started")
+	logger.Info("DeviceManager-Started")
 }
 
 func (core *Core) startLogicalDeviceManager(ctx context.Context) {
-	log.Info("Logical-DeviceManager-Starting...")
+	logger.Info("Logical-DeviceManager-Starting...")
 	core.logicalDeviceMgr.start(ctx)
-	log.Info("Logical-DeviceManager-Started")
+	logger.Info("Logical-DeviceManager-Started")
 }
 
 func (core *Core) startAdapterManager(ctx context.Context) {
-	log.Info("Adapter-Manager-Starting...")
+	logger.Info("Adapter-Manager-Starting...")
 	err := core.adapterMgr.start(ctx)
 	if err != nil {
-		log.Fatalf("failed-to-start-adapter-manager: error %v ", err)
+		logger.Fatalf("failed-to-start-adapter-manager: error %v ", err)
 	}
-	log.Info("Adapter-Manager-Started")
+	logger.Info("Adapter-Manager-Started")
 }
 
 /*
@@ -439,12 +432,12 @@
 * start issuing UNAVAILABLE response while the probe is not ready.
  */
 func (core *Core) monitorKvstoreLiveness(ctx context.Context) {
-	log.Info("start-monitoring-kvstore-liveness")
+	logger.Info("start-monitoring-kvstore-liveness")
 
 	// Instruct backend to create Liveness channel for transporting state updates
 	livenessChannel := core.backend.EnableLivenessChannel()
 
-	log.Debug("enabled-kvstore-liveness-channel")
+	logger.Debug("enabled-kvstore-liveness-channel")
 
 	// Default state for kvstore is alive for rw_core
 	timeout := core.config.LiveProbeInterval
@@ -454,13 +447,13 @@
 		select {
 
 		case liveness := <-livenessChannel:
-			log.Debugw("received-liveness-change-notification", log.Fields{"liveness": liveness})
+			logger.Debugw("received-liveness-change-notification", log.Fields{"liveness": liveness})
 
 			if !liveness {
 				probe.UpdateStatusFromContext(ctx, "kv-store", probe.ServiceStatusNotReady)
 
 				if core.grpcServer != nil {
-					log.Info("kvstore-set-server-notready")
+					logger.Info("kvstore-set-server-notready")
 				}
 
 				timeout = core.config.NotLiveProbeInterval
@@ -469,7 +462,7 @@
 				probe.UpdateStatusFromContext(ctx, "kv-store", probe.ServiceStatusRunning)
 
 				if core.grpcServer != nil {
-					log.Info("kvstore-set-server-ready")
+					logger.Info("kvstore-set-server-ready")
 				}
 
 				timeout = core.config.LiveProbeInterval
@@ -483,7 +476,7 @@
 			break loop
 
 		case <-timeoutTimer.C:
-			log.Info("kvstore-perform-liveness-check-on-timeout")
+			logger.Info("kvstore-perform-liveness-check-on-timeout")
 
 			// Trigger Liveness check if no liveness update received within the timeout period.
 			// The Liveness check will push Live state to same channel which this routine is
diff --git a/rw_core/core/device_agent.go b/rw_core/core/device_agent.go
index 25f3413..1df4572 100755
--- a/rw_core/core/device_agent.go
+++ b/rw_core/core/device_agent.go
@@ -97,7 +97,7 @@
 	defer func() {
 		if !startSucceeded {
 			if err := agent.stop(ctx); err != nil {
-				log.Errorw("failed-to-cleanup-after-unsuccessful-start", log.Fields{"device-id": agent.deviceID, "error": err})
+				logger.Errorw("failed-to-cleanup-after-unsuccessful-start", log.Fields{"device-id": agent.deviceID, "error": err})
 			}
 		}
 	}()
@@ -124,7 +124,7 @@
 		} else {
 			return nil, status.Errorf(codes.NotFound, "device-%s-loading-failed", agent.deviceID)
 		}
-		log.Infow("device-loaded-from-dB", log.Fields{"device-id": agent.deviceID})
+		logger.Infow("device-loaded-from-dB", log.Fields{"device-id": agent.deviceID})
 	} else {
 		// Create a new device
 		// Assumption is that AdminState, FlowGroups, and Flows are unitialized since this
@@ -158,7 +158,7 @@
 	agent.deviceProxy.RegisterCallback(model.PostUpdate, agent.processUpdate)
 
 	startSucceeded = true
-	log.Debugw("device-agent-started", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("device-agent-started", log.Fields{"device-id": agent.deviceID})
 
 	return agent.getDevice(ctx)
 }
@@ -174,7 +174,7 @@
 	}
 	defer agent.requestQueue.RequestComplete()
 
-	log.Infow("stopping-device-agent", log.Fields{"deviceId": agent.deviceID, "parentId": agent.parentID})
+	logger.Infow("stopping-device-agent", log.Fields{"deviceId": agent.deviceID, "parentId": agent.parentID})
 
 	// First unregister any callbacks
 	if agent.deviceProxy != nil {
@@ -187,7 +187,7 @@
 		return err
 	}
 	if removed == nil {
-		log.Debugw("device-already-removed", log.Fields{"device-id": agent.deviceID})
+		logger.Debugw("device-already-removed", log.Fields{"device-id": agent.deviceID})
 	}
 
 	// Stop the request queue - no more requests can be processed
@@ -197,7 +197,7 @@
 
 	agent.stopped = true
 
-	log.Infow("device-agent-stopped", log.Fields{"device-id": agent.deviceID, "parent-id": agent.parentID})
+	logger.Infow("device-agent-stopped", log.Fields{"device-id": agent.deviceID, "parent-id": agent.parentID})
 
 	return nil
 }
@@ -205,22 +205,22 @@
 // Load the most recent state from the KVStore for the device.
 func (agent *DeviceAgent) reconcileWithKVStore(ctx context.Context) {
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
-		log.Warnw("request-aborted", log.Fields{"device-id": agent.deviceID, "error": err})
+		logger.Warnw("request-aborted", log.Fields{"device-id": agent.deviceID, "error": err})
 		return
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debug("reconciling-device-agent-devicetype")
+	logger.Debug("reconciling-device-agent-devicetype")
 	// TODO: context timeout
 	device, err := agent.clusterDataProxy.Get(ctx, "/devices/"+agent.deviceID, 1, true, "")
 	if err != nil {
-		log.Errorw("kv-get-failed", log.Fields{"device-id": agent.deviceID, "error": err})
+		logger.Errorw("kv-get-failed", log.Fields{"device-id": agent.deviceID, "error": err})
 		return
 	}
 	if device != nil {
 		if d, ok := device.(*voltha.Device); ok {
 			agent.deviceType = d.Adapter
 			agent.device = proto.Clone(d).(*voltha.Device)
-			log.Debugw("reconciled-device-agent-devicetype", log.Fields{"device-id": agent.deviceID, "type": agent.deviceType})
+			logger.Debugw("reconciled-device-agent-devicetype", log.Fields{"device-id": agent.deviceID, "type": agent.deviceType})
 		}
 	}
 }
@@ -228,7 +228,7 @@
 // onSuccess is a common callback for scenarios where we receive a nil response following a request to an adapter
 // and the only action required is to publish a successful result on kafka
 func (agent *DeviceAgent) onSuccess(rpc string, response interface{}, reqArgs ...interface{}) {
-	log.Debugw("response successful", log.Fields{"rpc": rpc, "device-id": agent.deviceID})
+	logger.Debugw("response successful", log.Fields{"rpc": rpc, "device-id": agent.deviceID})
 	// TODO: Post success message onto kafka
 }
 
@@ -236,9 +236,9 @@
 // and the only action required is to publish the failed result on kafka
 func (agent *DeviceAgent) onFailure(rpc string, response interface{}, reqArgs ...interface{}) {
 	if res, ok := response.(error); ok {
-		log.Errorw("rpc-failed", log.Fields{"rpc": rpc, "device-id": agent.deviceID, "error": res, "args": reqArgs})
+		logger.Errorw("rpc-failed", log.Fields{"rpc": rpc, "device-id": agent.deviceID, "error": res, "args": reqArgs})
 	} else {
-		log.Errorw("rpc-failed-invalid-error", log.Fields{"rpc": rpc, "device-id": agent.deviceID, "args": reqArgs})
+		logger.Errorw("rpc-failed-invalid-error", log.Fields{"rpc": rpc, "device-id": agent.deviceID, "args": reqArgs})
 	}
 	// TODO: Post failure message onto kafka
 }
@@ -281,7 +281,7 @@
 	}
 	defer agent.requestQueue.RequestComplete()
 
-	log.Debugw("enableDevice", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("enableDevice", log.Fields{"device-id": agent.deviceID})
 
 	cloned := agent.getDeviceWithoutLock()
 
@@ -295,7 +295,7 @@
 	cloned.Adapter = adapterName
 
 	if cloned.AdminState == voltha.AdminState_ENABLED {
-		log.Debugw("device-already-enabled", log.Fields{"device-id": agent.deviceID})
+		logger.Debugw("device-already-enabled", log.Fields{"device-id": agent.deviceID})
 		return nil
 	}
 
@@ -410,10 +410,10 @@
 }
 
 func (agent *DeviceAgent) addFlowsAndGroupsToAdapter(ctx context.Context, newFlows []*ofp.OfpFlowStats, newGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
-	log.Debugw("add-flows-groups-to-adapters", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "groups": newGroups, "flow-metadata": flowMetadata})
+	logger.Debugw("add-flows-groups-to-adapters", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "groups": newGroups, "flow-metadata": flowMetadata})
 
 	if (len(newFlows) | len(newGroups)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "groups": newGroups})
+		logger.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "groups": newGroups})
 		return coreutils.DoneResponse(), nil
 	}
 
@@ -439,7 +439,7 @@
 
 	// Sanity check
 	if (len(updatedAllFlows) | len(flowsToDelete) | len(updatedAllGroups) | len(groupsToDelete)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "groups": newGroups})
+		logger.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "groups": newGroups})
 		return coreutils.DoneResponse(), nil
 	}
 
@@ -455,7 +455,7 @@
 	response := coreutils.NewResponse()
 	if !dType.AcceptsAddRemoveFlowUpdates {
 		if len(updatedAllGroups) != 0 && reflect.DeepEqual(existingGroups.Items, updatedAllGroups) && len(updatedAllFlows) != 0 && reflect.DeepEqual(existingFlows.Items, updatedAllFlows) {
-			log.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "groups": newGroups})
+			logger.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": newFlows, "groups": newGroups})
 			cancel()
 			return coreutils.DoneResponse(), nil
 		}
@@ -493,17 +493,17 @@
 		return err
 	}
 	if errs := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, response); errs != nil {
-		log.Warnw("no-adapter-response", log.Fields{"device-id": agent.deviceID, "result": errs})
+		logger.Warnw("no-adapter-response", log.Fields{"device-id": agent.deviceID, "result": errs})
 		return status.Errorf(codes.Aborted, "flow-failure-device-%s", agent.deviceID)
 	}
 	return nil
 }
 
 func (agent *DeviceAgent) deleteFlowsAndGroupsFromAdapter(ctx context.Context, flowsToDel []*ofp.OfpFlowStats, groupsToDel []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
-	log.Debugw("delete-flows-groups-from-adapter", log.Fields{"device-id": agent.deviceID, "flows": flowsToDel, "groups": groupsToDel})
+	logger.Debugw("delete-flows-groups-from-adapter", log.Fields{"device-id": agent.deviceID, "flows": flowsToDel, "groups": groupsToDel})
 
 	if (len(flowsToDel) | len(groupsToDel)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": flowsToDel, "groups": groupsToDel})
+		logger.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": flowsToDel, "groups": groupsToDel})
 		return coreutils.DoneResponse(), nil
 	}
 
@@ -538,7 +538,7 @@
 		}
 	}
 
-	log.Debugw("deleteFlowsAndGroups",
+	logger.Debugw("deleteFlowsAndGroups",
 		log.Fields{
 			"device-id":      agent.deviceID,
 			"flows-to-del":   len(flowsToDel),
@@ -549,7 +549,7 @@
 
 	// Sanity check
 	if (len(flowsToKeep) | len(flowsToDel) | len(groupsToKeep) | len(groupsToDel)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows-to-del": flowsToDel, "groups-to-del": groupsToDel})
+		logger.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows-to-del": flowsToDel, "groups-to-del": groupsToDel})
 		return coreutils.DoneResponse(), nil
 	}
 
@@ -565,7 +565,7 @@
 	response := coreutils.NewResponse()
 	if !dType.AcceptsAddRemoveFlowUpdates {
 		if len(groupsToKeep) != 0 && reflect.DeepEqual(existingGroups.Items, groupsToKeep) && len(flowsToKeep) != 0 && reflect.DeepEqual(existingFlows.Items, flowsToKeep) {
-			log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flowsToDel": flowsToDel, "groupsToDel": groupsToDel})
+			logger.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flowsToDel": flowsToDel, "groupsToDel": groupsToDel})
 			cancel()
 			return coreutils.DoneResponse(), nil
 		}
@@ -609,10 +609,10 @@
 }
 
 func (agent *DeviceAgent) updateFlowsAndGroupsToAdapter(ctx context.Context, updatedFlows []*ofp.OfpFlowStats, updatedGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
-	log.Debugw("updateFlowsAndGroups", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
+	logger.Debugw("updateFlowsAndGroups", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
 
 	if (len(updatedFlows) | len(updatedGroups)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
+		logger.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
 		return coreutils.DoneResponse(), nil
 	}
 
@@ -634,11 +634,11 @@
 	existingGroups := proto.Clone(device.FlowGroups).(*ofp.FlowGroups)
 
 	if len(updatedGroups) != 0 && reflect.DeepEqual(existingGroups.Items, updatedGroups) && len(updatedFlows) != 0 && reflect.DeepEqual(existingFlows.Items, updatedFlows) {
-		log.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
+		logger.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
 		return coreutils.DoneResponse(), nil
 	}
 
-	log.Debugw("updating-flows-and-groups",
+	logger.Debugw("updating-flows-and-groups",
 		log.Fields{
 			"device-id":      agent.deviceID,
 			"updated-flows":  updatedFlows,
@@ -692,7 +692,7 @@
 			}
 		}
 
-		log.Debugw("updating-flows-and-groups",
+		logger.Debugw("updating-flows-and-groups",
 			log.Fields{
 				"device-id":        agent.deviceID,
 				"flows-to-add":     flowsToAdd,
@@ -703,7 +703,7 @@
 
 		// Sanity check
 		if (len(flowsToAdd) | len(flowsToDelete) | len(groupsToAdd) | len(groupsToDelete) | len(updatedGroups)) == 0 {
-			log.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
+			logger.Debugw("nothing-to-update", log.Fields{"device-id": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
 			cancel()
 			return coreutils.DoneResponse(), nil
 		}
@@ -743,7 +743,7 @@
 
 //deleteAllFlows deletes all flows in the device table
 func (agent *DeviceAgent) deleteAllFlows(ctx context.Context) error {
-	log.Debugw("deleteAllFlows", log.Fields{"deviceId": agent.deviceID})
+	logger.Debugw("deleteAllFlows", log.Fields{"deviceId": agent.deviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -765,12 +765,12 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("disableDevice", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("disableDevice", log.Fields{"device-id": agent.deviceID})
 
 	cloned := agent.getDeviceWithoutLock()
 
 	if cloned.AdminState == voltha.AdminState_DISABLED {
-		log.Debugw("device-already-disabled", log.Fields{"id": agent.deviceID})
+		logger.Debugw("device-already-disabled", log.Fields{"id": agent.deviceID})
 		return nil
 	}
 	if cloned.AdminState == voltha.AdminState_PREPROVISIONED ||
@@ -801,7 +801,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("rebootDevice", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("rebootDevice", log.Fields{"device-id": agent.deviceID})
 
 	device := agent.getDeviceWithoutLock()
 	subCtx, cancel := context.WithTimeout(context.Background(), agent.defaultTimeout)
@@ -815,7 +815,7 @@
 }
 
 func (agent *DeviceAgent) deleteDevice(ctx context.Context) error {
-	log.Debugw("deleteDevice", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("deleteDevice", log.Fields{"device-id": agent.deviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -852,7 +852,7 @@
 	}
 	defer agent.requestQueue.RequestComplete()
 
-	log.Debugw("setParentId", log.Fields{"device-id": device.Id, "parent-id": parentID})
+	logger.Debugw("setParentId", log.Fields{"device-id": device.Id, "parent-id": parentID})
 
 	cloned := agent.getDeviceWithoutLock()
 	cloned.ParentId = parentID
@@ -869,7 +869,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("updatePmConfigs", log.Fields{"device-id": pmConfigs.Id})
+	logger.Debugw("updatePmConfigs", log.Fields{"device-id": pmConfigs.Id})
 
 	cloned := agent.getDeviceWithoutLock()
 	cloned.PmConfigs = proto.Clone(pmConfigs).(*voltha.PmConfigs)
@@ -893,7 +893,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("initPmConfigs", log.Fields{"device-id": pmConfigs.Id})
+	logger.Debugw("initPmConfigs", log.Fields{"device-id": pmConfigs.Id})
 
 	cloned := agent.getDeviceWithoutLock()
 	cloned.PmConfigs = proto.Clone(pmConfigs).(*voltha.PmConfigs)
@@ -913,7 +913,7 @@
 		return nil, err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("listPmConfigs", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("listPmConfigs", log.Fields{"device-id": agent.deviceID})
 
 	return agent.getDeviceWithoutLock().PmConfigs, nil
 }
@@ -924,7 +924,7 @@
 	}
 	defer agent.requestQueue.RequestComplete()
 
-	log.Debugw("downloadImage", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("downloadImage", log.Fields{"device-id": agent.deviceID})
 
 	device := agent.getDeviceWithoutLock()
 
@@ -939,7 +939,7 @@
 		cloned.ImageDownloads = []*voltha.ImageDownload{clonedImg}
 	} else {
 		if device.AdminState != voltha.AdminState_ENABLED {
-			log.Debugw("device-not-enabled", log.Fields{"id": agent.deviceID})
+			logger.Debugw("device-not-enabled", log.Fields{"id": agent.deviceID})
 			return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, expected-admin-state:%s", agent.deviceID, voltha.AdminState_ENABLED)
 		}
 		// Save the image
@@ -983,7 +983,7 @@
 	}
 	defer agent.requestQueue.RequestComplete()
 
-	log.Debugw("cancelImageDownload", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("cancelImageDownload", log.Fields{"device-id": agent.deviceID})
 
 	device := agent.getDeviceWithoutLock()
 
@@ -1022,7 +1022,7 @@
 		return nil, err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("activateImage", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("activateImage", log.Fields{"device-id": agent.deviceID})
 	cloned := agent.getDeviceWithoutLock()
 
 	// Verify whether the Image is in the list of image being downloaded
@@ -1063,7 +1063,7 @@
 		return nil, err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("revertImage", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("revertImage", log.Fields{"device-id": agent.deviceID})
 
 	cloned := agent.getDeviceWithoutLock()
 
@@ -1098,7 +1098,7 @@
 }
 
 func (agent *DeviceAgent) getImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	log.Debugw("getImageDownloadStatus", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("getImageDownloadStatus", log.Fields{"device-id": agent.deviceID})
 
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return nil, err
@@ -1130,7 +1130,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("updating-image-download", log.Fields{"device-id": agent.deviceID, "img": img})
+	logger.Debugw("updating-image-download", log.Fields{"device-id": agent.deviceID, "img": img})
 
 	cloned := agent.getDeviceWithoutLock()
 
@@ -1162,7 +1162,7 @@
 		return nil, err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("getImageDownload", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("getImageDownload", log.Fields{"device-id": agent.deviceID})
 
 	cloned := agent.getDeviceWithoutLock()
 	for _, image := range cloned.ImageDownloads {
@@ -1178,14 +1178,14 @@
 		return nil, err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("listImageDownloads", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("listImageDownloads", log.Fields{"device-id": agent.deviceID})
 
 	return &voltha.ImageDownloads{Items: agent.getDeviceWithoutLock().ImageDownloads}, nil
 }
 
 // getPorts retrieves the ports information of the device based on the port type.
 func (agent *DeviceAgent) getPorts(ctx context.Context, portType voltha.Port_PortType) *voltha.Ports {
-	log.Debugw("getPorts", log.Fields{"device-id": agent.deviceID, "port-type": portType})
+	logger.Debugw("getPorts", log.Fields{"device-id": agent.deviceID, "port-type": portType})
 	ports := &voltha.Ports{}
 	if device, _ := agent.deviceMgr.GetDevice(ctx, agent.deviceID); device != nil {
 		for _, port := range device.Ports {
@@ -1199,7 +1199,7 @@
 
 // getSwitchCapability retrieves the switch capability of a parent device
 func (agent *DeviceAgent) getSwitchCapability(ctx context.Context) (*ic.SwitchCapability, error) {
-	log.Debugw("getSwitchCapability", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("getSwitchCapability", log.Fields{"device-id": agent.deviceID})
 
 	cloned, err := agent.getDevice(ctx)
 	if err != nil {
@@ -1228,7 +1228,7 @@
 
 // getPortCapability retrieves the port capability of a device
 func (agent *DeviceAgent) getPortCapability(ctx context.Context, portNo uint32) (*ic.PortCapability, error) {
-	log.Debugw("getPortCapability", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("getPortCapability", log.Fields{"device-id": agent.deviceID})
 	device, err := agent.getDevice(ctx)
 	if err != nil {
 		return nil, err
@@ -1265,7 +1265,7 @@
 	if err, ok := response.(error); ok {
 		errResp = err
 	}
-	log.Warnw("packet-out-error", log.Fields{
+	logger.Warnw("packet-out-error", log.Fields{
 		"device-id": agent.deviceID,
 		"error":     errResp,
 		"packet":    hex.EncodeToString(packet),
@@ -1298,20 +1298,20 @@
 		var ok bool
 		if len(args) == 2 {
 			if previous, ok = args[0].(*voltha.Device); !ok {
-				log.Errorw("invalid-callback-type", log.Fields{"data": args[0]})
+				logger.Errorw("invalid-callback-type", log.Fields{"data": args[0]})
 				return nil
 			}
 			if current, ok = args[1].(*voltha.Device); !ok {
-				log.Errorw("invalid-callback-type", log.Fields{"data": args[1]})
+				logger.Errorw("invalid-callback-type", log.Fields{"data": args[1]})
 				return nil
 			}
 		} else {
-			log.Errorw("too-many-args-in-callback", log.Fields{"len": len(args)})
+			logger.Errorw("too-many-args-in-callback", log.Fields{"len": len(args)})
 			return nil
 		}
 		// Perform the state transition in it's own go routine
 		if err := agent.deviceMgr.processTransition(context.Background(), previous, current); err != nil {
-			log.Errorw("failed-process-transition", log.Fields{"device-id": previous.Id,
+			logger.Errorw("failed-process-transition", log.Fields{"device-id": previous.Id,
 				"previous-admin-state": previous.AdminState, "current-admin-state": current.AdminState})
 		}
 		return nil
@@ -1339,7 +1339,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("updateDeviceUsingAdapterData", log.Fields{"device-id": device.Id})
+	logger.Debugw("updateDeviceUsingAdapterData", log.Fields{"device-id": device.Id})
 
 	updatedDevice, err := agent.mergeDeviceInfoFromAdapter(device)
 	if err != nil {
@@ -1350,7 +1350,7 @@
 }
 
 func (agent *DeviceAgent) updateDeviceWithoutLock(ctx context.Context, device *voltha.Device) error {
-	log.Debugw("updateDevice", log.Fields{"deviceId": device.Id})
+	logger.Debugw("updateDevice", log.Fields{"deviceId": device.Id})
 	//cloned := proto.Clone(device).(*voltha.Device)
 	cloned := device
 	return agent.updateDeviceInStoreWithoutLock(ctx, cloned, false, "")
@@ -1366,20 +1366,20 @@
 
 	// Ensure the enums passed in are valid - they will be invalid if they are not set when this function is invoked
 	if s, ok := voltha.ConnectStatus_Types_value[connStatus.String()]; ok {
-		log.Debugw("updateDeviceStatus-conn", log.Fields{"ok": ok, "val": s})
+		logger.Debugw("updateDeviceStatus-conn", log.Fields{"ok": ok, "val": s})
 		cloned.ConnectStatus = connStatus
 	}
 	if s, ok := voltha.OperStatus_Types_value[operStatus.String()]; ok {
-		log.Debugw("updateDeviceStatus-oper", log.Fields{"ok": ok, "val": s})
+		logger.Debugw("updateDeviceStatus-oper", log.Fields{"ok": ok, "val": s})
 		cloned.OperStatus = operStatus
 	}
-	log.Debugw("updateDeviceStatus", log.Fields{"deviceId": cloned.Id, "operStatus": cloned.OperStatus, "connectStatus": cloned.ConnectStatus})
+	logger.Debugw("updateDeviceStatus", log.Fields{"deviceId": cloned.Id, "operStatus": cloned.OperStatus, "connectStatus": cloned.ConnectStatus})
 	// Store the device
 	return agent.updateDeviceInStoreWithoutLock(ctx, cloned, false, "")
 }
 
 func (agent *DeviceAgent) updatePortsOperState(ctx context.Context, operStatus voltha.OperStatus_Types) error {
-	log.Debugw("updatePortsOperState", log.Fields{"device-id": agent.deviceID})
+	logger.Debugw("updatePortsOperState", log.Fields{"device-id": agent.deviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -1410,13 +1410,13 @@
 			port.OperStatus = operStatus
 		}
 	}
-	log.Debugw("portStatusUpdate", log.Fields{"deviceId": cloned.Id})
+	logger.Debugw("portStatusUpdate", log.Fields{"deviceId": cloned.Id})
 	// Store the device
 	return agent.updateDeviceInStoreWithoutLock(ctx, cloned, false, "")
 }
 
 func (agent *DeviceAgent) deleteAllPorts(ctx context.Context) error {
-	log.Debugw("deleteAllPorts", log.Fields{"deviceId": agent.deviceID})
+	logger.Debugw("deleteAllPorts", log.Fields{"deviceId": agent.deviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -1426,16 +1426,16 @@
 
 	if cloned.AdminState != voltha.AdminState_DISABLED && cloned.AdminState != voltha.AdminState_DELETED {
 		err := status.Error(codes.FailedPrecondition, fmt.Sprintf("invalid-state-%v", cloned.AdminState))
-		log.Warnw("invalid-state-removing-ports", log.Fields{"state": cloned.AdminState, "error": err})
+		logger.Warnw("invalid-state-removing-ports", log.Fields{"state": cloned.AdminState, "error": err})
 		return err
 	}
 	if len(cloned.Ports) == 0 {
-		log.Debugw("no-ports-present", log.Fields{"deviceId": agent.deviceID})
+		logger.Debugw("no-ports-present", log.Fields{"deviceId": agent.deviceID})
 		return nil
 	}
 
 	cloned.Ports = []*voltha.Port{}
-	log.Debugw("portStatusUpdate", log.Fields{"deviceId": cloned.Id})
+	logger.Debugw("portStatusUpdate", log.Fields{"deviceId": cloned.Id})
 	// Store the device
 	return agent.updateDeviceInStoreWithoutLock(ctx, cloned, false, "")
 }
@@ -1445,26 +1445,26 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("addPort", log.Fields{"deviceId": agent.deviceID})
+	logger.Debugw("addPort", log.Fields{"deviceId": agent.deviceID})
 
 	cloned := agent.getDeviceWithoutLock()
 	updatePort := false
 	if cloned.Ports == nil {
 		//	First port
-		log.Debugw("addPort-first-port-to-add", log.Fields{"deviceId": agent.deviceID})
+		logger.Debugw("addPort-first-port-to-add", log.Fields{"deviceId": agent.deviceID})
 		cloned.Ports = make([]*voltha.Port, 0)
 	} else {
 		for _, p := range cloned.Ports {
 			if p.Type == port.Type && p.PortNo == port.PortNo {
 				if p.Label == "" && p.Type == voltha.Port_PON_OLT {
 					//Creation of OLT PON port is being processed after a default PON port was created.  Just update it.
-					log.Infow("update-pon-port-created-by-default", log.Fields{"default-port": p, "port-to-add": port})
+					logger.Infow("update-pon-port-created-by-default", log.Fields{"default-port": p, "port-to-add": port})
 					p.Label = port.Label
 					p.OperStatus = port.OperStatus
 					updatePort = true
 					break
 				}
-				log.Debugw("port already exists", log.Fields{"port": port})
+				logger.Debugw("port already exists", log.Fields{"port": port})
 				return nil
 			}
 		}
@@ -1484,7 +1484,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("adding-peer-peerPort", log.Fields{"device-id": agent.deviceID, "peer-peerPort": peerPort})
+	logger.Debugw("adding-peer-peerPort", log.Fields{"device-id": agent.deviceID, "peer-peerPort": peerPort})
 
 	cloned := agent.getDeviceWithoutLock()
 
@@ -1494,7 +1494,7 @@
 		if port.PortNo == peerPort.PortNo { // found peerPort
 			cp := proto.Clone(peerPort).(*voltha.Port_PeerPort)
 			port.Peers = append(port.Peers, cp)
-			log.Debugw("found-peer", log.Fields{"device-id": agent.deviceID, "portNo": peerPort.PortNo, "deviceId": agent.deviceID})
+			logger.Debugw("found-peer", log.Fields{"device-id": agent.deviceID, "portNo": peerPort.PortNo, "deviceId": agent.deviceID})
 			found = true
 			break
 		}
@@ -1510,7 +1510,7 @@
 			Peers:      []*voltha.Port_PeerPort{proto.Clone(peerPort).(*voltha.Port_PeerPort)},
 		}
 		cloned.Ports = append(cloned.Ports, ponPort)
-		log.Infow("adding-default-pon-port", log.Fields{"device-id": agent.deviceID, "peer": peerPort, "pon-port": ponPort})
+		logger.Infow("adding-default-pon-port", log.Fields{"device-id": agent.deviceID, "peer": peerPort, "pon-port": ponPort})
 	}
 	// Store the device
 	return agent.updateDeviceInStoreWithoutLock(ctx, cloned, false, "")
@@ -1519,7 +1519,7 @@
 // TODO: A generic device update by attribute
 func (agent *DeviceAgent) updateDeviceAttribute(ctx context.Context, name string, value interface{}) {
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
-		log.Warnw("request-aborted", log.Fields{"device-id": agent.deviceID, "name": name, "error": err})
+		logger.Warnw("request-aborted", log.Fields{"device-id": agent.deviceID, "name": name, "error": err})
 		return
 	}
 	defer agent.requestQueue.RequestComplete()
@@ -1547,11 +1547,11 @@
 			}
 		}
 	}
-	log.Debugw("update-field-status", log.Fields{"deviceId": cloned.Id, "name": name, "updated": updated})
+	logger.Debugw("update-field-status", log.Fields{"deviceId": cloned.Id, "name": name, "updated": updated})
 	//	Save the data
 
 	if err := agent.updateDeviceInStoreWithoutLock(ctx, cloned, false, ""); err != nil {
-		log.Warnw("attribute-update-failed", log.Fields{"attribute": name, "value": value})
+		logger.Warnw("attribute-update-failed", log.Fields{"attribute": name, "value": value})
 	}
 }
 
@@ -1560,7 +1560,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("simulateAlarm", log.Fields{"id": agent.deviceID})
+	logger.Debugw("simulateAlarm", log.Fields{"id": agent.deviceID})
 
 	cloned := agent.getDeviceWithoutLock()
 
@@ -1585,7 +1585,7 @@
 	if afterUpdate == nil {
 		return status.Errorf(codes.Internal, "failed-update-device:%s", agent.deviceID)
 	}
-	log.Debugw("updated-device-in-store", log.Fields{"deviceId: ": agent.deviceID})
+	logger.Debugw("updated-device-in-store", log.Fields{"deviceId: ": agent.deviceID})
 
 	agent.device = proto.Clone(device).(*voltha.Device)
 
@@ -1600,7 +1600,7 @@
 
 	cloned := agent.getDeviceWithoutLock()
 	cloned.Reason = reason
-	log.Debugw("updateDeviceReason", log.Fields{"deviceId": cloned.Id, "reason": cloned.Reason})
+	logger.Debugw("updateDeviceReason", log.Fields{"deviceId": cloned.Id, "reason": cloned.Reason})
 	// Store the device
 	return agent.updateDeviceInStoreWithoutLock(ctx, cloned, false, "")
 }
@@ -1610,7 +1610,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("disablePort", log.Fields{"device-id": agent.deviceID, "port-no": Port.PortNo})
+	logger.Debugw("disablePort", log.Fields{"device-id": agent.deviceID, "port-no": Port.PortNo})
 	var cp *voltha.Port
 	// Get the most up to date the device info
 	device := agent.getDeviceWithoutLock()
@@ -1631,7 +1631,7 @@
 	}
 	// Store the device
 	if err := agent.updateDeviceInStoreWithoutLock(ctx, device, false, ""); err != nil {
-		log.Debugw("updateDeviceInStoreWithoutLock error ", log.Fields{"device-id": agent.deviceID, "port-no": Port.PortNo, "error": err})
+		logger.Debugw("updateDeviceInStoreWithoutLock error ", log.Fields{"device-id": agent.deviceID, "port-no": Port.PortNo, "error": err})
 		return err
 	}
 
@@ -1651,7 +1651,7 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debugw("enablePort", log.Fields{"device-id": agent.deviceID, "port-no": Port.PortNo})
+	logger.Debugw("enablePort", log.Fields{"device-id": agent.deviceID, "port-no": Port.PortNo})
 
 	var cp *voltha.Port
 	// Get the most up to date the device info
@@ -1673,7 +1673,7 @@
 	}
 	// Store the device
 	if err := agent.updateDeviceInStoreWithoutLock(ctx, device, false, ""); err != nil {
-		log.Debugw("updateDeviceInStoreWithoutLock error ", log.Fields{"device-id": agent.deviceID, "port-no": Port.PortNo, "error": err})
+		logger.Debugw("updateDeviceInStoreWithoutLock error ", log.Fields{"device-id": agent.deviceID, "port-no": Port.PortNo, "error": err})
 		return err
 	}
 	//send request to adapter
@@ -1693,7 +1693,7 @@
 	}
 	defer agent.requestQueue.RequestComplete()
 
-	log.Debugw("childDeviceLost", log.Fields{"child-device-id": device.Id, "parent-device-id": agent.deviceID})
+	logger.Debugw("childDeviceLost", log.Fields{"child-device-id": device.Id, "parent-device-ud": agent.deviceID})
 
 	//Remove the associated peer ports on the parent device
 	parentDevice := agent.getDeviceWithoutLock()
@@ -1756,6 +1756,6 @@
 	if err := ptypes.UnmarshalAny(rpcResponse.Reply, testResp); err != nil {
 		return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
 	}
-	log.Debugw("Omci_test_Request-Success-device-agent", log.Fields{"testResp": testResp})
+	logger.Debugw("Omci_test_Request-Success-device-agent", log.Fields{"testResp": testResp})
 	return testResp, nil
 }
diff --git a/rw_core/core/device_agent_test.go b/rw_core/core/device_agent_test.go
index 85fc09e..4f1506f 100755
--- a/rw_core/core/device_agent_test.go
+++ b/rw_core/core/device_agent_test.go
@@ -21,7 +21,6 @@
 	"github.com/opencord/voltha-go/rw_core/config"
 	com "github.com/opencord/voltha-lib-go/v3/pkg/adapters/common"
 	"github.com/opencord/voltha-lib-go/v3/pkg/kafka"
-	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	lm "github.com/opencord/voltha-lib-go/v3/pkg/mocks"
 	ofp "github.com/opencord/voltha-protos/v3/go/openflow_13"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
@@ -55,7 +54,7 @@
 	var err error
 	test.etcdServer, test.kvClientPort, err = startEmbeddedEtcdServer("voltha.rwcore.da.test", "voltha.rwcore.da.etcd", "error")
 	if err != nil {
-		log.Fatal(err)
+		logger.Fatal(err)
 	}
 	// Create the kafka client
 	test.kClient = lm.NewKafkaClient()
@@ -106,7 +105,7 @@
 	cfg.InCompetingMode = inCompeteMode
 	grpcPort, err := freeport.GetFreePort()
 	if err != nil {
-		log.Fatal("Cannot get a freeport for grpc")
+		logger.Fatal("Cannot get a freeport for grpc")
 	}
 	cfg.GrpcPort = grpcPort
 	cfg.GrpcHost = "127.0.0.1"
@@ -115,7 +114,7 @@
 	dat.core = NewCore(context.Background(), dat.coreInstanceID, cfg, client, dat.kClient)
 	err = dat.core.Start(context.Background())
 	if err != nil {
-		log.Fatal("Cannot start core")
+		logger.Fatal("Cannot start core")
 	}
 }
 
diff --git a/rw_core/core/device_manager.go b/rw_core/core/device_manager.go
index be23f5e..e8b79a6 100755
--- a/rw_core/core/device_manager.go
+++ b/rw_core/core/device_manager.go
@@ -72,18 +72,18 @@
 }
 
 func (dMgr *DeviceManager) start(ctx context.Context, logicalDeviceMgr *LogicalDeviceManager) {
-	log.Info("starting-device-manager")
+	logger.Info("starting-device-manager")
 	dMgr.logicalDeviceMgr = logicalDeviceMgr
 	dMgr.stateTransitions = NewTransitionMap(dMgr)
 	probe.UpdateStatusFromContext(ctx, "device-manager", probe.ServiceStatusRunning)
-	log.Info("device-manager-started")
+	logger.Info("device-manager-started")
 }
 
 func (dMgr *DeviceManager) stop(ctx context.Context) {
-	log.Info("stopping-device-manager")
+	logger.Info("stopping-device-manager")
 	dMgr.exitChannel <- 1
 	probe.UpdateStatusFromContext(ctx, "device-manager", probe.ServiceStatusStopped)
-	log.Info("device-manager-stopped")
+	logger.Info("device-manager-stopped")
 }
 
 func sendResponse(ctx context.Context, ch chan interface{}, result interface{}) {
@@ -91,10 +91,10 @@
 		// Returned response only of the ctx has not been cancelled/timeout/etc
 		// Channel is automatically closed when a context is Done
 		ch <- result
-		log.Debugw("sendResponse", log.Fields{"result": result})
+		logger.Debugw("sendResponse", log.Fields{"result": result})
 	} else {
 		// Should the transaction be reverted back?
-		log.Debugw("sendResponse-context-error", log.Fields{"context-error": ctx.Err()})
+		logger.Debugw("sendResponse-context-error", log.Fields{"context-error": ctx.Err()})
 	}
 }
 
@@ -132,13 +132,13 @@
 		go func() {
 			_, err = dMgr.core.deviceOwnership.OwnedByMe(ctx, &utils.DeviceID{ID: deviceID})
 			if err != nil {
-				log.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
+				logger.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
 			}
 		}()
 		return agent.(*DeviceAgent)
 	}
 	//TODO: Change the return params to return an error as well
-	log.Errorw("loading-device-failed", log.Fields{"deviceId": deviceID, "error": err})
+	logger.Errorw("loading-device-failed", log.Fields{"deviceId": deviceID, "error": err})
 	return nil
 }
 
@@ -157,16 +157,16 @@
 func (dMgr *DeviceManager) createDevice(ctx context.Context, device *voltha.Device, ch chan interface{}) {
 	deviceExist, err := dMgr.isParentDeviceExist(ctx, device)
 	if err != nil {
-		log.Errorf("Failed to fetch parent device info")
+		logger.Errorf("Failed to fetch parent device info")
 		sendResponse(ctx, ch, err)
 		return
 	}
 	if deviceExist {
-		log.Errorf("Device is Pre-provisioned already with same IP-Port or MAC Address")
+		logger.Errorf("Device is Pre-provisioned already with same IP-Port or MAC Address")
 		sendResponse(ctx, ch, errors.New("Device is already pre-provisioned"))
 		return
 	}
-	log.Debugw("createDevice", log.Fields{"device": device, "aproxy": dMgr.adapterProxy})
+	logger.Debugw("createDevice", log.Fields{"device": device, "aproxy": dMgr.adapterProxy})
 
 	// Ensure this device is set as root
 	device.Root = true
@@ -174,7 +174,7 @@
 	agent := newDeviceAgent(dMgr.adapterProxy, device, dMgr, dMgr.clusterDataProxy, dMgr.defaultTimeout)
 	device, err = agent.start(ctx, device)
 	if err != nil {
-		log.Errorw("Fail-to-start-device", log.Fields{"device-id": agent.deviceID, "error": err})
+		logger.Errorw("Fail-to-start-device", log.Fields{"device-id": agent.deviceID, "error": err})
 		sendResponse(ctx, ch, err)
 		return
 	}
@@ -184,11 +184,11 @@
 }
 
 func (dMgr *DeviceManager) enableDevice(ctx context.Context, id *voltha.ID, ch chan interface{}) {
-	log.Debugw("enableDevice", log.Fields{"deviceid": id})
+	logger.Debugw("enableDevice", log.Fields{"deviceid": id})
 	var res interface{}
 	if agent := dMgr.getDeviceAgent(ctx, id.Id); agent != nil {
 		res = agent.enableDevice(ctx)
-		log.Debugw("EnableDevice-result", log.Fields{"result": res})
+		logger.Debugw("EnableDevice-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id.Id)
 	}
@@ -197,11 +197,11 @@
 }
 
 func (dMgr *DeviceManager) disableDevice(ctx context.Context, id *voltha.ID, ch chan interface{}) {
-	log.Debugw("disableDevice", log.Fields{"deviceid": id})
+	logger.Debugw("disableDevice", log.Fields{"deviceid": id})
 	var res interface{}
 	if agent := dMgr.getDeviceAgent(ctx, id.Id); agent != nil {
 		res = agent.disableDevice(ctx)
-		log.Debugw("disableDevice-result", log.Fields{"result": res})
+		logger.Debugw("disableDevice-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id.Id)
 	}
@@ -210,11 +210,11 @@
 }
 
 func (dMgr *DeviceManager) rebootDevice(ctx context.Context, id *voltha.ID, ch chan interface{}) {
-	log.Debugw("rebootDevice", log.Fields{"deviceid": id})
+	logger.Debugw("rebootDevice", log.Fields{"deviceid": id})
 	var res interface{}
 	if agent := dMgr.getDeviceAgent(ctx, id.Id); agent != nil {
 		res = agent.rebootDevice(ctx)
-		log.Debugw("rebootDevice-result", log.Fields{"result": res})
+		logger.Debugw("rebootDevice-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id.Id)
 	}
@@ -222,11 +222,11 @@
 }
 
 func (dMgr *DeviceManager) deleteDevice(ctx context.Context, id *voltha.ID, ch chan interface{}) {
-	log.Debugw("deleteDevice", log.Fields{"deviceid": id})
+	logger.Debugw("deleteDevice", log.Fields{"deviceid": id})
 	var res interface{}
 	if agent := dMgr.getDeviceAgent(ctx, id.Id); agent != nil {
 		res = agent.deleteDevice(ctx)
-		log.Debugw("deleteDevice-result", log.Fields{"result": res})
+		logger.Debugw("deleteDevice-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id.Id)
 	}
@@ -237,7 +237,7 @@
 // This function is called only in the Core that does not own this device.  In the Core that owns this device then a
 // deletion deletion also includes removal of any reference of this device.
 func (dMgr *DeviceManager) stopManagingDevice(ctx context.Context, id string) {
-	log.Infow("stopManagingDevice", log.Fields{"deviceId": id})
+	logger.Infow("stopManagingDevice", log.Fields{"deviceId": id})
 	if dMgr.IsDeviceInCache(id) { // Proceed only if an agent is present for this device
 		if root, _ := dMgr.IsRootDevice(id); root {
 			// stop managing the logical device
@@ -245,20 +245,20 @@
 			if ldeviceID != "" { // Can happen if logical device agent was already stopped
 				err := dMgr.core.deviceOwnership.AbandonDevice(ldeviceID)
 				if err != nil {
-					log.Errorw("unable-to-abandon-the-device", log.Fields{"error": err})
+					logger.Errorw("unable-to-abandon-the-device", log.Fields{"error": err})
 				}
 			}
 			// We do not need to stop the child devices as this is taken care by the state machine.
 		}
 		if agent := dMgr.getDeviceAgent(ctx, id); agent != nil {
 			if err := agent.stop(ctx); err != nil {
-				log.Warnw("unable-to-stop-device-agent", log.Fields{"device-id": agent.deviceID, "error": err})
+				logger.Warnw("unable-to-stop-device-agent", log.Fields{"device-id": agent.deviceID, "error": err})
 			}
 			dMgr.deleteDeviceAgentFromMap(agent)
 			// Abandon the device ownership
 			err := dMgr.core.deviceOwnership.AbandonDevice(id)
 			if err != nil {
-				log.Warnw("unable-to-abandon-device", log.Fields{"error": err})
+				logger.Warnw("unable-to-abandon-device", log.Fields{"error": err})
 			}
 		}
 	}
@@ -266,14 +266,14 @@
 
 // RunPostDeviceDelete removes any reference of this device
 func (dMgr *DeviceManager) RunPostDeviceDelete(ctx context.Context, cDevice *voltha.Device, pDevice *voltha.Device) error {
-	log.Infow("RunPostDeviceDelete", log.Fields{"deviceId": cDevice.Id})
+	logger.Infow("RunPostDeviceDelete", log.Fields{"deviceId": cDevice.Id})
 	dMgr.stopManagingDevice(ctx, cDevice.Id)
 	return nil
 }
 
 // GetDevice will returns a device, either from memory or from the dB, if present
 func (dMgr *DeviceManager) GetDevice(ctx context.Context, id string) (*voltha.Device, error) {
-	log.Debugw("GetDevice", log.Fields{"deviceid": id})
+	logger.Debugw("GetDevice", log.Fields{"deviceid": id})
 	if agent := dMgr.getDeviceAgent(ctx, id); agent != nil {
 		return agent.getDevice(ctx)
 	}
@@ -282,7 +282,7 @@
 
 // GetChildDevice will return a device, either from memory or from the dB, if present
 func (dMgr *DeviceManager) GetChildDevice(ctx context.Context, parentDeviceID string, serialNumber string, onuID int64, parentPortNo int64) (*voltha.Device, error) {
-	log.Debugw("GetChildDevice", log.Fields{"parentDeviceid": parentDeviceID, "serialNumber": serialNumber,
+	logger.Debugw("GetChildDevice", log.Fields{"parentDeviceid": parentDeviceID, "serialNumber": serialNumber,
 		"parentPortNo": parentPortNo, "onuId": onuID})
 
 	var parentDevice *voltha.Device
@@ -295,7 +295,7 @@
 		return nil, status.Errorf(codes.Aborted, "%s", err.Error())
 	}
 	if len(childDeviceIds) == 0 {
-		log.Debugw("no-child-devices", log.Fields{"parentDeviceId": parentDevice.Id, "serialNumber": serialNumber, "onuId": onuID})
+		logger.Debugw("no-child-devices", log.Fields{"parentDeviceId": parentDevice.Id, "serialNumber": serialNumber, "onuId": onuID})
 		return nil, status.Errorf(codes.NotFound, "%s", parentDeviceID)
 	}
 
@@ -307,14 +307,14 @@
 			foundOnuID := false
 			if searchDevice.ProxyAddress.OnuId == uint32(onuID) {
 				if searchDevice.ParentPortNo == uint32(parentPortNo) {
-					log.Debugw("found-child-by-onuid", log.Fields{"parentDeviceId": parentDevice.Id, "onuId": onuID})
+					logger.Debugw("found-child-by-onuid", log.Fields{"parentDeviceId": parentDevice.Id, "onuId": onuID})
 					foundOnuID = true
 				}
 			}
 
 			foundSerialNumber := false
 			if searchDevice.SerialNumber == serialNumber {
-				log.Debugw("found-child-by-serialnumber", log.Fields{"parentDeviceId": parentDevice.Id, "serialNumber": serialNumber})
+				logger.Debugw("found-child-by-serialnumber", log.Fields{"parentDeviceId": parentDevice.Id, "serialNumber": serialNumber})
 				foundSerialNumber = true
 			}
 
@@ -334,18 +334,18 @@
 	}
 
 	if foundChildDevice != nil {
-		log.Debugw("child-device-found", log.Fields{"parentDeviceId": parentDevice.Id, "foundChildDevice": foundChildDevice})
+		logger.Debugw("child-device-found", log.Fields{"parentDeviceId": parentDevice.Id, "foundChildDevice": foundChildDevice})
 		return foundChildDevice, nil
 	}
 
-	log.Warnw("child-device-not-found", log.Fields{"parentDeviceId": parentDevice.Id,
+	logger.Warnw("child-device-not-found", log.Fields{"parentDeviceId": parentDevice.Id,
 		"serialNumber": serialNumber, "onuId": onuID, "parentPortNo": parentPortNo})
 	return nil, status.Errorf(codes.NotFound, "%s", parentDeviceID)
 }
 
 // GetChildDeviceWithProxyAddress will return a device based on proxy address
 func (dMgr *DeviceManager) GetChildDeviceWithProxyAddress(ctx context.Context, proxyAddress *voltha.Device_ProxyAddress) (*voltha.Device, error) {
-	log.Debugw("GetChildDeviceWithProxyAddress", log.Fields{"proxyAddress": proxyAddress})
+	logger.Debugw("GetChildDeviceWithProxyAddress", log.Fields{"proxyAddress": proxyAddress})
 
 	var parentDevice *voltha.Device
 	var err error
@@ -357,7 +357,7 @@
 		return nil, status.Errorf(codes.Aborted, "%s", err.Error())
 	}
 	if len(childDeviceIds) == 0 {
-		log.Debugw("no-child-devices", log.Fields{"parentDeviceId": parentDevice.Id})
+		logger.Debugw("no-child-devices", log.Fields{"parentDeviceId": parentDevice.Id})
 		return nil, status.Errorf(codes.NotFound, "%s", proxyAddress)
 	}
 
@@ -372,11 +372,11 @@
 	}
 
 	if foundChildDevice != nil {
-		log.Debugw("child-device-found", log.Fields{"proxyAddress": proxyAddress})
+		logger.Debugw("child-device-found", log.Fields{"proxyAddress": proxyAddress})
 		return foundChildDevice, nil
 	}
 
-	log.Warnw("child-device-not-found", log.Fields{"proxyAddress": proxyAddress})
+	logger.Warnw("child-device-not-found", log.Fields{"proxyAddress": proxyAddress})
 	return nil, status.Errorf(codes.NotFound, "%s", proxyAddress)
 }
 
@@ -398,11 +398,11 @@
 
 // ListDevices retrieves the latest devices from the data model
 func (dMgr *DeviceManager) ListDevices(ctx context.Context) (*voltha.Devices, error) {
-	log.Debug("ListDevices")
+	logger.Debug("ListDevices")
 	result := &voltha.Devices{}
 	devices, err := dMgr.clusterDataProxy.List(ctx, "/devices", 0, false, "")
 	if err != nil {
-		log.Errorw("failed-to-list-devices-from-cluster-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-list-devices-from-cluster-proxy", log.Fields{"error": err})
 		return nil, err
 	}
 	if devices != nil {
@@ -410,10 +410,10 @@
 			device := d.(*voltha.Device)
 			// If device is not in memory then set it up
 			if !dMgr.IsDeviceInCache(device.Id) {
-				log.Debugw("loading-device-from-Model", log.Fields{"id": device.Id})
+				logger.Debugw("loading-device-from-Model", log.Fields{"id": device.Id})
 				agent := newDeviceAgent(dMgr.adapterProxy, device, dMgr, dMgr.clusterDataProxy, dMgr.defaultTimeout)
 				if _, err := agent.start(ctx, nil); err != nil {
-					log.Warnw("failure-starting-agent", log.Fields{"deviceId": device.Id})
+					logger.Warnw("failure-starting-agent", log.Fields{"deviceId": device.Id})
 				} else {
 					dMgr.addDeviceAgentToMap(agent)
 				}
@@ -421,7 +421,7 @@
 			result.Items = append(result.Items, device)
 		}
 	}
-	log.Debugw("ListDevices-end", log.Fields{"len": len(result.Items)})
+	logger.Debugw("ListDevices-end", log.Fields{"len": len(result.Items)})
 	return result, nil
 }
 
@@ -430,7 +430,7 @@
 	hostPort := newDevice.GetHostAndPort()
 	devices, err := dMgr.clusterDataProxy.List(ctx, "/devices", 0, false, "")
 	if err != nil {
-		log.Errorw("Failed to list devices from cluster data proxy", log.Fields{"error": err})
+		logger.Errorw("Failed to list devices from cluster data proxy", log.Fields{"error": err})
 		return false, err
 	}
 	if devices != nil {
@@ -453,7 +453,7 @@
 func (dMgr *DeviceManager) getDeviceFromModel(ctx context.Context, deviceID string) (*voltha.Device, error) {
 	device, err := dMgr.clusterDataProxy.Get(ctx, "/devices/"+deviceID, 0, false, "")
 	if err != nil {
-		log.Errorw("failed-to-get-device-info-from-cluster-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-get-device-info-from-cluster-proxy", log.Fields{"error": err})
 		return nil, err
 	}
 	if device != nil {
@@ -478,15 +478,15 @@
 			dMgr.devicesLoadingLock.Unlock()
 			// Proceed with the loading only if the device exist in the Model (could have been deleted)
 			if device, err = dMgr.getDeviceFromModel(ctx, deviceID); err == nil {
-				log.Debugw("loading-device", log.Fields{"deviceId": deviceID})
+				logger.Debugw("loading-device", log.Fields{"deviceId": deviceID})
 				agent := newDeviceAgent(dMgr.adapterProxy, device, dMgr, dMgr.clusterDataProxy, dMgr.defaultTimeout)
 				if _, err = agent.start(ctx, nil); err != nil {
-					log.Warnw("Failure loading device", log.Fields{"deviceId": deviceID, "error": err})
+					logger.Warnw("Failure loading device", log.Fields{"deviceId": deviceID, "error": err})
 				} else {
 					dMgr.addDeviceAgentToMap(agent)
 				}
 			} else {
-				log.Debugw("Device not in model", log.Fields{"deviceId": deviceID})
+				logger.Debugw("Device not in model", log.Fields{"deviceId": deviceID})
 			}
 			// announce completion of task to any number of waiting channels
 			dMgr.devicesLoadingLock.Lock()
@@ -515,28 +515,28 @@
 
 // loadRootDeviceParentAndChildren loads the children and parents of a root device in memory
 func (dMgr *DeviceManager) loadRootDeviceParentAndChildren(ctx context.Context, device *voltha.Device) error {
-	log.Debugw("loading-parent-and-children", log.Fields{"deviceId": device.Id})
+	logger.Debugw("loading-parent-and-children", log.Fields{"deviceId": device.Id})
 	if device.Root {
 		// Scenario A
 		if device.ParentId != "" {
 			//	 Load logical device if needed.
 			if err := dMgr.logicalDeviceMgr.load(ctx, device.ParentId); err != nil {
-				log.Warnw("failure-loading-logical-device", log.Fields{"lDeviceId": device.ParentId})
+				logger.Warnw("failure-loading-logical-device", log.Fields{"lDeviceId": device.ParentId})
 			}
 		} else {
-			log.Debugw("no-parent-to-load", log.Fields{"deviceId": device.Id})
+			logger.Debugw("no-parent-to-load", log.Fields{"deviceId": device.Id})
 		}
 		//	Load all child devices, if needed
 		if childDeviceIds, err := dMgr.getAllChildDeviceIds(device); err == nil {
 			for _, childDeviceID := range childDeviceIds {
 				if _, err := dMgr.loadDevice(ctx, childDeviceID); err != nil {
-					log.Warnw("failure-loading-device", log.Fields{"deviceId": childDeviceID, "error": err})
+					logger.Warnw("failure-loading-device", log.Fields{"deviceId": childDeviceID, "error": err})
 					return err
 				}
 			}
-			log.Debugw("loaded-children", log.Fields{"deviceId": device.Id, "numChildren": len(childDeviceIds)})
+			logger.Debugw("loaded-children", log.Fields{"deviceId": device.Id, "numChildren": len(childDeviceIds)})
 		} else {
-			log.Debugw("no-child-to-load", log.Fields{"deviceId": device.Id})
+			logger.Debugw("no-child-to-load", log.Fields{"deviceId": device.Id})
 		}
 	}
 	return nil
@@ -547,7 +547,7 @@
 // acting on the device is received by the core. In such a scenario, the Core will load the device in memory first
 // and the proceed with the request.
 func (dMgr *DeviceManager) load(ctx context.Context, deviceID string) error {
-	log.Debug("load...")
+	logger.Debug("load...")
 	// First load the device - this may fail in case the device was deleted intentionally by the other core
 	var dAgent *DeviceAgent
 	var err error
@@ -569,10 +569,10 @@
 	if device.Root {
 		// Load all children as well as the parent of this device (logical_device)
 		if err := dMgr.loadRootDeviceParentAndChildren(ctx, device); err != nil {
-			log.Warnw("failure-loading-device-parent-and-children", log.Fields{"deviceId": deviceID})
+			logger.Warnw("failure-loading-device-parent-and-children", log.Fields{"deviceId": deviceID})
 			return err
 		}
-		log.Debugw("successfully-loaded-parent-and-children", log.Fields{"deviceId": deviceID})
+		logger.Debugw("successfully-loaded-parent-and-children", log.Fields{"deviceId": deviceID})
 	} else {
 		//	Scenario B - use the parentId of that device (root device) to trigger the loading
 		if device.ParentId != "" {
@@ -584,7 +584,7 @@
 
 // ListDeviceIds retrieves the latest device IDs information from the data model (memory data only)
 func (dMgr *DeviceManager) ListDeviceIds() (*voltha.IDs, error) {
-	log.Debug("ListDeviceIDs")
+	logger.Debug("ListDeviceIDs")
 	// Report only device IDs that are in the device agent map
 	return dMgr.listDeviceIdsFromMap(), nil
 }
@@ -592,7 +592,7 @@
 //ReconcileDevices is a request to a voltha core to update its list of managed devices.  This will
 //trigger loading the devices along with their children and parent in memory
 func (dMgr *DeviceManager) ReconcileDevices(ctx context.Context, ids *voltha.IDs, ch chan interface{}) {
-	log.Debugw("ReconcileDevices", log.Fields{"numDevices": len(ids.Items)})
+	logger.Debugw("ReconcileDevices", log.Fields{"numDevices": len(ids.Items)})
 	var res interface{}
 	if ids != nil && len(ids.Items) != 0 {
 		toReconcile := len(ids.Items)
@@ -600,7 +600,7 @@
 		var err error
 		for _, id := range ids.Items {
 			if err = dMgr.load(ctx, id.Id); err != nil {
-				log.Warnw("failure-reconciling-device", log.Fields{"deviceId": id.Id, "error": err})
+				logger.Warnw("failure-reconciling-device", log.Fields{"deviceId": id.Id, "error": err})
 			} else {
 				reconciled++
 			}
@@ -624,12 +624,12 @@
 
 // adapterRestarted is invoked whenever an adapter is restarted
 func (dMgr *DeviceManager) adapterRestarted(ctx context.Context, adapter *voltha.Adapter) error {
-	log.Debugw("adapter-restarted", log.Fields{"adapter": adapter.Id})
+	logger.Debugw("adapter-restarted", log.Fields{"adapter": adapter.Id})
 
 	// Let's reconcile the device managed by this Core only
 	rootDeviceIds := dMgr.core.deviceOwnership.GetAllDeviceIdsOwnedByMe()
 	if len(rootDeviceIds) == 0 {
-		log.Debugw("nothing-to-reconcile", log.Fields{"adapterId": adapter.Id})
+		logger.Debugw("nothing-to-reconcile", log.Fields{"adapterId": adapter.Id})
 		return nil
 	}
 
@@ -638,10 +638,10 @@
 		if rootDevice, _ := dMgr.getDeviceFromModel(ctx, rootDeviceID); rootDevice != nil {
 			if rootDevice.Adapter == adapter.Id {
 				if isOkToReconcile(rootDevice) {
-					log.Debugw("reconciling-root-device", log.Fields{"rootId": rootDevice.Id})
+					logger.Debugw("reconciling-root-device", log.Fields{"rootId": rootDevice.Id})
 					responses = append(responses, dMgr.sendReconcileDeviceRequest(ctx, rootDevice))
 				} else {
-					log.Debugw("not-reconciling-root-device", log.Fields{"rootId": rootDevice.Id, "state": rootDevice.AdminState})
+					logger.Debugw("not-reconciling-root-device", log.Fields{"rootId": rootDevice.Id, "state": rootDevice.AdminState})
 				}
 			} else { // Should we be reconciling the root's children instead?
 			childManagedByAdapter:
@@ -650,10 +650,10 @@
 						if childDevice, _ := dMgr.getDeviceFromModel(ctx, peer.DeviceId); childDevice != nil {
 							if childDevice.Adapter == adapter.Id {
 								if isOkToReconcile(childDevice) {
-									log.Debugw("reconciling-child-device", log.Fields{"childId": childDevice.Id})
+									logger.Debugw("reconciling-child-device", log.Fields{"childId": childDevice.Id})
 									responses = append(responses, dMgr.sendReconcileDeviceRequest(ctx, childDevice))
 								} else {
-									log.Debugw("not-reconciling-child-device", log.Fields{"childId": childDevice.Id, "state": childDevice.AdminState})
+									logger.Debugw("not-reconciling-child-device", log.Fields{"childId": childDevice.Id, "state": childDevice.AdminState})
 								}
 							} else {
 								// All child devices under a parent device are typically managed by the same adapter type.
@@ -672,7 +672,7 @@
 			return status.Errorf(codes.Aborted, "errors-%s", res)
 		}
 	} else {
-		log.Debugw("no-managed-device-to-reconcile", log.Fields{"adapterId": adapter.Id})
+		logger.Debugw("no-managed-device-to-reconcile", log.Fields{"adapterId": adapter.Id})
 	}
 	return nil
 }
@@ -719,7 +719,7 @@
 }
 
 func (dMgr *DeviceManager) updateDeviceUsingAdapterData(ctx context.Context, device *voltha.Device) error {
-	log.Debugw("updateDeviceUsingAdapterData", log.Fields{"deviceid": device.Id, "device": device})
+	logger.Debugw("updateDeviceUsingAdapterData", log.Fields{"deviceid": device.Id, "device": device})
 	if agent := dMgr.getDeviceAgent(ctx, device.Id); agent != nil {
 		return agent.updateDeviceUsingAdapterData(ctx, device)
 	}
@@ -737,7 +737,7 @@
 		for _, peerPort := range port.Peers {
 			if agent := dMgr.getDeviceAgent(ctx, peerPort.DeviceId); agent != nil {
 				if err := agent.addPeerPort(ctx, meAsPeer); err != nil {
-					log.Errorw("failed-to-add-peer", log.Fields{"peer-device-id": peerPort.DeviceId})
+					logger.Errorw("failed-to-add-peer", log.Fields{"peer-device-id": peerPort.DeviceId})
 					return err
 				}
 			}
@@ -749,11 +749,11 @@
 			go func() {
 				err = dMgr.logicalDeviceMgr.updateLogicalPort(context.Background(), device, port)
 				if err != nil {
-					log.Errorw("unable-to-update-logical-port", log.Fields{"error": err})
+					logger.Errorw("unable-to-update-logical-port", log.Fields{"error": err})
 				}
 			}()
 		} else {
-			log.Errorw("failed-to-retrieve-device", log.Fields{"deviceId": deviceID})
+			logger.Errorw("failed-to-retrieve-device", log.Fields{"deviceId": deviceID})
 			return err
 		}
 		return nil
@@ -762,7 +762,7 @@
 }
 
 func (dMgr *DeviceManager) addFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("addFlowsAndGroups", log.Fields{"deviceid": deviceID, "groups:": groups, "flowMetadata": flowMetadata})
+	logger.Debugw("addFlowsAndGroups", log.Fields{"deviceid": deviceID, "groups:": groups, "flowMetadata": flowMetadata})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.addFlowsAndGroups(ctx, flows, groups, flowMetadata)
 	}
@@ -770,7 +770,7 @@
 }
 
 func (dMgr *DeviceManager) deleteFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("deleteFlowsAndGroups", log.Fields{"deviceid": deviceID})
+	logger.Debugw("deleteFlowsAndGroups", log.Fields{"deviceid": deviceID})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.deleteFlowsAndGroups(ctx, flows, groups, flowMetadata)
 	}
@@ -778,7 +778,7 @@
 }
 
 func (dMgr *DeviceManager) updateFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("updateFlowsAndGroups", log.Fields{"deviceid": deviceID})
+	logger.Debugw("updateFlowsAndGroups", log.Fields{"deviceid": deviceID})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.updateFlowsAndGroups(ctx, flows, groups, flowMetadata)
 	}
@@ -818,7 +818,7 @@
 }
 
 func (dMgr *DeviceManager) getSwitchCapability(ctx context.Context, deviceID string) (*ic.SwitchCapability, error) {
-	log.Debugw("getSwitchCapability", log.Fields{"deviceid": deviceID})
+	logger.Debugw("getSwitchCapability", log.Fields{"deviceid": deviceID})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.getSwitchCapability(ctx)
 	}
@@ -826,7 +826,7 @@
 }
 
 func (dMgr *DeviceManager) getPorts(ctx context.Context, deviceID string, portType voltha.Port_PortType) (*voltha.Ports, error) {
-	log.Debugw("getPorts", log.Fields{"deviceid": deviceID, "portType": portType})
+	logger.Debugw("getPorts", log.Fields{"deviceid": deviceID, "portType": portType})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.getPorts(ctx, portType), nil
 	}
@@ -834,7 +834,7 @@
 }
 
 func (dMgr *DeviceManager) getPortCapability(ctx context.Context, deviceID string, portNo uint32) (*ic.PortCapability, error) {
-	log.Debugw("getPortCapability", log.Fields{"deviceid": deviceID})
+	logger.Debugw("getPortCapability", log.Fields{"deviceid": deviceID})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.getPortCapability(ctx, portNo)
 	}
@@ -842,7 +842,7 @@
 }
 
 func (dMgr *DeviceManager) updateDeviceStatus(ctx context.Context, deviceID string, operStatus voltha.OperStatus_Types, connStatus voltha.ConnectStatus_Types) error {
-	log.Debugw("updateDeviceStatus", log.Fields{"deviceid": deviceID, "operStatus": operStatus, "connStatus": connStatus})
+	logger.Debugw("updateDeviceStatus", log.Fields{"deviceid": deviceID, "operStatus": operStatus, "connStatus": connStatus})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.updateDeviceStatus(ctx, operStatus, connStatus)
 	}
@@ -850,7 +850,7 @@
 }
 
 func (dMgr *DeviceManager) updateChildrenStatus(ctx context.Context, deviceID string, operStatus voltha.OperStatus_Types, connStatus voltha.ConnectStatus_Types) error {
-	log.Debugw("updateChildrenStatus", log.Fields{"parentDeviceid": deviceID, "operStatus": operStatus, "connStatus": connStatus})
+	logger.Debugw("updateChildrenStatus", log.Fields{"parentDeviceid": deviceID, "operStatus": operStatus, "connStatus": connStatus})
 	var parentDevice *voltha.Device
 	var err error
 	if parentDevice, err = dMgr.GetDevice(ctx, deviceID); err != nil {
@@ -861,7 +861,7 @@
 		return status.Errorf(codes.Aborted, "%s", err.Error())
 	}
 	if len(childDeviceIds) == 0 {
-		log.Debugw("no-child-device", log.Fields{"parentDeviceId": parentDevice.Id})
+		logger.Debugw("no-child-device", log.Fields{"parentDeviceId": parentDevice.Id})
 	}
 	for _, childDeviceID := range childDeviceIds {
 		if agent := dMgr.getDeviceAgent(ctx, childDeviceID); agent != nil {
@@ -874,10 +874,10 @@
 }
 
 func (dMgr *DeviceManager) updatePortState(ctx context.Context, deviceID string, portType voltha.Port_PortType, portNo uint32, operStatus voltha.OperStatus_Types) error {
-	log.Debugw("updatePortState", log.Fields{"deviceid": deviceID, "portType": portType, "portNo": portNo, "operStatus": operStatus})
+	logger.Debugw("updatePortState", log.Fields{"deviceid": deviceID, "portType": portType, "portNo": portNo, "operStatus": operStatus})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		if err := agent.updatePortState(ctx, portType, portNo, operStatus); err != nil {
-			log.Errorw("updating-port-state-failed", log.Fields{"deviceid": deviceID, "portNo": portNo, "error": err})
+			logger.Errorw("updating-port-state-failed", log.Fields{"deviceid": deviceID, "portNo": portNo, "error": err})
 			return err
 		}
 		// Notify the logical device manager to change the port state
@@ -892,7 +892,7 @@
 					// it as a warning and not an error because it
 					// doesn't stop or modify processing.
 					// TODO: VOL-2707
-					log.Warnw("unable-to-update-logical-port-state", log.Fields{"error": err})
+					logger.Warnw("unable-to-update-logical-port-state", log.Fields{"error": err})
 				}
 			}()
 		}
@@ -902,7 +902,7 @@
 }
 
 func (dMgr *DeviceManager) deleteAllPorts(ctx context.Context, deviceID string) error {
-	log.Debugw("DeleteAllPorts", log.Fields{"deviceid": deviceID})
+	logger.Debugw("DeleteAllPorts", log.Fields{"deviceid": deviceID})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		if err := agent.deleteAllPorts(ctx); err != nil {
 			return err
@@ -914,11 +914,11 @@
 			go func() {
 				err = dMgr.logicalDeviceMgr.deleteAllLogicalPorts(ctx, device)
 				if err != nil {
-					log.Errorw("unable-to-delete-logical-ports", log.Fields{"error": err})
+					logger.Errorw("unable-to-delete-logical-ports", log.Fields{"error": err})
 				}
 			}()
 		} else {
-			log.Warnw("failed-to-retrieve-device", log.Fields{"deviceId": deviceID})
+			logger.Warnw("failed-to-retrieve-device", log.Fields{"deviceId": deviceID})
 			return err
 		}
 		return nil
@@ -928,18 +928,18 @@
 
 //updatePortsState updates all ports on the device
 func (dMgr *DeviceManager) updatePortsState(ctx context.Context, deviceID string, state voltha.OperStatus_Types) error {
-	log.Debugw("updatePortsState", log.Fields{"deviceid": deviceID})
+	logger.Debugw("updatePortsState", log.Fields{"deviceid": deviceID})
 
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		switch state {
 		case voltha.OperStatus_ACTIVE:
 			if err := agent.updatePortsOperState(ctx, state); err != nil {
-				log.Warnw("updatePortsOperState-failed", log.Fields{"deviceId": deviceID, "error": err})
+				logger.Warnw("updatePortsOperState-failed", log.Fields{"deviceId": deviceID, "error": err})
 				return err
 			}
 		case voltha.OperStatus_UNKNOWN:
 			if err := agent.updatePortsOperState(ctx, state); err != nil {
-				log.Warnw("updatePortsOperState-failed", log.Fields{"deviceId": deviceID, "error": err})
+				logger.Warnw("updatePortsOperState-failed", log.Fields{"deviceId": deviceID, "error": err})
 				return err
 			}
 		default:
@@ -948,11 +948,11 @@
 		// Notify the logical device about the state change
 		device, err := dMgr.GetDevice(ctx, deviceID)
 		if err != nil {
-			log.Warnw("non-existent-device", log.Fields{"deviceId": deviceID, "error": err})
+			logger.Warnw("non-existent-device", log.Fields{"deviceId": deviceID, "error": err})
 			return err
 		}
 		if err := dMgr.logicalDeviceMgr.updatePortsState(ctx, device, state); err != nil {
-			log.Warnw("failed-updating-ports-state", log.Fields{"deviceId": deviceID, "error": err})
+			logger.Warnw("failed-updating-ports-state", log.Fields{"deviceId": deviceID, "error": err})
 			return err
 		}
 		return nil
@@ -962,13 +962,13 @@
 
 func (dMgr *DeviceManager) childDeviceDetected(ctx context.Context, parentDeviceID string, parentPortNo int64, deviceType string,
 	channelID int64, vendorID string, serialNumber string, onuID int64) (*voltha.Device, error) {
-	log.Debugw("childDeviceDetected", log.Fields{"parentDeviceId": parentDeviceID, "parentPortNo": parentPortNo, "deviceType": deviceType, "channelId": channelID, "vendorId": vendorID, "serialNumber": serialNumber, "onuId": onuID})
+	logger.Debugw("childDeviceDetected", log.Fields{"parentDeviceId": parentDeviceID, "parentPortNo": parentPortNo, "deviceType": deviceType, "channelId": channelID, "vendorId": vendorID, "serialNumber": serialNumber, "onuId": onuID})
 
 	if deviceType == "" && vendorID != "" {
-		log.Debug("device-type-is-nil-fetching-device-type")
+		logger.Debug("device-type-is-nil-fetching-device-type")
 		deviceTypesIf, err := dMgr.adapterMgr.clusterDataProxy.List(ctx, "/device_types", 0, false, "")
 		if err != nil {
-			log.Errorw("failed-to-get-device-type-info", log.Fields{"error": err})
+			logger.Errorw("failed-to-get-device-type-info", log.Fields{"error": err})
 			return nil, err
 		}
 		if deviceTypesIf != nil {
@@ -987,7 +987,7 @@
 	}
 	//if no match found for the vendorid,report adapter with the custom error message
 	if deviceType == "" {
-		log.Errorw("failed-to-fetch-adapter-name ", log.Fields{"vendorId": vendorID})
+		logger.Errorw("failed-to-fetch-adapter-name ", log.Fields{"vendorId": vendorID})
 		return nil, status.Errorf(codes.NotFound, "%s", vendorID)
 	}
 
@@ -1010,7 +1010,7 @@
 	}
 
 	if device, err := dMgr.GetChildDevice(ctx, parentDeviceID, serialNumber, onuID, parentPortNo); err == nil {
-		log.Warnw("child-device-exists", log.Fields{"parentId": parentDeviceID, "serialNumber": serialNumber})
+		logger.Warnw("child-device-exists", log.Fields{"parentId": parentDeviceID, "serialNumber": serialNumber})
 		return device, status.Errorf(codes.AlreadyExists, "%s", serialNumber)
 	}
 
@@ -1020,7 +1020,7 @@
 	agent := newDeviceAgent(dMgr.adapterProxy, childDevice, dMgr, dMgr.clusterDataProxy, dMgr.defaultTimeout)
 	childDevice, err := agent.start(ctx, childDevice)
 	if err != nil {
-		log.Errorw("error-starting-child-device", log.Fields{"parent-device-id": childDevice.ParentId, "child-device-id": agent.deviceID, "error": err})
+		logger.Errorw("error-starting-child-device", log.Fields{"parent-device-id": childDevice.ParentId, "child-device-id": agent.deviceID, "error": err})
 		return nil, err
 	}
 	dMgr.addDeviceAgentToMap(agent)
@@ -1029,7 +1029,7 @@
 	// ownership of this device to this Core
 	_, err = dMgr.core.deviceOwnership.OwnedByMe(ctx, &utils.DeviceID{ID: agent.deviceID})
 	if err != nil {
-		log.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
+		logger.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
 	}
 
 	// Activate the child device
@@ -1037,7 +1037,7 @@
 		go func() {
 			err := agent.enableDevice(context.Background())
 			if err != nil {
-				log.Errorw("unable-to-enable-device", log.Fields{"error": err})
+				logger.Errorw("unable-to-enable-device", log.Fields{"error": err})
 			}
 		}()
 	}
@@ -1046,7 +1046,7 @@
 	go func() {
 		err := dMgr.kafkaICProxy.DeviceDiscovered(agent.deviceID, deviceType, parentDeviceID, dMgr.coreInstanceID)
 		if err != nil {
-			log.Errorw("unable-to-discover-the-device", log.Fields{"error": err})
+			logger.Errorw("unable-to-discover-the-device", log.Fields{"error": err})
 		}
 	}()
 
@@ -1057,14 +1057,14 @@
 	// This will be triggered on every update to the device.
 	handlers := dMgr.stateTransitions.GetTransitionHandler(previous, current)
 	if handlers == nil {
-		log.Debugw("no-op-transition", log.Fields{"deviceId": current.Id})
+		logger.Debugw("no-op-transition", log.Fields{"deviceId": current.Id})
 		return nil
 	}
-	log.Debugw("handler-found", log.Fields{"num-expectedHandlers": len(handlers), "isParent": current.Root, "current-data": current})
+	logger.Debugw("handler-found", log.Fields{"num-expectedHandlers": len(handlers), "isParent": current.Root, "current-data": current})
 	for _, handler := range handlers {
-		log.Debugw("running-handler", log.Fields{"handler": funcName(handler)})
+		logger.Debugw("running-handler", log.Fields{"handler": funcName(handler)})
 		if err := handler(ctx, current, previous); err != nil {
-			log.Warnw("handler-failed", log.Fields{"handler": funcName(handler), "error": err})
+			logger.Warnw("handler-failed", log.Fields{"handler": funcName(handler), "error": err})
 			return err
 		}
 	}
@@ -1072,7 +1072,7 @@
 }
 
 func (dMgr *DeviceManager) packetOut(ctx context.Context, deviceID string, outPort uint32, packet *ofp.OfpPacketOut) error {
-	log.Debugw("packetOut", log.Fields{"deviceId": deviceID, "outPort": outPort})
+	logger.Debugw("packetOut", log.Fields{"deviceId": deviceID, "outPort": outPort})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.packetOut(ctx, outPort, packet)
 	}
@@ -1081,16 +1081,16 @@
 
 // PacketIn receives packet from adapter
 func (dMgr *DeviceManager) PacketIn(ctx context.Context, deviceID string, port uint32, transactionID string, packet []byte) error {
-	log.Debugw("PacketIn", log.Fields{"deviceId": deviceID, "port": port})
+	logger.Debugw("PacketIn", log.Fields{"deviceId": deviceID, "port": port})
 	// Get the logical device Id based on the deviceId
 	var device *voltha.Device
 	var err error
 	if device, err = dMgr.GetDevice(ctx, deviceID); err != nil {
-		log.Errorw("device-not-found", log.Fields{"deviceId": deviceID})
+		logger.Errorw("device-not-found", log.Fields{"deviceId": deviceID})
 		return err
 	}
 	if !device.Root {
-		log.Errorw("device-not-root", log.Fields{"deviceId": deviceID})
+		logger.Errorw("device-not-root", log.Fields{"deviceId": deviceID})
 		return status.Errorf(codes.FailedPrecondition, "%s", deviceID)
 	}
 
@@ -1101,7 +1101,7 @@
 }
 
 func (dMgr *DeviceManager) setParentID(ctx context.Context, device *voltha.Device, parentID string) error {
-	log.Debugw("setParentId", log.Fields{"deviceId": device.Id, "parentId": parentID})
+	logger.Debugw("setParentId", log.Fields{"deviceId": device.Id, "parentId": parentID})
 	if agent := dMgr.getDeviceAgent(ctx, device.Id); agent != nil {
 		return agent.setParentID(ctx, device, parentID)
 	}
@@ -1110,15 +1110,15 @@
 
 // CreateLogicalDevice creates logical device in core
 func (dMgr *DeviceManager) CreateLogicalDevice(ctx context.Context, cDevice *voltha.Device, pDevice *voltha.Device) error {
-	log.Info("CreateLogicalDevice")
+	logger.Info("CreateLogicalDevice")
 	// Verify whether the logical device has already been created
 	if cDevice.ParentId != "" {
-		log.Debugw("Parent device already exist.", log.Fields{"deviceId": cDevice.Id, "logicalDeviceId": cDevice.Id})
+		logger.Debugw("Parent device already exist.", log.Fields{"deviceId": cDevice.Id, "logicalDeviceId": cDevice.Id})
 		return nil
 	}
 	var err error
 	if _, err = dMgr.logicalDeviceMgr.createLogicalDevice(ctx, cDevice); err != nil {
-		log.Warnw("createlogical-device-error", log.Fields{"device": cDevice})
+		logger.Warnw("createlogical-device-error", log.Fields{"device": cDevice})
 		return err
 	}
 	return nil
@@ -1126,10 +1126,10 @@
 
 // DeleteLogicalDevice deletes logical device from core
 func (dMgr *DeviceManager) DeleteLogicalDevice(ctx context.Context, cDevice *voltha.Device, pDevice *voltha.Device) error {
-	log.Info("DeleteLogicalDevice")
+	logger.Info("DeleteLogicalDevice")
 	var err error
 	if err = dMgr.logicalDeviceMgr.deleteLogicalDevice(ctx, cDevice); err != nil {
-		log.Warnw("deleteLogical-device-error", log.Fields{"deviceId": cDevice.Id})
+		logger.Warnw("deleteLogical-device-error", log.Fields{"deviceId": cDevice.Id})
 		return err
 	}
 	// Remove the logical device Id from the parent device
@@ -1140,16 +1140,16 @@
 
 // DeleteLogicalPort removes the logical port associated with a device
 func (dMgr *DeviceManager) DeleteLogicalPort(ctx context.Context, device *voltha.Device) error {
-	log.Info("deleteLogicalPort")
+	logger.Info("deleteLogicalPort")
 	var err error
 	// Get the logical port associated with this device
 	var lPortID *voltha.LogicalPortId
 	if lPortID, err = dMgr.logicalDeviceMgr.getLogicalPortID(ctx, device); err != nil {
-		log.Warnw("getLogical-port-error", log.Fields{"deviceId": device.Id, "error": err})
+		logger.Warnw("getLogical-port-error", log.Fields{"deviceId": device.Id, "error": err})
 		return err
 	}
 	if err = dMgr.logicalDeviceMgr.deleteLogicalPort(ctx, lPortID); err != nil {
-		log.Warnw("deleteLogical-port-error", log.Fields{"deviceId": device.Id})
+		logger.Warnw("deleteLogical-port-error", log.Fields{"deviceId": device.Id})
 		return err
 	}
 	return nil
@@ -1157,10 +1157,10 @@
 
 // DeleteLogicalPorts removes the logical ports associated with that deviceId
 func (dMgr *DeviceManager) DeleteLogicalPorts(ctx context.Context, cDevice *voltha.Device, pDevice *voltha.Device) error {
-	log.Debugw("delete-all-logical-ports", log.Fields{"device-id": cDevice.Id})
+	logger.Debugw("delete-all-logical-ports", log.Fields{"device-id": cDevice.Id})
 	if err := dMgr.logicalDeviceMgr.deleteLogicalPorts(ctx, cDevice.Id); err != nil {
 		// Just log the error.   The logical device or port may already have been deleted before this callback is invoked.
-		log.Warnw("deleteLogical-ports-error", log.Fields{"device-id": cDevice.Id, "error": err})
+		logger.Warnw("deleteLogical-ports-error", log.Fields{"device-id": cDevice.Id, "error": err})
 	}
 	return nil
 }
@@ -1178,11 +1178,11 @@
 //childDevicesLost is invoked by an adapter to indicate that a parent device is in a state (Disabled) where it
 //cannot manage the child devices.  This will trigger the Core to disable all the child devices.
 func (dMgr *DeviceManager) childDevicesLost(ctx context.Context, parentDeviceID string) error {
-	log.Debug("childDevicesLost")
+	logger.Debug("childDevicesLost")
 	var err error
 	var parentDevice *voltha.Device
 	if parentDevice, err = dMgr.GetDevice(ctx, parentDeviceID); err != nil {
-		log.Warnw("failed-getting-device", log.Fields{"deviceId": parentDeviceID, "error": err})
+		logger.Warnw("failed-getting-device", log.Fields{"deviceId": parentDeviceID, "error": err})
 		return err
 	}
 	return dMgr.DisableAllChildDevices(ctx, parentDevice, nil)
@@ -1191,13 +1191,13 @@
 //childDevicesDetected is invoked by an adapter when child devices are found, typically after after a
 // disable/enable sequence.  This will trigger the Core to Enable all the child devices of that parent.
 func (dMgr *DeviceManager) childDevicesDetected(ctx context.Context, parentDeviceID string) error {
-	log.Debug("childDevicesDetected")
+	logger.Debug("childDevicesDetected")
 	var err error
 	var parentDevice *voltha.Device
 	var childDeviceIds []string
 
 	if parentDevice, err = dMgr.GetDevice(ctx, parentDeviceID); err != nil {
-		log.Warnw("failed-getting-device", log.Fields{"deviceId": parentDeviceID, "error": err})
+		logger.Warnw("failed-getting-device", log.Fields{"deviceId": parentDeviceID, "error": err})
 		return err
 	}
 
@@ -1205,7 +1205,7 @@
 		return status.Errorf(codes.NotFound, "%s", parentDevice.Id)
 	}
 	if len(childDeviceIds) == 0 {
-		log.Debugw("no-child-device", log.Fields{"parentDeviceId": parentDevice.Id})
+		logger.Debugw("no-child-device", log.Fields{"parentDeviceId": parentDevice.Id})
 	}
 	allChildEnableRequestSent := true
 	for _, childDeviceID := range childDeviceIds {
@@ -1214,12 +1214,12 @@
 			go func() {
 				err = agent.enableDevice(ctx)
 				if err != nil {
-					log.Errorw("unable-to-enable-device", log.Fields{"error": err})
+					logger.Errorw("unable-to-enable-device", log.Fields{"error": err})
 				}
 			}()
 		} else {
 			err = status.Errorf(codes.Unavailable, "no agent for child device %s", childDeviceID)
-			log.Errorw("no-child-device-agent", log.Fields{"parentDeviceId": parentDevice.Id, "childId": childDeviceID})
+			logger.Errorw("no-child-device-agent", log.Fields{"parentDeviceId": parentDevice.Id, "childId": childDeviceID})
 			allChildEnableRequestSent = false
 		}
 	}
@@ -1236,20 +1236,20 @@
 
 //DisableAllChildDevices is invoked as a callback when the parent device is disabled
 func (dMgr *DeviceManager) DisableAllChildDevices(ctx context.Context, parentCurrDevice *voltha.Device, parentPrevDevice *voltha.Device) error {
-	log.Debug("DisableAllChildDevices")
+	logger.Debug("DisableAllChildDevices")
 	var childDeviceIds []string
 	var err error
 	if childDeviceIds, err = dMgr.getAllChildDeviceIds(parentCurrDevice); err != nil {
 		return status.Errorf(codes.NotFound, "%s", parentCurrDevice.Id)
 	}
 	if len(childDeviceIds) == 0 {
-		log.Debugw("no-child-device", log.Fields{"parentDeviceId": parentCurrDevice.Id})
+		logger.Debugw("no-child-device", log.Fields{"parentDeviceId": parentCurrDevice.Id})
 	}
 	for _, childDeviceID := range childDeviceIds {
 		if agent := dMgr.getDeviceAgent(ctx, childDeviceID); agent != nil {
 			if err = agent.disableDevice(ctx); err != nil {
 				// Just log the error - this error happens only if the child device was already in deleted state.
-				log.Errorw("failure-disable-device", log.Fields{"deviceId": childDeviceID, "error": err.Error()})
+				logger.Errorw("failure-disable-device", log.Fields{"deviceId": childDeviceID, "error": err.Error()})
 			}
 		}
 	}
@@ -1258,19 +1258,19 @@
 
 //DeleteAllChildDevices is invoked as a callback when the parent device is deleted
 func (dMgr *DeviceManager) DeleteAllChildDevices(ctx context.Context, parentCurrDevice *voltha.Device, parentPrevDevice *voltha.Device) error {
-	log.Debug("DeleteAllChildDevices")
+	logger.Debug("DeleteAllChildDevices")
 	var childDeviceIds []string
 	var err error
 	if childDeviceIds, err = dMgr.getAllChildDeviceIds(parentCurrDevice); err != nil {
 		return status.Errorf(codes.NotFound, "%s", parentCurrDevice.Id)
 	}
 	if len(childDeviceIds) == 0 {
-		log.Debugw("no-child-device", log.Fields{"parentDeviceId": parentCurrDevice.Id})
+		logger.Debugw("no-child-device", log.Fields{"parentDeviceId": parentCurrDevice.Id})
 	}
 	for _, childDeviceID := range childDeviceIds {
 		if agent := dMgr.getDeviceAgent(ctx, childDeviceID); agent != nil {
 			if err = agent.deleteDevice(ctx); err != nil {
-				log.Warnw("failure-delete-device", log.Fields{"deviceId": childDeviceID, "error": err.Error()})
+				logger.Warnw("failure-delete-device", log.Fields{"deviceId": childDeviceID, "error": err.Error()})
 			}
 			// No further action is required here.  The deleteDevice will change the device state where the resulting
 			// callback will take care of cleaning the child device agent.
@@ -1281,30 +1281,30 @@
 
 //DeleteAllUNILogicalPorts is invoked as a callback when the parent device is deleted
 func (dMgr *DeviceManager) DeleteAllUNILogicalPorts(ctx context.Context, curr *voltha.Device, prev *voltha.Device) error {
-	log.Debugw("delete-all-uni-logical-ports", log.Fields{"parent-device-id": curr.Id})
+	logger.Debugw("delete-all-uni-logical-ports", log.Fields{"parent-device-id": curr.Id})
 	if err := dMgr.logicalDeviceMgr.deleteAllUNILogicalPorts(ctx, curr); err != nil {
 		// Just log the error and let the remaining pipeline proceed - ports may already have been deleted
-		log.Warnw("delete-all-uni-logical-ports-failed", log.Fields{"parent-device-id": curr.Id, "error": err})
+		logger.Warnw("delete-all-uni-logical-ports-failed", log.Fields{"parent-device-id": curr.Id, "error": err})
 	}
 	return nil
 }
 
 //DeleteAllLogicalPorts is invoked as a callback when the parent device's connection status moves to UNREACHABLE
 func (dMgr *DeviceManager) DeleteAllLogicalPorts(ctx context.Context, parentDevice *voltha.Device, prev *voltha.Device) error {
-	log.Debugw("delete-all-logical-ports", log.Fields{"parent-device-id": parentDevice.Id})
+	logger.Debugw("delete-all-logical-ports", log.Fields{"parent-device-id": parentDevice.Id})
 	if err := dMgr.logicalDeviceMgr.deleteAllLogicalPorts(ctx, parentDevice); err != nil {
 		// Just log error as logical device may already have been deleted
-		log.Warnw("delete-all-logical-ports-fail", log.Fields{"parent-device-id": parentDevice.Id, "error": err})
+		logger.Warnw("delete-all-logical-ports-fail", log.Fields{"parent-device-id": parentDevice.Id, "error": err})
 	}
 	return nil
 }
 
 //DeleteAllDeviceFlows is invoked as a callback when the parent device's connection status moves to UNREACHABLE
 func (dMgr *DeviceManager) DeleteAllDeviceFlows(ctx context.Context, parentDevice *voltha.Device, prev *voltha.Device) error {
-	log.Debugw("delete-all-device-flows", log.Fields{"parent-device-id": parentDevice.Id})
+	logger.Debugw("delete-all-device-flows", log.Fields{"parent-device-id": parentDevice.Id})
 	if agent := dMgr.getDeviceAgent(ctx, parentDevice.Id); agent != nil {
 		if err := agent.deleteAllFlows(ctx); err != nil {
-			log.Errorw("error-deleting-all-device-flows", log.Fields{"parent-device-id": parentDevice.Id})
+			logger.Errorw("error-deleting-all-device-flows", log.Fields{"parent-device-id": parentDevice.Id})
 			return err
 		}
 		return nil
@@ -1314,7 +1314,7 @@
 
 //getAllChildDeviceIds is a helper method to get all the child device IDs from the device passed as parameter
 func (dMgr *DeviceManager) getAllChildDeviceIds(parentDevice *voltha.Device) ([]string, error) {
-	log.Debugw("getAllChildDeviceIds", log.Fields{"parentDeviceId": parentDevice.Id})
+	logger.Debugw("getAllChildDeviceIds", log.Fields{"parentDeviceId": parentDevice.Id})
 	childDeviceIds := make([]string, 0)
 	if parentDevice != nil {
 		for _, port := range parentDevice.Ports {
@@ -1322,14 +1322,14 @@
 				childDeviceIds = append(childDeviceIds, peer.DeviceId)
 			}
 		}
-		log.Debugw("returning-getAllChildDeviceIds", log.Fields{"parentDeviceId": parentDevice.Id, "childDeviceIds": childDeviceIds})
+		logger.Debugw("returning-getAllChildDeviceIds", log.Fields{"parentDeviceId": parentDevice.Id, "childDeviceIds": childDeviceIds})
 	}
 	return childDeviceIds, nil
 }
 
 //getAllChildDevices is a helper method to get all the child device IDs from the device passed as parameter
 func (dMgr *DeviceManager) getAllChildDevices(ctx context.Context, parentDeviceID string) (*voltha.Devices, error) {
-	log.Debugw("getAllChildDevices", log.Fields{"parentDeviceId": parentDeviceID})
+	logger.Debugw("getAllChildDevices", log.Fields{"parentDeviceId": parentDeviceID})
 	if parentDevice, err := dMgr.GetDevice(ctx, parentDeviceID); err == nil {
 		childDevices := make([]*voltha.Device, 0)
 		if childDeviceIds, er := dMgr.getAllChildDeviceIds(parentDevice); er == nil {
@@ -1346,21 +1346,21 @@
 
 // SetupUNILogicalPorts creates UNI ports on the logical device that represents a child UNI interface
 func (dMgr *DeviceManager) SetupUNILogicalPorts(ctx context.Context, cDevice *voltha.Device, pDevice *voltha.Device) error {
-	log.Info("addUNILogicalPort")
+	logger.Info("addUNILogicalPort")
 	if err := dMgr.logicalDeviceMgr.setupUNILogicalPorts(ctx, cDevice); err != nil {
-		log.Warnw("addUNILogicalPort-error", log.Fields{"device": cDevice, "err": err})
+		logger.Warnw("addUNILogicalPort-error", log.Fields{"device": cDevice, "err": err})
 		return err
 	}
 	return nil
 }
 
 func (dMgr *DeviceManager) downloadImage(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
-	log.Debugw("downloadImage", log.Fields{"deviceid": img.Id, "imageName": img.Name})
+	logger.Debugw("downloadImage", log.Fields{"deviceid": img.Id, "imageName": img.Name})
 	var res interface{}
 	var err error
 	if agent := dMgr.getDeviceAgent(ctx, img.Id); agent != nil {
 		if res, err = agent.downloadImage(ctx, img); err != nil {
-			log.Debugw("downloadImage-failed", log.Fields{"err": err, "imageName": img.Name})
+			logger.Debugw("downloadImage-failed", log.Fields{"err": err, "imageName": img.Name})
 			res = err
 		}
 	} else {
@@ -1370,12 +1370,12 @@
 }
 
 func (dMgr *DeviceManager) cancelImageDownload(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
-	log.Debugw("cancelImageDownload", log.Fields{"deviceid": img.Id, "imageName": img.Name})
+	logger.Debugw("cancelImageDownload", log.Fields{"deviceid": img.Id, "imageName": img.Name})
 	var res interface{}
 	var err error
 	if agent := dMgr.getDeviceAgent(ctx, img.Id); agent != nil {
 		if res, err = agent.cancelImageDownload(ctx, img); err != nil {
-			log.Debugw("cancelImageDownload-failed", log.Fields{"err": err, "imageName": img.Name})
+			logger.Debugw("cancelImageDownload-failed", log.Fields{"err": err, "imageName": img.Name})
 			res = err
 		}
 	} else {
@@ -1385,12 +1385,12 @@
 }
 
 func (dMgr *DeviceManager) activateImage(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
-	log.Debugw("activateImage", log.Fields{"deviceid": img.Id, "imageName": img.Name})
+	logger.Debugw("activateImage", log.Fields{"deviceid": img.Id, "imageName": img.Name})
 	var res interface{}
 	var err error
 	if agent := dMgr.getDeviceAgent(ctx, img.Id); agent != nil {
 		if res, err = agent.activateImage(ctx, img); err != nil {
-			log.Debugw("activateImage-failed", log.Fields{"err": err, "imageName": img.Name})
+			logger.Debugw("activateImage-failed", log.Fields{"err": err, "imageName": img.Name})
 			res = err
 		}
 	} else {
@@ -1400,12 +1400,12 @@
 }
 
 func (dMgr *DeviceManager) revertImage(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
-	log.Debugw("revertImage", log.Fields{"deviceid": img.Id, "imageName": img.Name})
+	logger.Debugw("revertImage", log.Fields{"deviceid": img.Id, "imageName": img.Name})
 	var res interface{}
 	var err error
 	if agent := dMgr.getDeviceAgent(ctx, img.Id); agent != nil {
 		if res, err = agent.revertImage(ctx, img); err != nil {
-			log.Debugw("revertImage-failed", log.Fields{"err": err, "imageName": img.Name})
+			logger.Debugw("revertImage-failed", log.Fields{"err": err, "imageName": img.Name})
 			res = err
 		}
 	} else {
@@ -1415,12 +1415,12 @@
 }
 
 func (dMgr *DeviceManager) getImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
-	log.Debugw("getImageDownloadStatus", log.Fields{"deviceid": img.Id, "imageName": img.Name})
+	logger.Debugw("getImageDownloadStatus", log.Fields{"deviceid": img.Id, "imageName": img.Name})
 	var res interface{}
 	var err error
 	if agent := dMgr.getDeviceAgent(ctx, img.Id); agent != nil {
 		if res, err = agent.getImageDownloadStatus(ctx, img); err != nil {
-			log.Debugw("getImageDownloadStatus-failed", log.Fields{"err": err, "imageName": img.Name})
+			logger.Debugw("getImageDownloadStatus-failed", log.Fields{"err": err, "imageName": img.Name})
 			res = err
 		}
 	} else {
@@ -1430,10 +1430,10 @@
 }
 
 func (dMgr *DeviceManager) updateImageDownload(ctx context.Context, deviceID string, img *voltha.ImageDownload) error {
-	log.Debugw("updateImageDownload", log.Fields{"deviceid": img.Id, "imageName": img.Name})
+	logger.Debugw("updateImageDownload", log.Fields{"deviceid": img.Id, "imageName": img.Name})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		if err := agent.updateImageDownload(ctx, img); err != nil {
-			log.Debugw("updateImageDownload-failed", log.Fields{"err": err, "imageName": img.Name})
+			logger.Debugw("updateImageDownload-failed", log.Fields{"err": err, "imageName": img.Name})
 			return err
 		}
 	} else {
@@ -1443,7 +1443,7 @@
 }
 
 func (dMgr *DeviceManager) getImageDownload(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	log.Debugw("getImageDownload", log.Fields{"deviceid": img.Id, "imageName": img.Name})
+	logger.Debugw("getImageDownload", log.Fields{"deviceid": img.Id, "imageName": img.Name})
 	if agent := dMgr.getDeviceAgent(ctx, img.Id); agent != nil {
 		return agent.getImageDownload(ctx, img)
 	}
@@ -1451,7 +1451,7 @@
 }
 
 func (dMgr *DeviceManager) listImageDownloads(ctx context.Context, deviceID string) (*voltha.ImageDownloads, error) {
-	log.Debugw("listImageDownloads", log.Fields{"deviceID": deviceID})
+	logger.Debugw("listImageDownloads", log.Fields{"deviceID": deviceID})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.listImageDownloads(ctx, deviceID)
 	}
@@ -1459,7 +1459,7 @@
 }
 
 func (dMgr *DeviceManager) NotifyInvalidTransition(ctx context.Context, cDevice *voltha.Device, pDevice *voltha.Device) error {
-	log.Errorw("NotifyInvalidTransition", log.Fields{
+	logger.Errorw("NotifyInvalidTransition", log.Fields{
 		"device":           cDevice.Id,
 		"prev-admin-state": pDevice.AdminState,
 		"prev-oper-state":  pDevice.OperStatus,
@@ -1488,27 +1488,27 @@
 // GetParentDeviceID returns parent device id, either from memory or from the dB, if present
 func (dMgr *DeviceManager) GetParentDeviceID(ctx context.Context, deviceID string) string {
 	if device, _ := dMgr.GetDevice(ctx, deviceID); device != nil {
-		log.Infow("GetParentDeviceId", log.Fields{"deviceId": device.Id, "parentId": device.ParentId})
+		logger.Infow("GetParentDeviceId", log.Fields{"deviceId": device.Id, "parentId": device.ParentId})
 		return device.ParentId
 	}
 	return ""
 }
 
 func (dMgr *DeviceManager) simulateAlarm(ctx context.Context, simulatereq *voltha.SimulateAlarmRequest, ch chan interface{}) {
-	log.Debugw("simulateAlarm", log.Fields{"id": simulatereq.Id, "Indicator": simulatereq.Indicator, "IntfId": simulatereq.IntfId,
+	logger.Debugw("simulateAlarm", log.Fields{"id": simulatereq.Id, "Indicator": simulatereq.Indicator, "IntfId": simulatereq.IntfId,
 		"PortTypeName": simulatereq.PortTypeName, "OnuDeviceId": simulatereq.OnuDeviceId, "InverseBitErrorRate": simulatereq.InverseBitErrorRate,
 		"Drift": simulatereq.Drift, "NewEqd": simulatereq.NewEqd, "OnuSerialNumber": simulatereq.OnuSerialNumber, "Operation": simulatereq.Operation})
 	var res interface{}
 	if agent := dMgr.getDeviceAgent(ctx, simulatereq.Id); agent != nil {
 		res = agent.simulateAlarm(ctx, simulatereq)
-		log.Debugw("simulateAlarm-result", log.Fields{"result": res})
+		logger.Debugw("simulateAlarm-result", log.Fields{"result": res})
 	}
 	//TODO CLI always get successful response
 	sendResponse(ctx, ch, res)
 }
 
 func (dMgr *DeviceManager) updateDeviceReason(ctx context.Context, deviceID string, reason string) error {
-	log.Debugw("updateDeviceReason", log.Fields{"deviceid": deviceID, "reason": reason})
+	logger.Debugw("updateDeviceReason", log.Fields{"deviceid": deviceID, "reason": reason})
 	if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
 		return agent.updateDeviceReason(ctx, reason)
 	}
@@ -1516,11 +1516,11 @@
 }
 
 func (dMgr *DeviceManager) enablePort(ctx context.Context, port *voltha.Port, ch chan interface{}) {
-	log.Debugw("enablePort", log.Fields{"device-id": port.DeviceId, "port-no": port.PortNo})
+	logger.Debugw("enablePort", log.Fields{"device-id": port.DeviceId, "port-no": port.PortNo})
 	var res interface{}
 	if agent := dMgr.getDeviceAgent(ctx, port.DeviceId); agent != nil {
 		res = agent.enablePort(ctx, port)
-		log.Debugw("enablePort-result", log.Fields{"result": res})
+		logger.Debugw("enablePort-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", port.DeviceId)
 	}
@@ -1529,11 +1529,11 @@
 }
 
 func (dMgr *DeviceManager) disablePort(ctx context.Context, port *voltha.Port, ch chan interface{}) {
-	log.Debugw("disablePort", log.Fields{"device-id": port.DeviceId, "port-no": port.PortNo})
+	logger.Debugw("disablePort", log.Fields{"device-id": port.DeviceId, "port-no": port.PortNo})
 	var res interface{}
 	if agent := dMgr.getDeviceAgent(ctx, port.DeviceId); agent != nil {
 		res = agent.disablePort(ctx, port)
-		log.Debugw("disablePort-result", log.Fields{"result": res})
+		logger.Debugw("disablePort-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", port.DeviceId)
 	}
@@ -1543,11 +1543,11 @@
 
 // childDeviceLost  calls parent adapter to delete child device and all its references
 func (dMgr *DeviceManager) ChildDeviceLost(ctx context.Context, curr *voltha.Device, prev *voltha.Device) error {
-	log.Debugw("childDeviceLost", log.Fields{"child-device-id": curr.Id, "parent-device-id": curr.ParentId})
+	logger.Debugw("childDeviceLost", log.Fields{"child-device-id": curr.Id, "parent-device-id": curr.ParentId})
 	if parentAgent := dMgr.getDeviceAgent(ctx, curr.ParentId); parentAgent != nil {
 		if err := parentAgent.ChildDeviceLost(ctx, curr); err != nil {
 			// Just log the message and let the remaining pipeline proceed.
-			log.Warnw("childDeviceLost", log.Fields{"child-device-id": curr.Id, "parent-device-id": curr.ParentId, "error": err})
+			logger.Warnw("childDeviceLost", log.Fields{"child-device-id": curr.Id, "parent-device-id": curr.ParentId, "error": err})
 		}
 	}
 	// Do not return an error as parent device may also have been deleted.  Let the remaining pipeline proceed.
@@ -1555,13 +1555,13 @@
 }
 
 func (dMgr *DeviceManager) startOmciTest(ctx context.Context, omcitestrequest *voltha.OmciTestRequest) (*voltha.TestResponse, error) {
-	log.Debugw("Omci_test_Request", log.Fields{"device-id": omcitestrequest.Id, "uuid": omcitestrequest.Uuid})
+	logger.Debugw("Omci_test_Request", log.Fields{"device-id": omcitestrequest.Id, "uuid": omcitestrequest.Uuid})
 	if agent := dMgr.getDeviceAgent(ctx, omcitestrequest.Id); agent != nil {
 		res, err := agent.startOmciTest(ctx, omcitestrequest)
 		if err != nil {
 			return nil, err
 		}
-		log.Debugw("Omci_test_Response_result-device-magnager", log.Fields{"result": res})
+		logger.Debugw("Omci_test_Response_result-device-magnager", log.Fields{"result": res})
 		return res, nil
 	}
 	return nil, status.Errorf(codes.NotFound, "%s", omcitestrequest.Id)
diff --git a/rw_core/core/device_ownership.go b/rw_core/core/device_ownership.go
index 171b91f..2389c78 100644
--- a/rw_core/core/device_ownership.go
+++ b/rw_core/core/device_ownership.go
@@ -30,13 +30,6 @@
 	"google.golang.org/grpc/status"
 )
 
-func init() {
-	_, err := log.AddPackage(log.JSON, log.WarnLevel, nil)
-	if err != nil {
-		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
-	}
-}
-
 type ownership struct {
 	id    string
 	owned bool
@@ -79,17 +72,17 @@
 
 // Start starts device device ownership
 func (da *DeviceOwnership) Start(ctx context.Context) {
-	log.Info("starting-deviceOwnership", log.Fields{"instanceId": da.instanceID})
-	log.Info("deviceOwnership-started")
+	logger.Info("starting-deviceOwnership", log.Fields{"instanceId": da.instanceID})
+	logger.Info("deviceOwnership-started")
 }
 
 // Stop stops device ownership
 func (da *DeviceOwnership) Stop(ctx context.Context) {
-	log.Info("stopping-deviceOwnership")
+	logger.Info("stopping-deviceOwnership")
 	da.exitChannel <- 1
 	// Need to flush all device reservations
 	da.abandonAllDevices()
-	log.Info("deviceOwnership-stopped")
+	logger.Info("deviceOwnership-stopped")
 }
 
 func (da *DeviceOwnership) tryToReserveKey(ctx context.Context, id string) bool {
@@ -98,11 +91,11 @@
 	kvKey := fmt.Sprintf("%s_%s", da.ownershipPrefix, id)
 	value, err := da.kvClient.Reserve(ctx, kvKey, da.instanceID, da.reservationTimeout)
 	if err != nil {
-		log.Errorw("error", log.Fields{"error": err, "id": id, "instanceId": da.instanceID})
+		logger.Errorw("error", log.Fields{"error": err, "id": id, "instanceId": da.instanceID})
 	}
 	if value != nil {
 		if currOwner, err = kvstore.ToString(value); err != nil {
-			log.Error("unexpected-owner-type")
+			logger.Error("unexpected-owner-type")
 		}
 		return currOwner == da.instanceID
 	}
@@ -113,30 +106,30 @@
 	// Try to reserve the key
 	kvKey := fmt.Sprintf("%s_%s", da.ownershipPrefix, id)
 	if err := da.kvClient.RenewReservation(ctx, kvKey); err != nil {
-		log.Errorw("reservation-renewal-error", log.Fields{"error": err, "instance": da.instanceID})
+		logger.Errorw("reservation-renewal-error", log.Fields{"error": err, "instance": da.instanceID})
 		return false
 	}
 	return true
 }
 
 func (da *DeviceOwnership) monitorOwnership(ctx context.Context, id string, chnl chan int) {
-	log.Debugw("start-device-monitoring", log.Fields{"id": id})
+	logger.Debugw("start-device-monitoring", log.Fields{"id": id})
 	op := "starting"
 	exit := false
 	ticker := time.NewTicker(time.Duration(da.reservationTimeout) / 3 * time.Second)
 	for {
 		select {
 		case <-da.exitChannel:
-			log.Debugw("closing-monitoring", log.Fields{"Id": id})
+			logger.Debugw("closing-monitoring", log.Fields{"Id": id})
 			exit = true
 		case <-ticker.C:
-			log.Debugw(fmt.Sprintf("%s-reservation", op), log.Fields{"Id": id})
+			logger.Debugw(fmt.Sprintf("%s-reservation", op), log.Fields{"Id": id})
 		case <-chnl:
-			log.Debugw("closing-device-monitoring", log.Fields{"Id": id})
+			logger.Debugw("closing-device-monitoring", log.Fields{"Id": id})
 			exit = true
 		}
 		if exit {
-			log.Infow("exiting-device-monitoring", log.Fields{"Id": id})
+			logger.Infow("exiting-device-monitoring", log.Fields{"Id": id})
 			ticker.Stop()
 			break
 		}
@@ -145,19 +138,19 @@
 			// Device owned; renew reservation
 			op = "renew"
 			if da.renewReservation(ctx, id) {
-				log.Debugw("reservation-renewed", log.Fields{"id": id, "instanceId": da.instanceID})
+				logger.Debugw("reservation-renewed", log.Fields{"id": id, "instanceId": da.instanceID})
 			} else {
-				log.Debugw("reservation-not-renewed", log.Fields{"id": id, "instanceId": da.instanceID})
+				logger.Debugw("reservation-not-renewed", log.Fields{"id": id, "instanceId": da.instanceID})
 			}
 		} else {
 			// Device not owned or not owned by me; try to seize ownership
 			op = "retry"
 			if err := da.setOwnership(id, da.tryToReserveKey(ctx, id)); err != nil {
-				log.Errorw("unexpected-error", log.Fields{"error": err})
+				logger.Errorw("unexpected-error", log.Fields{"error": err})
 			}
 		}
 	}
-	log.Debugw("device-monitoring-stopped", log.Fields{"id": id})
+	logger.Debugw("device-monitoring-stopped", log.Fields{"id": id})
 }
 
 func (da *DeviceOwnership) getOwnership(id string) (bool, bool) {
@@ -174,7 +167,7 @@
 	defer da.deviceMapLock.Unlock()
 	if _, exist := da.deviceMap[id]; exist {
 		if da.deviceMap[id].owned != owner {
-			log.Debugw("ownership-changed", log.Fields{"Id": id, "owner": owner})
+			logger.Debugw("ownership-changed", log.Fields{"Id": id, "owner": owner})
 		}
 		da.deviceMap[id].owned = owner
 		return nil
@@ -204,7 +197,7 @@
 	var idStr string
 	var cache bool
 	if ownershipKey, idStr, cache, err = da.getOwnershipKey(ctx, id); err != nil {
-		log.Warnw("no-ownershipkey", log.Fields{"error": err})
+		logger.Warnw("no-ownershipkey", log.Fields{"error": err})
 		return false, err
 	}
 
@@ -223,7 +216,7 @@
 
 	deviceOwned, ownedByMe := da.getOwnership(ownershipKey)
 	if deviceOwned {
-		log.Debugw("ownership", log.Fields{"Id": ownershipKey, "owned": ownedByMe})
+		logger.Debugw("ownership", log.Fields{"Id": ownershipKey, "owned": ownedByMe})
 		return ownedByMe, nil
 	}
 	// Not owned by me or maybe nobody else.  Try to reserve it
@@ -237,7 +230,7 @@
 		chnl:  myChnl}
 	da.deviceMapLock.Unlock()
 
-	log.Debugw("set-new-ownership", log.Fields{"Id": ownershipKey, "owned": reservedByMe})
+	logger.Debugw("set-new-ownership", log.Fields{"Id": ownershipKey, "owned": reservedByMe})
 	go da.monitorOwnership(context.Background(), ownershipKey, myChnl)
 	return reservedByMe, nil
 }
@@ -265,7 +258,7 @@
 		// Stop the Go routine monitoring the device
 		close(o.chnl)
 		delete(da.deviceMap, id)
-		log.Debugw("abandoning-device", log.Fields{"Id": id})
+		logger.Debugw("abandoning-device", log.Fields{"Id": id})
 		return nil
 	}
 	// id is not ownership key
diff --git a/rw_core/core/device_state_transitions.go b/rw_core/core/device_state_transitions.go
index 610b3aa..3bf01ec 100644
--- a/rw_core/core/device_state_transitions.go
+++ b/rw_core/core/device_state_transitions.go
@@ -19,7 +19,6 @@
 import (
 	"context"
 	"github.com/opencord/voltha-go/rw_core/coreif"
-	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
 )
 
@@ -296,13 +295,13 @@
 		return nil
 	}
 
-	//log.Infow("DeviceType", log.Fields{"device": pDevice})
+	//logger.Infow("DeviceType", log.Fields{"device": pDevice})
 	deviceType := parent
 	if !pDevice.Root {
-		log.Info("device is child")
+		logger.Info("device is child")
 		deviceType = child
 	}
-	log.Infof("deviceType:%d-deviceId:%s-previous:%v-current:%v", deviceType, pDevice.Id, pState, cState)
+	logger.Infof("deviceType:%d-deviceId:%s-previous:%v-current:%v", deviceType, pDevice.Id, pState, cState)
 
 	//2. Go over transition array to get the right transition
 	var currentMatch []TransitionHandler
diff --git a/rw_core/core/device_state_transitions_test.go b/rw_core/core/device_state_transitions_test.go
index 161cf24..8e06cb7 100644
--- a/rw_core/core/device_state_transitions_test.go
+++ b/rw_core/core/device_state_transitions_test.go
@@ -22,7 +22,6 @@
 
 	"github.com/opencord/voltha-go/rw_core/coreif"
 	"github.com/opencord/voltha-go/rw_core/mocks"
-	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
 	"github.com/stretchr/testify/assert"
 )
@@ -39,9 +38,6 @@
 }
 
 func init() {
-	if _, err := log.AddPackage(log.JSON, log.WarnLevel, nil); err != nil {
-		log.Fatal("failure-adding-package-core")
-	}
 	tdm = newTestDeviceManager()
 	transitionMap = NewTransitionMap(tdm)
 }
diff --git a/rw_core/core/grpc_nbi_api_handler.go b/rw_core/core/grpc_nbi_api_handler.go
index 74cea5e..f4786aa 100755
--- a/rw_core/core/grpc_nbi_api_handler.go
+++ b/rw_core/core/grpc_nbi_api_handler.go
@@ -105,7 +105,7 @@
 		err = errors.New("serial-number-not-found")
 	}
 	if !ok || serNum == nil {
-		log.Error(err)
+		logger.Error(err)
 		return nil, err
 	}
 	// Create KV transaction
@@ -120,11 +120,11 @@
 		// Metadata in context
 		if _, ok = md[handler.core.config.CoreBindingKey]; ok {
 			// OFAgent field in metadata
-			log.Debug("OFController-request")
+			logger.Debug("OFController-request")
 			return true
 		}
 	}
-	log.Debug("not-OFController-request")
+	logger.Debug("not-OFController-request")
 	return false
 }
 
@@ -152,7 +152,7 @@
 	if id != nil {
 		var ownedByMe bool
 		if ownedByMe, err = handler.core.deviceOwnership.OwnedByMe(ctx, id); err != nil {
-			log.Warnw("getting-ownership-failed", log.Fields{"deviceId": id, "error": err})
+			logger.Warnw("getting-ownership-failed", log.Fields{"deviceId": id, "error": err})
 			return nil, errorIDNotFound
 		}
 		acquired, err = txn.Acquired(ctx, timeout.Milliseconds(), ownedByMe)
@@ -160,10 +160,10 @@
 		acquired, err = txn.Acquired(ctx, timeout.Milliseconds())
 	}
 	if err == nil && acquired {
-		log.Debugw("transaction-acquired", log.Fields{"transactionId": txn.txnID})
+		logger.Debugw("transaction-acquired", log.Fields{"transactionId": txn.txnID})
 		return txn, nil
 	}
-	log.Debugw("transaction-not-acquired", log.Fields{"transactionId": txn.txnID, "error": err})
+	logger.Debugw("transaction-not-acquired", log.Fields{"transactionId": txn.txnID, "error": err})
 	return nil, errorTransactionNotAcquired
 }
 
@@ -177,33 +177,33 @@
 		} else if err, ok := res.(error); ok {
 			return &empty.Empty{}, err
 		} else {
-			log.Warnw("unexpected-return-type", log.Fields{"result": res})
+			logger.Warnw("unexpected-return-type", log.Fields{"result": res})
 			err = status.Errorf(codes.Internal, "%s", res)
 			return &empty.Empty{}, err
 		}
 	case <-ctx.Done():
-		log.Debug("client-timeout")
+		logger.Debug("client-timeout")
 		return nil, ctx.Err()
 	}
 }
 
 // ListCoreInstances returns details on the running core containers
 func (handler *APIHandler) ListCoreInstances(ctx context.Context, empty *empty.Empty) (*voltha.CoreInstances, error) {
-	log.Debug("ListCoreInstances")
+	logger.Debug("ListCoreInstances")
 	// TODO: unused stub
 	return &voltha.CoreInstances{}, status.Errorf(codes.NotFound, "no-core-instances")
 }
 
 // GetCoreInstance returns the details of a specific core container
 func (handler *APIHandler) GetCoreInstance(ctx context.Context, id *voltha.ID) (*voltha.CoreInstance, error) {
-	log.Debugw("GetCoreInstance", log.Fields{"id": id})
+	logger.Debugw("GetCoreInstance", log.Fields{"id": id})
 	//TODO: unused stub
 	return &voltha.CoreInstance{}, status.Errorf(codes.NotFound, "core-instance-%s", id.Id)
 }
 
 // GetLogicalDevicePort returns logical device port details
 func (handler *APIHandler) GetLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*voltha.LogicalPort, error) {
-	log.Debugw("GetLogicalDevicePort-request", log.Fields{"id": *id})
+	logger.Debugw("GetLogicalDevicePort-request", log.Fields{"id": *id})
 
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
@@ -217,7 +217,7 @@
 
 // EnableLogicalDevicePort enables logical device port
 func (handler *APIHandler) EnableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
-	log.Debugw("EnableLogicalDevicePort-request", log.Fields{"id": id, "test": common.TestModeKeys_api_test.String()})
+	logger.Debugw("EnableLogicalDevicePort-request", log.Fields{"id": id, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -238,7 +238,7 @@
 
 // DisableLogicalDevicePort disables logical device port
 func (handler *APIHandler) DisableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
-	log.Debugw("DisableLogicalDevicePort-request", log.Fields{"id": id, "test": common.TestModeKeys_api_test.String()})
+	logger.Debugw("DisableLogicalDevicePort-request", log.Fields{"id": id, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -259,7 +259,7 @@
 
 // UpdateLogicalDeviceFlowTable updates logical device flow table
 func (handler *APIHandler) UpdateLogicalDeviceFlowTable(ctx context.Context, flow *openflow_13.FlowTableUpdate) (*empty.Empty, error) {
-	log.Debugw("UpdateLogicalDeviceFlowTable-request", log.Fields{"flow": flow, "test": common.TestModeKeys_api_test.String()})
+	logger.Debugw("UpdateLogicalDeviceFlowTable-request", log.Fields{"flow": flow, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -280,7 +280,7 @@
 
 // UpdateLogicalDeviceFlowGroupTable updates logical device flow group table
 func (handler *APIHandler) UpdateLogicalDeviceFlowGroupTable(ctx context.Context, flow *openflow_13.FlowGroupTableUpdate) (*empty.Empty, error) {
-	log.Debugw("UpdateLogicalDeviceFlowGroupTable-request", log.Fields{"flow": flow, "test": common.TestModeKeys_api_test.String()})
+	logger.Debugw("UpdateLogicalDeviceFlowGroupTable-request", log.Fields{"flow": flow, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -301,7 +301,7 @@
 
 // GetDevice must be implemented in the read-only containers - should it also be implemented here?
 func (handler *APIHandler) GetDevice(ctx context.Context, id *voltha.ID) (*voltha.Device, error) {
-	log.Debugw("GetDevice-request", log.Fields{"id": id})
+	logger.Debugw("GetDevice-request", log.Fields{"id": id})
 	return handler.deviceMgr.GetDevice(ctx, id.Id)
 }
 
@@ -309,10 +309,10 @@
 
 // ListDevices retrieves the latest devices from the data model
 func (handler *APIHandler) ListDevices(ctx context.Context, empty *empty.Empty) (*voltha.Devices, error) {
-	log.Debug("ListDevices")
+	logger.Debug("ListDevices")
 	devices, err := handler.deviceMgr.ListDevices(ctx)
 	if err != nil {
-		log.Errorw("Failed to list devices", log.Fields{"error": err})
+		logger.Errorw("Failed to list devices", log.Fields{"error": err})
 		return nil, err
 	}
 	return devices, nil
@@ -320,7 +320,7 @@
 
 // ListDeviceIds returns the list of device ids managed by a voltha core
 func (handler *APIHandler) ListDeviceIds(ctx context.Context, empty *empty.Empty) (*voltha.IDs, error) {
-	log.Debug("ListDeviceIDs")
+	logger.Debug("ListDeviceIDs")
 	if isTestMode(ctx) {
 		return &voltha.IDs{Items: make([]*voltha.ID, 0)}, nil
 	}
@@ -329,7 +329,7 @@
 
 //ReconcileDevices is a request to a voltha core to managed a list of devices  based on their IDs
 func (handler *APIHandler) ReconcileDevices(ctx context.Context, ids *voltha.IDs) (*empty.Empty, error) {
-	log.Debug("ReconcileDevices")
+	logger.Debug("ReconcileDevices")
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -344,7 +344,7 @@
 
 // GetLogicalDevice provides a cloned most up to date logical device
 func (handler *APIHandler) GetLogicalDevice(ctx context.Context, id *voltha.ID) (*voltha.LogicalDevice, error) {
-	log.Debugw("GetLogicalDevice-request", log.Fields{"id": id})
+	logger.Debugw("GetLogicalDevice-request", log.Fields{"id": id})
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
 		if err != nil {
@@ -357,7 +357,7 @@
 
 // ListLogicalDevices returns the list of all logical devices
 func (handler *APIHandler) ListLogicalDevices(ctx context.Context, empty *empty.Empty) (*voltha.LogicalDevices, error) {
-	log.Debug("ListLogicalDevices-request")
+	logger.Debug("ListLogicalDevices-request")
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, nil)
 		if err != nil {
@@ -375,13 +375,13 @@
 
 // ListAdapters returns the contents of all adapters known to the system
 func (handler *APIHandler) ListAdapters(ctx context.Context, empty *empty.Empty) (*voltha.Adapters, error) {
-	log.Debug("ListAdapters")
+	logger.Debug("ListAdapters")
 	return handler.adapterMgr.listAdapters(ctx)
 }
 
 // ListLogicalDeviceFlows returns the flows of logical device
 func (handler *APIHandler) ListLogicalDeviceFlows(ctx context.Context, id *voltha.ID) (*openflow_13.Flows, error) {
-	log.Debugw("ListLogicalDeviceFlows", log.Fields{"id": *id})
+	logger.Debugw("ListLogicalDeviceFlows", log.Fields{"id": *id})
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
 		if err != nil {
@@ -394,7 +394,7 @@
 
 // ListLogicalDeviceFlowGroups returns logical device flow groups
 func (handler *APIHandler) ListLogicalDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*openflow_13.FlowGroups, error) {
-	log.Debugw("ListLogicalDeviceFlowGroups", log.Fields{"id": *id})
+	logger.Debugw("ListLogicalDeviceFlowGroups", log.Fields{"id": *id})
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
 		if err != nil {
@@ -407,7 +407,7 @@
 
 // ListLogicalDevicePorts returns ports of logical device
 func (handler *APIHandler) ListLogicalDevicePorts(ctx context.Context, id *voltha.ID) (*voltha.LogicalPorts, error) {
-	log.Debugw("ListLogicalDevicePorts", log.Fields{"logicaldeviceid": id})
+	logger.Debugw("ListLogicalDevicePorts", log.Fields{"logicaldeviceid": id})
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
 		if err != nil {
@@ -421,10 +421,10 @@
 // CreateDevice creates a new parent device in the data model
 func (handler *APIHandler) CreateDevice(ctx context.Context, device *voltha.Device) (*voltha.Device, error) {
 	if device.MacAddress == "" && device.GetHostAndPort() == "" {
-		log.Errorf("No Device Info Present")
+		logger.Errorf("No Device Info Present")
 		return &voltha.Device{}, errors.New("no-device-info-present; MAC or HOSTIP&PORT")
 	}
-	log.Debugw("create-device", log.Fields{"device": *device})
+	logger.Debugw("create-device", log.Fields{"device": *device})
 	if isTestMode(ctx) {
 		return &voltha.Device{Id: device.Id}, nil
 	}
@@ -445,29 +445,29 @@
 	case res := <-ch:
 		if res != nil {
 			if err, ok := res.(error); ok {
-				log.Errorw("create-device-failed", log.Fields{"error": err})
+				logger.Errorw("create-device-failed", log.Fields{"error": err})
 				return nil, err
 			}
 			if d, ok := res.(*voltha.Device); ok {
 				_, err := handler.core.deviceOwnership.OwnedByMe(ctx, &utils.DeviceID{ID: d.Id})
 				if err != nil {
-					log.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
+					logger.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
 				}
 				return d, nil
 			}
 		}
-		log.Warnw("create-device-unexpected-return-type", log.Fields{"result": res})
+		logger.Warnw("create-device-unexpected-return-type", log.Fields{"result": res})
 		err := status.Errorf(codes.Internal, "%s", res)
 		return &voltha.Device{}, err
 	case <-ctx.Done():
-		log.Debug("createdevice-client-timeout")
+		logger.Debug("createdevice-client-timeout")
 		return &voltha.Device{}, ctx.Err()
 	}
 }
 
 // EnableDevice activates a device by invoking the adopt_device API on the appropriate adapter
 func (handler *APIHandler) EnableDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
-	log.Debugw("enabledevice", log.Fields{"id": id})
+	logger.Debugw("enabledevice", log.Fields{"id": id})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -488,7 +488,7 @@
 
 // DisableDevice disables a device along with any child device it may have
 func (handler *APIHandler) DisableDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
-	log.Debugw("disabledevice-request", log.Fields{"id": id})
+	logger.Debugw("disabledevice-request", log.Fields{"id": id})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -509,7 +509,7 @@
 
 //RebootDevice invoked the reboot API to the corresponding adapter
 func (handler *APIHandler) RebootDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
-	log.Debugw("rebootDevice-request", log.Fields{"id": id})
+	logger.Debugw("rebootDevice-request", log.Fields{"id": id})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -530,7 +530,7 @@
 
 // DeleteDevice removes a device from the data model
 func (handler *APIHandler) DeleteDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
-	log.Debugw("deletedevice-request", log.Fields{"id": id})
+	logger.Debugw("deletedevice-request", log.Fields{"id": id})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -557,7 +557,7 @@
 
 // ListDevicePorts returns the ports details for a specific device entry
 func (handler *APIHandler) ListDevicePorts(ctx context.Context, id *voltha.ID) (*voltha.Ports, error) {
-	log.Debugw("listdeviceports-request", log.Fields{"id": id})
+	logger.Debugw("listdeviceports-request", log.Fields{"id": id})
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: id.Id})
 		if err != nil {
@@ -577,7 +577,7 @@
 
 // ListDeviceFlows returns the flow details for a specific device entry
 func (handler *APIHandler) ListDeviceFlows(ctx context.Context, id *voltha.ID) (*openflow_13.Flows, error) {
-	log.Debugw("listdeviceflows-request", log.Fields{"id": id})
+	logger.Debugw("listdeviceflows-request", log.Fields{"id": id})
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: id.Id})
 		if err != nil {
@@ -597,7 +597,7 @@
 
 // ListDeviceFlowGroups returns the flow group details for a specific device entry
 func (handler *APIHandler) ListDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*voltha.FlowGroups, error) {
-	log.Debugw("ListDeviceFlowGroups", log.Fields{"deviceid": id})
+	logger.Debugw("ListDeviceFlowGroups", log.Fields{"deviceid": id})
 
 	if device, _ := handler.deviceMgr.GetDevice(ctx, id.Id); device != nil {
 		return device.GetFlowGroups(), nil
@@ -607,26 +607,26 @@
 
 // ListDeviceGroups returns all the device groups known to the system
 func (handler *APIHandler) ListDeviceGroups(ctx context.Context, empty *empty.Empty) (*voltha.DeviceGroups, error) {
-	log.Debug("ListDeviceGroups")
+	logger.Debug("ListDeviceGroups")
 	return &voltha.DeviceGroups{}, errors.New("UnImplemented")
 }
 
 // GetDeviceGroup returns a specific device group entry
 func (handler *APIHandler) GetDeviceGroup(ctx context.Context, id *voltha.ID) (*voltha.DeviceGroup, error) {
-	log.Debug("GetDeviceGroup")
+	logger.Debug("GetDeviceGroup")
 	return &voltha.DeviceGroup{}, errors.New("UnImplemented")
 }
 
 // ListDeviceTypes returns all the device types known to the system
 func (handler *APIHandler) ListDeviceTypes(ctx context.Context, _ *empty.Empty) (*voltha.DeviceTypes, error) {
-	log.Debug("ListDeviceTypes")
+	logger.Debug("ListDeviceTypes")
 
 	return &voltha.DeviceTypes{Items: handler.adapterMgr.listDeviceTypes()}, nil
 }
 
 // GetDeviceType returns the device type for a specific device entry
 func (handler *APIHandler) GetDeviceType(ctx context.Context, id *voltha.ID) (*voltha.DeviceType, error) {
-	log.Debugw("GetDeviceType", log.Fields{"typeid": id})
+	logger.Debugw("GetDeviceType", log.Fields{"typeid": id})
 
 	if deviceType := handler.adapterMgr.getDeviceType(id.Id); deviceType != nil {
 		return deviceType, nil
@@ -637,7 +637,7 @@
 // GetVoltha returns the contents of all components (i.e. devices, logical_devices, ...)
 func (handler *APIHandler) GetVoltha(ctx context.Context, empty *empty.Empty) (*voltha.Voltha, error) {
 
-	log.Debug("GetVoltha")
+	logger.Debug("GetVoltha")
 	/*
 	 * For now, encode all the version information into a JSON object and
 	 * pass that back as "version" so the client can get all the
@@ -647,7 +647,7 @@
 	data, err := json.Marshal(&version.VersionInfo)
 	info := version.VersionInfo.Version
 	if err != nil {
-		log.Warnf("Unable to encode version information as JSON: %s", err.Error())
+		logger.Warnf("Unable to encode version information as JSON: %s", err.Error())
 	} else {
 		info = string(data)
 	}
@@ -659,7 +659,7 @@
 
 // processImageRequest is a helper method to execute an image download request
 func (handler *APIHandler) processImageRequest(ctx context.Context, img *voltha.ImageDownload, requestType int) (*common.OperationResp, error) {
-	log.Debugw("processImageDownload", log.Fields{"img": *img, "requestType": requestType})
+	logger.Debugw("processImageDownload", log.Fields{"img": *img, "requestType": requestType})
 	if isTestMode(ctx) {
 		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
 		return resp, nil
@@ -687,7 +687,7 @@
 	case RevertImage:
 		go handler.deviceMgr.revertImage(ctx, img, ch)
 	default:
-		log.Warn("invalid-request-type", log.Fields{"requestType": requestType})
+		logger.Warn("invalid-request-type", log.Fields{"requestType": requestType})
 		return failedresponse, status.Errorf(codes.InvalidArgument, "%d", requestType)
 	}
 	select {
@@ -700,17 +700,17 @@
 				return opResp, nil
 			}
 		}
-		log.Warnw("download-image-unexpected-return-type", log.Fields{"result": res})
+		logger.Warnw("download-image-unexpected-return-type", log.Fields{"result": res})
 		return failedresponse, status.Errorf(codes.Internal, "%s", res)
 	case <-ctx.Done():
-		log.Debug("downloadImage-client-timeout")
+		logger.Debug("downloadImage-client-timeout")
 		return &common.OperationResp{}, ctx.Err()
 	}
 }
 
 // DownloadImage execute an image download request
 func (handler *APIHandler) DownloadImage(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
-	log.Debugw("DownloadImage-request", log.Fields{"img": *img})
+	logger.Debugw("DownloadImage-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
 		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
 		return resp, nil
@@ -721,7 +721,7 @@
 
 // CancelImageDownload cancels image download request
 func (handler *APIHandler) CancelImageDownload(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
-	log.Debugw("cancelImageDownload-request", log.Fields{"img": *img})
+	logger.Debugw("cancelImageDownload-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
 		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
 		return resp, nil
@@ -731,7 +731,7 @@
 
 // ActivateImageUpdate activates image update request
 func (handler *APIHandler) ActivateImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
-	log.Debugw("activateImageUpdate-request", log.Fields{"img": *img})
+	logger.Debugw("activateImageUpdate-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
 		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
 		return resp, nil
@@ -742,7 +742,7 @@
 
 // RevertImageUpdate reverts image update
 func (handler *APIHandler) RevertImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
-	log.Debugw("revertImageUpdate-request", log.Fields{"img": *img})
+	logger.Debugw("revertImageUpdate-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
 		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
 		return resp, nil
@@ -753,7 +753,7 @@
 
 // GetImageDownloadStatus returns status of image download
 func (handler *APIHandler) GetImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	log.Debugw("getImageDownloadStatus-request", log.Fields{"img": *img})
+	logger.Debugw("getImageDownloadStatus-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
 		resp := &voltha.ImageDownload{DownloadState: voltha.ImageDownload_DOWNLOAD_SUCCEEDED}
 		return resp, nil
@@ -783,17 +783,17 @@
 				return downloadResp, nil
 			}
 		}
-		log.Warnw("download-image-status", log.Fields{"result": res})
+		logger.Warnw("download-image-status", log.Fields{"result": res})
 		return failedresponse, status.Errorf(codes.Internal, "%s", res)
 	case <-ctx.Done():
-		log.Debug("downloadImage-client-timeout")
+		logger.Debug("downloadImage-client-timeout")
 		return failedresponse, ctx.Err()
 	}
 }
 
 // GetImageDownload returns image download
 func (handler *APIHandler) GetImageDownload(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	log.Debugw("GetImageDownload-request", log.Fields{"img": *img})
+	logger.Debugw("GetImageDownload-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
 		resp := &voltha.ImageDownload{DownloadState: voltha.ImageDownload_DOWNLOAD_SUCCEEDED}
 		return resp, nil
@@ -808,7 +808,7 @@
 
 // ListImageDownloads returns image downloads
 func (handler *APIHandler) ListImageDownloads(ctx context.Context, id *voltha.ID) (*voltha.ImageDownloads, error) {
-	log.Debugw("ListImageDownloads-request", log.Fields{"deviceId": id.Id})
+	logger.Debugw("ListImageDownloads-request", log.Fields{"deviceId": id.Id})
 	if isTestMode(ctx) {
 		resp := &voltha.ImageDownloads{Items: []*voltha.ImageDownload{}}
 		return resp, nil
@@ -828,7 +828,7 @@
 
 // GetImages returns all images for a specific device entry
 func (handler *APIHandler) GetImages(ctx context.Context, id *voltha.ID) (*voltha.Images, error) {
-	log.Debugw("GetImages", log.Fields{"deviceid": id.Id})
+	logger.Debugw("GetImages", log.Fields{"deviceid": id.Id})
 	device, err := handler.deviceMgr.GetDevice(ctx, id.Id)
 	if err != nil {
 		return &voltha.Images{}, err
@@ -838,7 +838,7 @@
 
 // UpdateDevicePmConfigs updates the PM configs
 func (handler *APIHandler) UpdateDevicePmConfigs(ctx context.Context, configs *voltha.PmConfigs) (*empty.Empty, error) {
-	log.Debugw("UpdateDevicePmConfigs-request", log.Fields{"configs": *configs})
+	logger.Debugw("UpdateDevicePmConfigs-request", log.Fields{"configs": *configs})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -858,7 +858,7 @@
 
 // ListDevicePmConfigs returns pm configs of device
 func (handler *APIHandler) ListDevicePmConfigs(ctx context.Context, id *voltha.ID) (*voltha.PmConfigs, error) {
-	log.Debugw("ListDevicePmConfigs-request", log.Fields{"deviceId": *id})
+	logger.Debugw("ListDevicePmConfigs-request", log.Fields{"deviceId": *id})
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
 		if err != nil {
@@ -870,34 +870,34 @@
 }
 
 func (handler *APIHandler) CreateEventFilter(ctx context.Context, filter *voltha.EventFilter) (*voltha.EventFilter, error) {
-	log.Debugw("CreateEventFilter-request", log.Fields{"filter": *filter})
+	logger.Debugw("CreateEventFilter-request", log.Fields{"filter": *filter})
 	return nil, errors.New("UnImplemented")
 }
 
 func (handler *APIHandler) UpdateEventFilter(ctx context.Context, filter *voltha.EventFilter) (*voltha.EventFilter, error) {
-	log.Debugw("UpdateEventFilter-request", log.Fields{"filter": *filter})
+	logger.Debugw("UpdateEventFilter-request", log.Fields{"filter": *filter})
 	return nil, errors.New("UnImplemented")
 }
 
 func (handler *APIHandler) DeleteEventFilter(ctx context.Context, filterInfo *voltha.EventFilter) (*empty.Empty, error) {
-	log.Debugw("DeleteEventFilter-request", log.Fields{"device-id": filterInfo.DeviceId, "filter-id": filterInfo.Id})
+	logger.Debugw("DeleteEventFilter-request", log.Fields{"device-id": filterInfo.DeviceId, "filter-id": filterInfo.Id})
 	return nil, errors.New("UnImplemented")
 }
 
 // GetEventFilter returns all the filters present for a device
 func (handler *APIHandler) GetEventFilter(ctx context.Context, id *voltha.ID) (*voltha.EventFilters, error) {
-	log.Debugw("GetEventFilter-request", log.Fields{"device-id": id})
+	logger.Debugw("GetEventFilter-request", log.Fields{"device-id": id})
 	return nil, errors.New("UnImplemented")
 }
 
 // ListEventFilters returns all the filters known to the system
 func (handler *APIHandler) ListEventFilters(ctx context.Context, empty *empty.Empty) (*voltha.EventFilters, error) {
-	log.Debug("ListEventFilter-request")
+	logger.Debug("ListEventFilter-request")
 	return nil, errors.New("UnImplemented")
 }
 
 func (handler *APIHandler) SelfTest(ctx context.Context, id *voltha.ID) (*voltha.SelfTestResponse, error) {
-	log.Debugw("SelfTest-request", log.Fields{"id": id})
+	logger.Debugw("SelfTest-request", log.Fields{"id": id})
 	if isTestMode(ctx) {
 		resp := &voltha.SelfTestResponse{Result: voltha.SelfTestResponse_SUCCESS}
 		return resp, nil
@@ -906,7 +906,7 @@
 }
 
 func (handler *APIHandler) forwardPacketOut(ctx context.Context, packet *openflow_13.PacketOut) {
-	log.Debugw("forwardPacketOut-request", log.Fields{"packet": packet})
+	logger.Debugw("forwardPacketOut-request", log.Fields{"packet": packet})
 	//TODO: Update this logic once the OF Controller (OFAgent in this case) can include a transaction Id in its
 	// request.  For performance reason we can let both Cores in a Core-Pair forward the Packet to the adapters and
 	// let once of the shim layer (kafka proxy or adapter request handler filters out the duplicate packet)
@@ -914,19 +914,19 @@
 		if agent := handler.logicalDeviceMgr.getLogicalDeviceAgent(ctx, packet.Id); agent != nil {
 			agent.packetOut(ctx, packet.PacketOut)
 		} else {
-			log.Errorf("No logical device agent present", log.Fields{"logicaldeviceID": packet.Id})
+			logger.Errorf("No logical device agent present", log.Fields{"logicaldeviceID": packet.Id})
 		}
 	}
 }
 
 // StreamPacketsOut sends packets to adapter
 func (handler *APIHandler) StreamPacketsOut(packets voltha.VolthaService_StreamPacketsOutServer) error {
-	log.Debugw("StreamPacketsOut-request", log.Fields{"packets": packets})
+	logger.Debugw("StreamPacketsOut-request", log.Fields{"packets": packets})
 loop:
 	for {
 		select {
 		case <-packets.Context().Done():
-			log.Infow("StreamPacketsOut-context-done", log.Fields{"packets": packets, "error": packets.Context().Err()})
+			logger.Infow("StreamPacketsOut-context-done", log.Fields{"packets": packets, "error": packets.Context().Err()})
 			break loop
 		default:
 		}
@@ -934,26 +934,26 @@
 		packet, err := packets.Recv()
 
 		if err == io.EOF {
-			log.Debugw("Received-EOF", log.Fields{"packets": packets})
+			logger.Debugw("Received-EOF", log.Fields{"packets": packets})
 			break loop
 		}
 
 		if err != nil {
-			log.Errorw("Failed to receive packet out", log.Fields{"error": err})
+			logger.Errorw("Failed to receive packet out", log.Fields{"error": err})
 			continue
 		}
 
 		handler.forwardPacketOut(packets.Context(), packet)
 	}
 
-	log.Debugw("StreamPacketsOut-request-done", log.Fields{"packets": packets})
+	logger.Debugw("StreamPacketsOut-request-done", log.Fields{"packets": packets})
 	return nil
 }
 
 func (handler *APIHandler) sendPacketIn(deviceID string, transationID string, packet *openflow_13.OfpPacketIn) {
 	// TODO: Augment the OF PacketIn to include the transactionId
 	packetIn := openflow_13.PacketIn{Id: deviceID, PacketIn: packet}
-	log.Debugw("sendPacketIn", log.Fields{"packetIn": packetIn})
+	logger.Debugw("sendPacketIn", log.Fields{"packetIn": packetIn})
 	handler.packetInQueue <- packetIn
 }
 
@@ -972,9 +972,9 @@
 	defer streamingTracker.Unlock()
 	if _, ok := streamingTracker.calls[method]; ok {
 		// bail out the other packet in thread
-		log.Debugf("%s streaming call already running. Exiting it", method)
+		logger.Debugf("%s streaming call already running. Exiting it", method)
 		done <- true
-		log.Debugf("Last %s exited. Continuing ...", method)
+		logger.Debugf("Last %s exited. Continuing ...", method)
 	} else {
 		streamingTracker.calls[method] = &callTracker{failedPacket: nil}
 	}
@@ -985,10 +985,10 @@
 	if tracker.failedPacket != nil {
 		switch tracker.failedPacket.(type) {
 		case openflow_13.PacketIn:
-			log.Debug("Enqueueing last failed packetIn")
+			logger.Debug("Enqueueing last failed packetIn")
 			handler.packetInQueue <- tracker.failedPacket.(openflow_13.PacketIn)
 		case openflow_13.ChangeEvent:
-			log.Debug("Enqueueing last failed changeEvent")
+			logger.Debug("Enqueueing last failed changeEvent")
 			handler.changeEventQueue <- tracker.failedPacket.(openflow_13.ChangeEvent)
 		}
 	}
@@ -998,22 +998,22 @@
 // ReceivePacketsIn receives packets from adapter
 func (handler *APIHandler) ReceivePacketsIn(empty *empty.Empty, packetsIn voltha.VolthaService_ReceivePacketsInServer) error {
 	var streamingTracker = handler.getStreamingTracker("ReceivePacketsIn", handler.packetInQueueDone)
-	log.Debugw("ReceivePacketsIn-request", log.Fields{"packetsIn": packetsIn})
+	logger.Debugw("ReceivePacketsIn-request", log.Fields{"packetsIn": packetsIn})
 
 	err := handler.flushFailedPackets(streamingTracker)
 	if err != nil {
-		log.Errorw("unable-to-flush-failed-packets", log.Fields{"error": err})
+		logger.Errorw("unable-to-flush-failed-packets", log.Fields{"error": err})
 	}
 
 loop:
 	for {
 		select {
 		case packet := <-handler.packetInQueue:
-			log.Debugw("sending-packet-in", log.Fields{
+			logger.Debugw("sending-packet-in", log.Fields{
 				"packet": hex.EncodeToString(packet.PacketIn.Data),
 			})
 			if err := packetsIn.Send(&packet); err != nil {
-				log.Errorw("failed-to-send-packet", log.Fields{"error": err})
+				logger.Errorw("failed-to-send-packet", log.Fields{"error": err})
 				// save the last failed packet in
 				streamingTracker.failedPacket = packet
 			} else {
@@ -1023,7 +1023,7 @@
 				}
 			}
 		case <-handler.packetInQueueDone:
-			log.Debug("Another ReceivePacketsIn running. Bailing out ...")
+			logger.Debug("Another ReceivePacketsIn running. Bailing out ...")
 			break loop
 		}
 	}
@@ -1037,18 +1037,18 @@
 	//if _, ok := portStatus.(*openflow_13.OfpPortStatus); ok {
 	//}
 	event := openflow_13.ChangeEvent{Id: deviceID, Event: &openflow_13.ChangeEvent_PortStatus{PortStatus: portStatus}}
-	log.Debugw("sendChangeEvent", log.Fields{"event": event})
+	logger.Debugw("sendChangeEvent", log.Fields{"event": event})
 	handler.changeEventQueue <- event
 }
 
 // ReceiveChangeEvents receives change in events
 func (handler *APIHandler) ReceiveChangeEvents(empty *empty.Empty, changeEvents voltha.VolthaService_ReceiveChangeEventsServer) error {
 	var streamingTracker = handler.getStreamingTracker("ReceiveChangeEvents", handler.changeEventQueueDone)
-	log.Debugw("ReceiveChangeEvents-request", log.Fields{"changeEvents": changeEvents})
+	logger.Debugw("ReceiveChangeEvents-request", log.Fields{"changeEvents": changeEvents})
 
 	err := handler.flushFailedPackets(streamingTracker)
 	if err != nil {
-		log.Errorw("unable-to-flush-failed-packets", log.Fields{"error": err})
+		logger.Errorw("unable-to-flush-failed-packets", log.Fields{"error": err})
 	}
 
 loop:
@@ -1056,9 +1056,9 @@
 		select {
 		// Dequeue a change event
 		case event := <-handler.changeEventQueue:
-			log.Debugw("sending-change-event", log.Fields{"event": event})
+			logger.Debugw("sending-change-event", log.Fields{"event": event})
 			if err := changeEvents.Send(&event); err != nil {
-				log.Errorw("failed-to-send-change-event", log.Fields{"error": err})
+				logger.Errorw("failed-to-send-change-event", log.Fields{"error": err})
 				// save last failed changeevent
 				streamingTracker.failedPacket = event
 			} else {
@@ -1068,7 +1068,7 @@
 				}
 			}
 		case <-handler.changeEventQueueDone:
-			log.Debug("Another ReceiveChangeEvents already running. Bailing out ...")
+			logger.Debug("Another ReceiveChangeEvents already running. Bailing out ...")
 			break loop
 		}
 	}
@@ -1081,20 +1081,20 @@
 	ctx context.Context,
 	ofAgent *voltha.OfAgentSubscriber,
 ) (*voltha.OfAgentSubscriber, error) {
-	log.Debugw("Subscribe-request", log.Fields{"ofAgent": ofAgent})
+	logger.Debugw("Subscribe-request", log.Fields{"ofAgent": ofAgent})
 	return &voltha.OfAgentSubscriber{OfagentId: ofAgent.OfagentId, VolthaId: ofAgent.VolthaId}, nil
 }
 
 // GetAlarmDeviceData @TODO useless stub, what should this actually do?
 func (handler *APIHandler) GetAlarmDeviceData(ctx context.Context, in *common.ID) (*omci.AlarmDeviceData, error) {
-	log.Debug("GetAlarmDeviceData-stub")
+	logger.Debug("GetAlarmDeviceData-stub")
 	return &omci.AlarmDeviceData{}, errors.New("UnImplemented")
 }
 
 // ListLogicalDeviceMeters returns logical device meters
 func (handler *APIHandler) ListLogicalDeviceMeters(ctx context.Context, id *voltha.ID) (*openflow_13.Meters, error) {
 
-	log.Debugw("ListLogicalDeviceMeters", log.Fields{"id": *id})
+	logger.Debugw("ListLogicalDeviceMeters", log.Fields{"id": *id})
 	if handler.competeForTransaction() {
 		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
 		if err != nil {
@@ -1107,13 +1107,13 @@
 
 // GetMeterStatsOfLogicalDevice @TODO useless stub, what should this actually do?
 func (handler *APIHandler) GetMeterStatsOfLogicalDevice(ctx context.Context, in *common.ID) (*openflow_13.MeterStatsReply, error) {
-	log.Debug("GetMeterStatsOfLogicalDevice")
+	logger.Debug("GetMeterStatsOfLogicalDevice")
 	return &openflow_13.MeterStatsReply{}, errors.New("UnImplemented")
 }
 
 // GetMibDeviceData @TODO useless stub, what should this actually do?
 func (handler *APIHandler) GetMibDeviceData(ctx context.Context, in *common.ID) (*omci.MibDeviceData, error) {
-	log.Debug("GetMibDeviceData")
+	logger.Debug("GetMibDeviceData")
 	return &omci.MibDeviceData{}, errors.New("UnImplemented")
 }
 
@@ -1122,7 +1122,7 @@
 	ctx context.Context,
 	in *voltha.SimulateAlarmRequest,
 ) (*common.OperationResp, error) {
-	log.Debugw("SimulateAlarm-request", log.Fields{"id": in.Id})
+	logger.Debugw("SimulateAlarm-request", log.Fields{"id": in.Id})
 	successResp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
 	if isTestMode(ctx) {
 		return successResp, nil
@@ -1145,7 +1145,7 @@
 
 // UpdateLogicalDeviceMeterTable - This function sends meter mod request to logical device manager and waits for response
 func (handler *APIHandler) UpdateLogicalDeviceMeterTable(ctx context.Context, meter *openflow_13.MeterModUpdate) (*empty.Empty, error) {
-	log.Debugw("UpdateLogicalDeviceMeterTable-request",
+	logger.Debugw("UpdateLogicalDeviceMeterTable-request",
 		log.Fields{"meter": meter, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
@@ -1176,7 +1176,7 @@
 }
 
 func (handler *APIHandler) EnablePort(ctx context.Context, port *voltha.Port) (*empty.Empty, error) {
-	log.Debugw("EnablePort-request", log.Fields{"device-id": port.DeviceId, "port-no": port.PortNo})
+	logger.Debugw("EnablePort-request", log.Fields{"device-id": port.DeviceId, "port-no": port.PortNo})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -1197,7 +1197,7 @@
 
 func (handler *APIHandler) DisablePort(ctx context.Context, port *voltha.Port) (*empty.Empty, error) {
 
-	log.Debugw("DisablePort-request", log.Fields{"device-id": port.DeviceId, "port-no": port.PortNo})
+	logger.Debugw("DisablePort-request", log.Fields{"device-id": port.DeviceId, "port-no": port.PortNo})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
@@ -1217,6 +1217,6 @@
 }
 
 func (handler *APIHandler) StartOmciTestAction(ctx context.Context, omcitestrequest *voltha.OmciTestRequest) (*voltha.TestResponse, error) {
-	log.Debugw("Omci_test_Request", log.Fields{"id": omcitestrequest.Id, "uuid": omcitestrequest.Uuid})
+	logger.Debugw("Omci_test_Request", log.Fields{"id": omcitestrequest.Id, "uuid": omcitestrequest.Uuid})
 	return handler.deviceMgr.startOmciTest(ctx, omcitestrequest)
 }
diff --git a/rw_core/core/grpc_nbi_api_handler_test.go b/rw_core/core/grpc_nbi_api_handler_test.go
index 47a46e3..f151e48 100755
--- a/rw_core/core/grpc_nbi_api_handler_test.go
+++ b/rw_core/core/grpc_nbi_api_handler_test.go
@@ -66,7 +66,7 @@
 	var err error
 	test.etcdServer, test.kvClientPort, err = startEmbeddedEtcdServer("voltha.rwcore.nb.test", "voltha.rwcore.nb.etcd", "error")
 	if err != nil {
-		log.Fatal(err)
+		logger.Fatal(err)
 	}
 	// Create the kafka client
 	test.kClient = lm.NewKafkaClient()
@@ -89,7 +89,7 @@
 	cfg.InCompetingMode = inCompeteMode
 	grpcPort, err := freeport.GetFreePort()
 	if err != nil {
-		log.Fatal("Cannot get a freeport for grpc")
+		logger.Fatal("Cannot get a freeport for grpc")
 	}
 	cfg.GrpcPort = grpcPort
 	cfg.GrpcHost = "127.0.0.1"
@@ -98,7 +98,7 @@
 	nb.core = NewCore(ctx, nb.coreInstanceID, cfg, client, nb.kClient)
 	err = nb.core.Start(context.Background())
 	if err != nil {
-		log.Fatal("Cannot start core")
+		logger.Fatal("Cannot start core")
 	}
 }
 
@@ -106,7 +106,7 @@
 	// Setup the mock OLT adapter
 	oltAdapter, err := createMockAdapter(OltAdapter, nb.kClient, nb.coreInstanceID, coreName, nb.oltAdapterName)
 	if err != nil {
-		log.Fatalw("setting-mock-olt-adapter-failed", log.Fields{"error": err})
+		logger.Fatalw("setting-mock-olt-adapter-failed", log.Fields{"error": err})
 	}
 	nb.oltAdapter = (oltAdapter).(*cm.OLTAdapter)
 	nb.numONUPerOLT = nb.oltAdapter.GetNumONUPerOLT()
@@ -121,14 +121,14 @@
 	types := []*voltha.DeviceType{{Id: nb.oltAdapterName, Adapter: nb.oltAdapterName, AcceptsAddRemoveFlowUpdates: true}}
 	deviceTypes := &voltha.DeviceTypes{Items: types}
 	if _, err := nb.core.adapterMgr.registerAdapter(registrationData, deviceTypes); err != nil {
-		log.Errorw("failed-to-register-adapter", log.Fields{"error": err})
+		logger.Errorw("failed-to-register-adapter", log.Fields{"error": err})
 		assert.NotNil(t, err)
 	}
 
 	// Setup the mock ONU adapter
 	onuAdapter, err := createMockAdapter(OnuAdapter, nb.kClient, nb.coreInstanceID, coreName, nb.onuAdapterName)
 	if err != nil {
-		log.Fatalw("setting-mock-onu-adapter-failed", log.Fields{"error": err})
+		logger.Fatalw("setting-mock-onu-adapter-failed", log.Fields{"error": err})
 	}
 	nb.onuAdapter = (onuAdapter).(*cm.ONUAdapter)
 
@@ -141,7 +141,7 @@
 	types = []*voltha.DeviceType{{Id: nb.onuAdapterName, Adapter: nb.onuAdapterName, AcceptsAddRemoveFlowUpdates: true}}
 	deviceTypes = &voltha.DeviceTypes{Items: types}
 	if _, err := nb.core.adapterMgr.registerAdapter(registrationData, deviceTypes); err != nil {
-		log.Errorw("failed-to-register-adapter", log.Fields{"error": err})
+		logger.Errorw("failed-to-register-adapter", log.Fields{"error": err})
 		assert.NotNil(t, err)
 	}
 }
@@ -304,7 +304,7 @@
 		case nb.onuAdapterName:
 			assert.Equal(t, "Voltha-onu", a.Vendor)
 		default:
-			log.Fatal("unregistered-adapter", a.Id)
+			logger.Fatal("unregistered-adapter", a.Id)
 		}
 	}
 	deviceTypes, err := nbi.ListDeviceTypes(getContext(), &empty.Empty{})
@@ -322,7 +322,7 @@
 			assert.Equal(t, false, dt.AcceptsBulkFlowUpdate)
 			assert.Equal(t, true, dt.AcceptsAddRemoveFlowUpdates)
 		default:
-			log.Fatal("invalid-device-type", dt.Id)
+			logger.Fatal("invalid-device-type", dt.Id)
 		}
 	}
 }
@@ -1025,13 +1025,13 @@
 func TestSuite1(t *testing.T) {
 	f, err := os.Create("profile.cpu")
 	if err != nil {
-		log.Fatalf("could not create CPU profile: %v\n ", err)
+		logger.Fatalf("could not create CPU profile: %v\n ", err)
 	}
 	defer f.Close()
 	runtime.SetBlockProfileRate(1)
 	runtime.SetMutexProfileFraction(-1)
 	if err := pprof.StartCPUProfile(f); err != nil {
-		log.Fatalf("could not start CPU profile: %v\n", err)
+		logger.Fatalf("could not start CPU profile: %v\n", err)
 	}
 	defer pprof.StopCPUProfile()
 
diff --git a/rw_core/core/logical_device_agent.go b/rw_core/core/logical_device_agent.go
index a6ce9ab..743614a 100644
--- a/rw_core/core/logical_device_agent.go
+++ b/rw_core/core/logical_device_agent.go
@@ -92,13 +92,13 @@
 		return nil
 	}
 
-	log.Infow("starting-logical_device-agent", log.Fields{"logical-device-id": agent.logicalDeviceID, "load-from-db": loadFromDB})
+	logger.Infow("starting-logical_device-agent", log.Fields{"logical-device-id": agent.logicalDeviceID, "load-from-db": loadFromDB})
 
 	var startSucceeded bool
 	defer func() {
 		if !startSucceeded {
 			if err := agent.stop(ctx); err != nil {
-				log.Errorw("failed-to-cleanup-after-unsuccessful-start", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
+				logger.Errorw("failed-to-cleanup-after-unsuccessful-start", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
 			}
 		}
 	}()
@@ -123,7 +123,7 @@
 		}
 		ld.DatapathId = datapathID
 		ld.Desc = (proto.Clone(switchCap.Desc)).(*ofp.OfpDesc)
-		log.Debugw("Switch-capability", log.Fields{"Desc": ld.Desc, "fromAd": switchCap.Desc})
+		logger.Debugw("Switch-capability", log.Fields{"Desc": ld.Desc, "fromAd": switchCap.Desc})
 		ld.SwitchFeatures = (proto.Clone(switchCap.SwitchFeatures)).(*ofp.OfpSwitchFeatures)
 		ld.Flows = &ofp.Flows{Items: nil}
 		ld.FlowGroups = &ofp.FlowGroups{Items: nil}
@@ -135,9 +135,9 @@
 			return err
 		}
 		if added == nil {
-			log.Errorw("failed-to-add-logical-device", log.Fields{"logical-device-id": agent.logicalDeviceID})
+			logger.Errorw("failed-to-add-logical-device", log.Fields{"logical-device-id": agent.logicalDeviceID})
 		} else {
-			log.Debugw("logicaldevice-created", log.Fields{"logical-device-id": agent.logicalDeviceID, "root-id": ld.RootDeviceId})
+			logger.Debugw("logicaldevice-created", log.Fields{"logical-device-id": agent.logicalDeviceID, "root-id": ld.RootDeviceId})
 		}
 
 		agent.logicalDevice = proto.Clone(ld).(*voltha.LogicalDevice)
@@ -146,7 +146,7 @@
 		go func() {
 			err := agent.setupLogicalPorts(context.Background())
 			if err != nil {
-				log.Errorw("unable-to-setup-logical-ports", log.Fields{"error": err})
+				logger.Errorw("unable-to-setup-logical-ports", log.Fields{"error": err})
 			}
 		}()
 	} else {
@@ -183,7 +183,7 @@
 		fmt.Sprintf("/logical_devices/%s/meters", agent.logicalDeviceID),
 		false)
 	if err != nil {
-		log.Errorw("failed-to-create-meter-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-create-meter-proxy", log.Fields{"error": err})
 		return err
 	}
 	agent.groupProxy, err = agent.clusterDataProxy.CreateProxy(
@@ -191,7 +191,7 @@
 		fmt.Sprintf("/logical_devices/%s/flow_groups", agent.logicalDeviceID),
 		false)
 	if err != nil {
-		log.Errorw("failed-to-create-group-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-create-group-proxy", log.Fields{"error": err})
 		return err
 	}
 	agent.ldProxy, err = agent.clusterDataProxy.CreateProxy(
@@ -199,7 +199,7 @@
 		fmt.Sprintf("/logical_devices/%s", agent.logicalDeviceID),
 		false)
 	if err != nil {
-		log.Errorw("failed-to-create-logical-device-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-create-logical-device-proxy", log.Fields{"error": err})
 		return err
 	}
 	// TODO:  Use a port proxy once the POST_ADD is fixed
@@ -213,7 +213,7 @@
 	if loadFromDB {
 		go func() {
 			if err := agent.buildRoutes(context.Background()); err != nil {
-				log.Warn("routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
+				logger.Warn("routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
 			}
 		}()
 	}
@@ -226,7 +226,7 @@
 func (agent *LogicalDeviceAgent) stop(ctx context.Context) error {
 	var returnErr error
 	agent.stopOnce.Do(func() {
-		log.Info("stopping-logical_device-agent")
+		logger.Info("stopping-logical_device-agent")
 
 		if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 			// This should never happen - an error is returned only if the agent is stopped and an agent is only stopped once.
@@ -241,7 +241,7 @@
 		} else if removed == nil {
 			returnErr = status.Errorf(codes.Aborted, "failed-to-remove-logical-ldevice-%s", agent.logicalDeviceID)
 		} else {
-			log.Debugw("logicaldevice-removed", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
+			logger.Debugw("logicaldevice-removed", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
 		}
 
 		// Stop the request queue and request complete indication
@@ -249,7 +249,7 @@
 
 		close(agent.exitChannel)
 
-		log.Info("logical_device-agent-stopped")
+		logger.Info("logical_device-agent-stopped")
 	})
 	return returnErr
 }
@@ -265,7 +265,7 @@
 
 // ListLogicalDeviceFlows returns logical device flows
 func (agent *LogicalDeviceAgent) ListLogicalDeviceFlows(ctx context.Context) (*ofp.Flows, error) {
-	log.Debug("ListLogicalDeviceFlows")
+	logger.Debug("ListLogicalDeviceFlows")
 
 	logicalDevice, err := agent.GetLogicalDevice(ctx)
 	if err != nil {
@@ -279,7 +279,7 @@
 
 // ListLogicalDeviceMeters returns logical device meters
 func (agent *LogicalDeviceAgent) ListLogicalDeviceMeters(ctx context.Context) (*ofp.Meters, error) {
-	log.Debug("ListLogicalDeviceMeters")
+	logger.Debug("ListLogicalDeviceMeters")
 
 	logicalDevice, err := agent.GetLogicalDevice(ctx)
 	if err != nil {
@@ -293,7 +293,7 @@
 
 // ListLogicalDeviceFlowGroups returns logical device flow groups
 func (agent *LogicalDeviceAgent) ListLogicalDeviceFlowGroups(ctx context.Context) (*ofp.FlowGroups, error) {
-	log.Debug("ListLogicalDeviceFlowGroups")
+	logger.Debug("ListLogicalDeviceFlowGroups")
 
 	logicalDevice, err := agent.GetLogicalDevice(ctx)
 	if err != nil {
@@ -307,7 +307,7 @@
 
 // ListLogicalDevicePorts returns logical device ports
 func (agent *LogicalDeviceAgent) ListLogicalDevicePorts(ctx context.Context) (*voltha.LogicalPorts, error) {
-	log.Debug("ListLogicalDevicePorts")
+	logger.Debug("ListLogicalDevicePorts")
 	logicalDevice, err := agent.GetLogicalDevice(ctx)
 	if err != nil {
 		return nil, err
@@ -324,11 +324,11 @@
 func (agent *LogicalDeviceAgent) updateLogicalDeviceFlowsWithoutLock(ctx context.Context, flows *ofp.Flows) error {
 	ld := agent.getLogicalDeviceWithoutLock()
 
-	log.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
+	logger.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
 	ld.Flows = flows
 
 	if err := agent.updateLogicalDeviceWithoutLock(ctx, ld); err != nil {
-		log.Errorw("error-updating-logical-device-with-flows", log.Fields{"error": err})
+		logger.Errorw("error-updating-logical-device-with-flows", log.Fields{"error": err})
 		return err
 	}
 	return nil
@@ -338,11 +338,11 @@
 func (agent *LogicalDeviceAgent) updateLogicalDeviceMetersWithoutLock(ctx context.Context, meters *ofp.Meters) error {
 	ld := agent.getLogicalDeviceWithoutLock()
 
-	log.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
+	logger.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
 	ld.Meters = meters
 
 	if err := agent.updateLogicalDeviceWithoutLock(ctx, ld); err != nil {
-		log.Errorw("error-updating-logical-device-with-meters", log.Fields{"error": err})
+		logger.Errorw("error-updating-logical-device-with-meters", log.Fields{"error": err})
 		return err
 	}
 	return nil
@@ -352,11 +352,11 @@
 func (agent *LogicalDeviceAgent) updateLogicalDeviceFlowGroupsWithoutLock(ctx context.Context, flowGroups *ofp.FlowGroups) error {
 	ld := agent.getLogicalDeviceWithoutLock()
 
-	log.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
+	logger.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
 	ld.FlowGroups = flowGroups
 
 	if err := agent.updateLogicalDeviceWithoutLock(ctx, ld); err != nil {
-		log.Errorw("error-updating-logical-device-with-flowgroups", log.Fields{"error": err})
+		logger.Errorw("error-updating-logical-device-with-flowgroups", log.Fields{"error": err})
 		return err
 	}
 	return nil
@@ -364,12 +364,12 @@
 
 // getLogicalDeviceWithoutLock returns a cloned logical device to a function that already holds the agent lock.
 func (agent *LogicalDeviceAgent) getLogicalDeviceWithoutLock() *voltha.LogicalDevice {
-	log.Debug("getLogicalDeviceWithoutLock")
+	logger.Debug("getLogicalDeviceWithoutLock")
 	return proto.Clone(agent.logicalDevice).(*voltha.LogicalDevice)
 }
 
 func (agent *LogicalDeviceAgent) updateLogicalPort(ctx context.Context, device *voltha.Device, port *voltha.Port) error {
-	log.Debugw("updateLogicalPort", log.Fields{"deviceId": device.Id, "port": port})
+	logger.Debugw("updateLogicalPort", log.Fields{"deviceId": device.Id, "port": port})
 	var err error
 	if port.Type == voltha.Port_ETHERNET_NNI {
 		if _, err = agent.addNNILogicalPort(ctx, device, port); err != nil {
@@ -385,7 +385,7 @@
 		// Update the device routes to ensure all routes on the logical device have been calculated
 		if err = agent.buildRoutes(ctx); err != nil {
 			// Not an error - temporary state
-			log.Warnw("failed-to-update-routes", log.Fields{"device-id": device.Id, "port": port, "error": err})
+			logger.Warnw("failed-to-update-routes", log.Fields{"device-id": device.Id, "port": port, "error": err})
 		}
 	}
 	return nil
@@ -395,17 +395,17 @@
 // added to it.  While the logical device was being created we could have received requests to add
 // NNI and UNI ports which were discarded.  Now is the time to add them if needed
 func (agent *LogicalDeviceAgent) setupLogicalPorts(ctx context.Context) error {
-	log.Infow("setupLogicalPorts", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+	logger.Infow("setupLogicalPorts", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	// First add any NNI ports which could have been missing
 	if err := agent.setupNNILogicalPorts(ctx, agent.rootDeviceID); err != nil {
-		log.Errorw("error-setting-up-NNI-ports", log.Fields{"error": err, "deviceId": agent.rootDeviceID})
+		logger.Errorw("error-setting-up-NNI-ports", log.Fields{"error": err, "deviceId": agent.rootDeviceID})
 		return err
 	}
 
 	// Now, set up the UNI ports if needed.
 	children, err := agent.deviceMgr.getAllChildDevices(ctx, agent.rootDeviceID)
 	if err != nil {
-		log.Errorw("error-getting-child-devices", log.Fields{"error": err, "deviceId": agent.rootDeviceID})
+		logger.Errorw("error-getting-child-devices", log.Fields{"error": err, "deviceId": agent.rootDeviceID})
 		return err
 	}
 	responses := make([]coreutils.Response, 0)
@@ -414,7 +414,7 @@
 		responses = append(responses, response)
 		go func(child *voltha.Device) {
 			if err = agent.setupUNILogicalPorts(context.Background(), child); err != nil {
-				log.Error("setting-up-UNI-ports-failed", log.Fields{"deviceID": child.Id})
+				logger.Error("setting-up-UNI-ports-failed", log.Fields{"deviceID": child.Id})
 				response.Error(status.Errorf(codes.Internal, "UNI-ports-setup-failed: %s", child.Id))
 			}
 			response.Done()
@@ -429,13 +429,13 @@
 
 // setupNNILogicalPorts creates an NNI port on the logical device that represents an NNI interface on a root device
 func (agent *LogicalDeviceAgent) setupNNILogicalPorts(ctx context.Context, deviceID string) error {
-	log.Infow("setupNNILogicalPorts-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+	logger.Infow("setupNNILogicalPorts-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	// Build the logical device based on information retrieved from the device adapter
 	var err error
 
 	var device *voltha.Device
 	if device, err = agent.deviceMgr.GetDevice(ctx, deviceID); err != nil {
-		log.Errorw("error-retrieving-device", log.Fields{"error": err, "deviceId": deviceID})
+		logger.Errorw("error-retrieving-device", log.Fields{"error": err, "deviceId": deviceID})
 		return err
 	}
 
@@ -443,7 +443,7 @@
 	for _, port := range device.Ports {
 		if port.Type == voltha.Port_ETHERNET_NNI {
 			if _, err = agent.addNNILogicalPort(ctx, device, port); err != nil {
-				log.Errorw("error-adding-UNI-port", log.Fields{"error": err})
+				logger.Errorw("error-adding-UNI-port", log.Fields{"error": err})
 			}
 			agent.addLogicalPortToMap(port.PortNo, true)
 		}
@@ -453,7 +453,7 @@
 
 // updatePortState updates the port state of the device
 func (agent *LogicalDeviceAgent) updatePortState(ctx context.Context, deviceID string, portNo uint32, operStatus voltha.OperStatus_Types) error {
-	log.Infow("updatePortState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "portNo": portNo, "state": operStatus})
+	logger.Infow("updatePortState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "portNo": portNo, "state": operStatus})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -471,7 +471,7 @@
 			}
 			// Update the logical device
 			if err := agent.updateLogicalDeviceWithoutLock(ctx, cloned); err != nil {
-				log.Errorw("error-updating-logical-device", log.Fields{"error": err})
+				logger.Errorw("error-updating-logical-device", log.Fields{"error": err})
 				return err
 			}
 			return nil
@@ -482,7 +482,7 @@
 
 // updatePortsState updates the ports state related to the device
 func (agent *LogicalDeviceAgent) updatePortsState(ctx context.Context, device *voltha.Device, state voltha.OperStatus_Types) error {
-	log.Infow("updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+	logger.Infow("updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -503,7 +503,7 @@
 	}
 	// Updating the logical device will trigger the poprt change events to be populated to the controller
 	if err := agent.updateLogicalDeviceWithoutLock(ctx, cloned); err != nil {
-		log.Warnw("logical-device-update-failed", log.Fields{"ldeviceId": agent.logicalDeviceID, "error": err})
+		logger.Warnw("logical-device-update-failed", log.Fields{"ldeviceId": agent.logicalDeviceID, "error": err})
 		return err
 	}
 	return nil
@@ -511,7 +511,7 @@
 
 // setupUNILogicalPorts creates a UNI port on the logical device that represents a child UNI interface
 func (agent *LogicalDeviceAgent) setupUNILogicalPorts(ctx context.Context, childDevice *voltha.Device) error {
-	log.Infow("setupUNILogicalPort", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+	logger.Infow("setupUNILogicalPort", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	// Build the logical device based on information retrieved from the device adapter
 	var err error
 	var added bool
@@ -519,7 +519,7 @@
 	for _, port := range childDevice.Ports {
 		if port.Type == voltha.Port_ETHERNET_UNI {
 			if added, err = agent.addUNILogicalPort(ctx, childDevice, port); err != nil {
-				log.Errorw("error-adding-UNI-port", log.Fields{"error": err})
+				logger.Errorw("error-adding-UNI-port", log.Fields{"error": err})
 			}
 			if added {
 				agent.addLogicalPortToMap(port.PortNo, false)
@@ -531,7 +531,7 @@
 
 // deleteAllLogicalPorts deletes all logical ports associated with this logical device
 func (agent *LogicalDeviceAgent) deleteAllLogicalPorts(ctx context.Context) error {
-	log.Infow("updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+	logger.Infow("updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -545,7 +545,7 @@
 	cloned.Ports = updateLogicalPorts
 
 	if err := agent.updateLogicalDeviceWithoutLock(ctx, cloned); err != nil {
-		log.Warnw("logical-device-update-failed", log.Fields{"ldeviceId": agent.logicalDeviceID, "error": err})
+		logger.Warnw("logical-device-update-failed", log.Fields{"ldeviceId": agent.logicalDeviceID, "error": err})
 		return err
 	}
 	return nil
@@ -553,7 +553,7 @@
 
 // deleteAllUNILogicalPorts deletes all UNI logical ports associated with this parent device
 func (agent *LogicalDeviceAgent) deleteAllUNILogicalPorts(ctx context.Context, parentDevice *voltha.Device) error {
-	log.Debugw("delete-all-uni-logical-ports", log.Fields{"logical-device-id": agent.logicalDeviceID})
+	logger.Debugw("delete-all-uni-logical-ports", log.Fields{"logical-device-id": agent.logicalDeviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -576,7 +576,7 @@
 			return err
 		}
 	} else {
-		log.Debugw("no-change-required", log.Fields{"logical-device-id": agent.logicalDeviceID})
+		logger.Debugw("no-change-required", log.Fields{"logical-device-id": agent.logicalDeviceID})
 	}
 	return nil
 }
@@ -586,7 +586,7 @@
 	updateCtx := context.WithValue(ctx, model.RequestTimestamp, time.Now().UnixNano())
 	afterUpdate, err := agent.clusterDataProxy.Update(updateCtx, "/logical_devices/"+agent.logicalDeviceID, logicalDevice, false, "")
 	if err != nil {
-		log.Errorw("failed-to-update-logical-devices-to-cluster-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-update-logical-devices-to-cluster-proxy", log.Fields{"error": err})
 		return err
 	}
 	if afterUpdate == nil {
@@ -612,7 +612,7 @@
 	if agent.deviceRoutes != nil && agent.deviceRoutes.IsUpToDate(ld) {
 		return nil
 	}
-	log.Debug("Generation of device route required")
+	logger.Debug("Generation of device route required")
 	if err := agent.buildRoutes(ctx); err != nil {
 		return err
 	}
@@ -621,7 +621,7 @@
 
 //updateFlowTable updates the flow table of that logical device
 func (agent *LogicalDeviceAgent) updateFlowTable(ctx context.Context, flow *ofp.OfpFlowMod) error {
-	log.Debug("updateFlowTable")
+	logger.Debug("updateFlowTable")
 	if flow == nil {
 		return nil
 	}
@@ -646,7 +646,7 @@
 
 //updateGroupTable updates the group table of that logical device
 func (agent *LogicalDeviceAgent) updateGroupTable(ctx context.Context, groupMod *ofp.OfpGroupMod) error {
-	log.Debug("updateGroupTable")
+	logger.Debug("updateGroupTable")
 	if groupMod == nil {
 		return nil
 	}
@@ -668,7 +668,7 @@
 
 // updateMeterTable updates the meter table of that logical device
 func (agent *LogicalDeviceAgent) updateMeterTable(ctx context.Context, meterMod *ofp.OfpMeterMod) error {
-	log.Debug("updateMeterTable")
+	logger.Debug("updateMeterTable")
 	if meterMod == nil {
 		return nil
 	}
@@ -686,7 +686,7 @@
 }
 
 func (agent *LogicalDeviceAgent) meterAdd(ctx context.Context, meterMod *ofp.OfpMeterMod) error {
-	log.Debugw("meterAdd", log.Fields{"metermod": *meterMod})
+	logger.Debugw("meterAdd", log.Fields{"metermod": *meterMod})
 	if meterMod == nil {
 		return nil
 	}
@@ -694,18 +694,18 @@
 		return err
 	}
 	defer agent.requestQueue.RequestComplete()
-	log.Debug("Acquired logical device lock")
+	logger.Debug("Acquired logical device lock")
 	lDevice := agent.getLogicalDeviceWithoutLock()
 
 	var meters []*ofp.OfpMeterEntry
 	if lDevice.Meters != nil && lDevice.Meters.Items != nil {
 		meters = lDevice.Meters.Items
 	}
-	log.Debugw("Available meters", log.Fields{"meters": meters})
+	logger.Debugw("Available meters", log.Fields{"meters": meters})
 
 	for _, meter := range meters {
 		if meterMod.MeterId == meter.Config.MeterId {
-			log.Infow("Meter-already-exists", log.Fields{"meter": *meterMod})
+			logger.Infow("Meter-already-exists", log.Fields{"meter": *meterMod})
 			return nil
 		}
 	}
@@ -714,15 +714,15 @@
 	meters = append(meters, meterEntry)
 	//Update model
 	if err := agent.updateLogicalDeviceMetersWithoutLock(ctx, &ofp.Meters{Items: meters}); err != nil {
-		log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		logger.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 		return err
 	}
-	log.Debugw("Meter-added-successfully", log.Fields{"Added-meter": meterEntry, "updated-meters": lDevice.Meters})
+	logger.Debugw("Meter-added-successfully", log.Fields{"Added-meter": meterEntry, "updated-meters": lDevice.Meters})
 	return nil
 }
 
 func (agent *LogicalDeviceAgent) meterDelete(ctx context.Context, meterMod *ofp.OfpMeterMod) error {
-	log.Debug("meterDelete", log.Fields{"meterMod": *meterMod})
+	logger.Debug("meterDelete", log.Fields{"meterMod": *meterMod})
 	if meterMod == nil {
 		return nil
 	}
@@ -742,13 +742,13 @@
 
 	changedMeter := false
 	changedFow := false
-	log.Debugw("Available meters", log.Fields{"meters": meters})
+	logger.Debugw("Available meters", log.Fields{"meters": meters})
 	for index, meter := range meters {
 		if meterMod.MeterId == meter.Config.MeterId {
 			flows = lDevice.Flows.Items
 			changedFow, updatedFlows = agent.getUpdatedFlowsAfterDeletebyMeterID(flows, meterMod.MeterId)
 			meters = append(meters[:index], meters[index+1:]...)
-			log.Debugw("Meter has been deleted", log.Fields{"meter": meter, "index": index})
+			logger.Debugw("Meter has been deleted", log.Fields{"meter": meter, "index": index})
 			changedMeter = true
 			break
 		}
@@ -760,27 +760,27 @@
 			metersToUpdate = &ofp.Meters{Items: meters}
 		}
 		if err := agent.updateLogicalDeviceMetersWithoutLock(ctx, metersToUpdate); err != nil {
-			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
-		log.Debug("Meter-deleted-from-DB-successfully", log.Fields{"updatedMeters": metersToUpdate, "no-of-meter": len(metersToUpdate.Items)})
+		logger.Debug("Meter-deleted-from-DB-successfully", log.Fields{"updatedMeters": metersToUpdate, "no-of-meter": len(metersToUpdate.Items)})
 
 	}
 	if changedFow {
 		//Update model
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(ctx, &ofp.Flows{Items: updatedFlows}); err != nil {
-			log.Errorw("db-flow-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("db-flow-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
-		log.Debug("Flows-associated-with-meter-deleted-from-DB-successfully",
+		logger.Debug("Flows-associated-with-meter-deleted-from-DB-successfully",
 			log.Fields{"updated-no-of-flows": len(updatedFlows), "meter": meterMod.MeterId})
 	}
-	log.Debugw("meterDelete success", log.Fields{"meterID": meterMod.MeterId})
+	logger.Debugw("meterDelete success", log.Fields{"meterID": meterMod.MeterId})
 	return nil
 }
 
 func (agent *LogicalDeviceAgent) meterModify(ctx context.Context, meterMod *ofp.OfpMeterMod) error {
-	log.Debug("meterModify")
+	logger.Debug("meterModify")
 	if meterMod == nil {
 		return nil
 	}
@@ -802,7 +802,7 @@
 			newmeterEntry.Stats.FlowCount = meter.Stats.FlowCount
 			meters[index] = newmeterEntry
 			changedMeter = true
-			log.Debugw("Found meter, replaced with new meter", log.Fields{"old meter": meter, "new meter": newmeterEntry})
+			logger.Debugw("Found meter, replaced with new meter", log.Fields{"old meter": meter, "new meter": newmeterEntry})
 			break
 		}
 	}
@@ -813,25 +813,25 @@
 			metersToUpdate = &ofp.Meters{Items: meters}
 		}
 		if err := agent.updateLogicalDeviceMetersWithoutLock(ctx, metersToUpdate); err != nil {
-			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
-		log.Debugw("meter-updated-in-DB-successfully", log.Fields{"updated_meters": meters})
+		logger.Debugw("meter-updated-in-DB-successfully", log.Fields{"updated_meters": meters})
 		return nil
 	}
 
-	log.Errorw("Meter not found ", log.Fields{"meter": meterMod})
+	logger.Errorw("Meter not found ", log.Fields{"meter": meterMod})
 	return fmt.Errorf("no-logical-device-present:%d", meterMod.MeterId)
 
 }
 
 func (agent *LogicalDeviceAgent) getUpdatedFlowsAfterDeletebyMeterID(flows []*ofp.OfpFlowStats, meterID uint32) (bool, []*ofp.OfpFlowStats) {
-	log.Infow("Delete flows matching meter", log.Fields{"meter": meterID})
+	logger.Infow("Delete flows matching meter", log.Fields{"meter": meterID})
 	changed := false
 	//updatedFlows := make([]*ofp.OfpFlowStats, 0)
 	for index := len(flows) - 1; index >= 0; index-- {
 		if mID := fu.GetMeterIdFromFlow(flows[index]); mID != 0 && mID == meterID {
-			log.Debugw("Flow to be deleted", log.Fields{"flow": flows[index], "index": index})
+			logger.Debugw("Flow to be deleted", log.Fields{"flow": flows[index], "index": index})
 			flows = append(flows[:index], flows[index+1:]...)
 			changed = true
 		}
@@ -843,13 +843,13 @@
 
 	flowCommand := modCommand.GetCommand()
 	meterID := fu.GetMeterIdFromFlow(flow)
-	log.Debugw("Meter-id-in-flow-mod", log.Fields{"meterId": meterID})
+	logger.Debugw("Meter-id-in-flow-mod", log.Fields{"meterId": meterID})
 	if meterID == 0 {
-		log.Debugw("No meter present in the flow", log.Fields{"flow": *flow})
+		logger.Debugw("No meter present in the flow", log.Fields{"flow": *flow})
 		return false
 	}
 	if meters == nil {
-		log.Debug("No meters present in logical device")
+		logger.Debug("No meters present in logical device")
 		return false
 	}
 	changedMeter := false
@@ -862,7 +862,7 @@
 				meter.Stats.FlowCount--
 				changedMeter = true
 			}
-			log.Debugw("Found meter, updated meter flow stats", log.Fields{" meterId": meterID})
+			logger.Debugw("Found meter, updated meter flow stats", log.Fields{" meterId": meterID})
 			break
 		}
 	}
@@ -871,7 +871,7 @@
 
 //flowAdd adds a flow to the flow table of that logical device
 func (agent *LogicalDeviceAgent) flowAdd(ctx context.Context, mod *ofp.OfpFlowMod) error {
-	log.Debugw("flowAdd", log.Fields{"flow": mod})
+	logger.Debugw("flowAdd", log.Fields{"flow": mod})
 	if mod == nil {
 		return nil
 	}
@@ -901,7 +901,7 @@
 	if checkOverlap {
 		if overlapped := fu.FindOverlappingFlows(flows, mod); len(overlapped) != 0 {
 			//	TODO:  should this error be notified other than being logged?
-			log.Warnw("overlapped-flows", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
+			logger.Warnw("overlapped-flows", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
 		} else {
 			//	Add flow
 			flow, err = fu.FlowStatsEntryFromFlowModMessage(mod)
@@ -936,23 +936,23 @@
 			changed = true
 		}
 	}
-	log.Debugw("flowAdd-changed", log.Fields{"changed": changed})
+	logger.Debugw("flowAdd-changed", log.Fields{"changed": changed})
 
 	if changed {
 		var flowMetadata voltha.FlowMetadata
 		if err := agent.GetMeterConfig(updatedFlows, meters, &flowMetadata); err != nil { // This should never happen,meters should be installed before flow arrives
-			log.Error("Meter-referred-in-flows-not-present")
+			logger.Error("Meter-referred-in-flows-not-present")
 			return err
 		}
 		deviceRules, err := agent.flowDecomposer.DecomposeRules(ctx, agent, ofp.Flows{Items: updatedFlows}, *lDevice.FlowGroups)
 		if err != nil {
 			return err
 		}
-		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
+		logger.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		//	Update model
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(ctx, &ofp.Flows{Items: flows}); err != nil {
-			log.Errorw("db-flow-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("db-flow-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 		if !updated {
@@ -964,10 +964,10 @@
 			if changedMeterStats {
 				//Update model
 				if err := agent.updateLogicalDeviceMetersWithoutLock(ctx, metersToUpdate); err != nil {
-					log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+					logger.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 					return err
 				}
-				log.Debugw("meter-stats-updated-in-DB-successfully", log.Fields{"updated_meters": meters})
+				logger.Debugw("meter-stats-updated-in-DB-successfully", log.Fields{"updated_meters": meters})
 
 			}
 		}
@@ -978,7 +978,7 @@
 		go func() {
 			// Wait for completion
 			if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChannels...); res != nil {
-				log.Warnw("failure-to-add-flows", log.Fields{"errors": res, "logical-device-id": agent.logicalDeviceID})
+				logger.Warnw("failure-to-add-flows", log.Fields{"errors": res, "logical-device-id": agent.logicalDeviceID})
 				// TODO : revert added flow
 			}
 		}()
@@ -996,7 +996,7 @@
 			for _, meter := range meters {
 				if flowMeterID == meter.Config.MeterId {
 					metadata.Meters = append(metadata.Meters, meter.Config)
-					log.Debugw("Found meter in logical device",
+					logger.Debugw("Found meter in logical device",
 						log.Fields{"meterID": flowMeterID, "meter-band": meter.Config})
 					m[flowMeterID] = true
 					foundMeter = true
@@ -1004,20 +1004,20 @@
 				}
 			}
 			if !foundMeter {
-				log.Errorw("Meter-referred-by-flow-is-not-found-in-logicaldevice",
+				logger.Errorw("Meter-referred-by-flow-is-not-found-in-logicaldevice",
 					log.Fields{"meterID": flowMeterID, "Available-meters": meters, "flow": *flow})
 				return errors.New("Meter-referred-by-flow-is-not-found-in-logicaldevice")
 			}
 		}
 	}
-	log.Debugw("meter-bands-for-flows", log.Fields{"flows": len(flows), "metadata": metadata})
+	logger.Debugw("meter-bands-for-flows", log.Fields{"flows": len(flows), "metadata": metadata})
 	return nil
 
 }
 
 //flowDelete deletes a flow from the flow table of that logical device
 func (agent *LogicalDeviceAgent) flowDelete(ctx context.Context, mod *ofp.OfpFlowMod) error {
-	log.Debug("flowDelete")
+	logger.Debug("flowDelete")
 	if mod == nil {
 		return nil
 	}
@@ -1065,23 +1065,23 @@
 		}
 	}
 
-	log.Debugw("flowDelete", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "toKeep": len(toKeep), "toDelete": toDelete})
+	logger.Debugw("flowDelete", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "toKeep": len(toKeep), "toDelete": toDelete})
 
 	//Update flows
 	if len(toDelete) > 0 {
 		var flowMetadata voltha.FlowMetadata
 		if err := agent.GetMeterConfig(toDelete, meters, &flowMetadata); err != nil { // This should never happen
-			log.Error("Meter-referred-in-flows-not-present")
+			logger.Error("Meter-referred-in-flows-not-present")
 			return errors.New("Meter-referred-in-flows-not-present")
 		}
 		deviceRules, err := agent.flowDecomposer.DecomposeRules(ctx, agent, ofp.Flows{Items: toDelete}, ofp.FlowGroups{Items: flowGroups})
 		if err != nil {
 			return err
 		}
-		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
+		logger.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(ctx, &ofp.Flows{Items: toKeep}); err != nil {
-			log.Errorw("cannot-update-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("cannot-update-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 
@@ -1092,7 +1092,7 @@
 		go func() {
 			// Wait for completion
 			if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChnls...); res != nil {
-				log.Errorw("failure-updating-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
+				logger.Errorw("failure-updating-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
 				// TODO: Revert the flow deletion
 			}
 		}()
@@ -1103,7 +1103,7 @@
 }
 
 func (agent *LogicalDeviceAgent) addFlowsAndGroupsToDevices(ctx context.Context, deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) []coreutils.Response {
-	log.Debugw("send-add-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID, "deviceRules": deviceRules, "flowMetadata": flowMetadata})
+	logger.Debugw("send-add-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID, "deviceRules": deviceRules, "flowMetadata": flowMetadata})
 
 	responses := make([]coreutils.Response, 0)
 	for deviceID, value := range deviceRules.GetRules() {
@@ -1113,7 +1113,7 @@
 			ctx, cancel := context.WithTimeout(context.Background(), agent.defaultTimeout)
 			defer cancel()
 			if err := agent.deviceMgr.addFlowsAndGroups(ctx, deviceId, value.ListFlows(), value.ListGroups(), flowMetadata); err != nil {
-				log.Errorw("flow-add-failed", log.Fields{"deviceID": deviceId, "error": err})
+				logger.Errorw("flow-add-failed", log.Fields{"deviceID": deviceId, "error": err})
 				response.Error(status.Errorf(codes.Internal, "flow-add-failed: %s", deviceId))
 			}
 			response.Done()
@@ -1124,7 +1124,7 @@
 }
 
 func (agent *LogicalDeviceAgent) deleteFlowsAndGroupsFromDevices(ctx context.Context, deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) []coreutils.Response {
-	log.Debugw("send-delete-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID})
+	logger.Debugw("send-delete-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID})
 
 	responses := make([]coreutils.Response, 0)
 	for deviceID, value := range deviceRules.GetRules() {
@@ -1134,7 +1134,7 @@
 			ctx, cancel := context.WithTimeout(context.Background(), agent.defaultTimeout)
 			defer cancel()
 			if err := agent.deviceMgr.deleteFlowsAndGroups(ctx, deviceId, value.ListFlows(), value.ListGroups(), flowMetadata); err != nil {
-				log.Error("flow-delete-failed", log.Fields{"deviceID": deviceId, "error": err})
+				logger.Error("flow-delete-failed", log.Fields{"deviceID": deviceId, "error": err})
 				response.Error(status.Errorf(codes.Internal, "flow-delete-failed: %s", deviceId))
 			}
 			response.Done()
@@ -1144,7 +1144,7 @@
 }
 
 func (agent *LogicalDeviceAgent) updateFlowsAndGroupsOfDevice(ctx context.Context, deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) []coreutils.Response {
-	log.Debugw("send-update-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID})
+	logger.Debugw("send-update-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID})
 
 	responses := make([]coreutils.Response, 0)
 	for deviceID, value := range deviceRules.GetRules() {
@@ -1154,7 +1154,7 @@
 			ctx, cancel := context.WithTimeout(context.Background(), agent.defaultTimeout)
 			defer cancel()
 			if err := agent.deviceMgr.updateFlowsAndGroups(ctx, deviceId, value.ListFlows(), value.ListGroups(), flowMetadata); err != nil {
-				log.Error("flow-update-failed", log.Fields{"deviceID": deviceId, "error": err})
+				logger.Error("flow-update-failed", log.Fields{"deviceID": deviceId, "error": err})
 				response.Error(status.Errorf(codes.Internal, "flow-update-failed: %s", deviceId))
 			}
 			response.Done()
@@ -1165,7 +1165,7 @@
 
 //flowDeleteStrict deletes a flow from the flow table of that logical device
 func (agent *LogicalDeviceAgent) flowDeleteStrict(ctx context.Context, mod *ofp.OfpFlowMod) error {
-	log.Debug("flowDeleteStrict")
+	logger.Debug("flowDeleteStrict")
 	if mod == nil {
 		return nil
 	}
@@ -1212,7 +1212,7 @@
 			metersToUpdate = &ofp.Meters{Items: meters}
 		}
 		if err := agent.updateLogicalDeviceMetersWithoutLock(ctx, metersToUpdate); err != nil {
-			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 
@@ -1220,17 +1220,17 @@
 	if changedFlow {
 		var flowMetadata voltha.FlowMetadata
 		if err := agent.GetMeterConfig(flowsToDelete, meters, &flowMetadata); err != nil {
-			log.Error("meter-referred-in-flows-not-present")
+			logger.Error("meter-referred-in-flows-not-present")
 			return err
 		}
 		deviceRules, err := agent.flowDecomposer.DecomposeRules(ctx, agent, ofp.Flows{Items: flowsToDelete}, ofp.FlowGroups{Items: flowGroups})
 		if err != nil {
 			return err
 		}
-		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
+		logger.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(ctx, &ofp.Flows{Items: flows}); err != nil {
-			log.Errorw("cannot-update-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("cannot-update-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 
@@ -1240,7 +1240,7 @@
 		// Wait for completion
 		go func() {
 			if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChnls...); res != nil {
-				log.Warnw("failure-deleting-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
+				logger.Warnw("failure-deleting-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
 				//TODO: Revert flow changes
 			}
 		}()
@@ -1259,7 +1259,7 @@
 }
 
 func (agent *LogicalDeviceAgent) groupAdd(ctx context.Context, groupMod *ofp.OfpGroupMod) error {
-	log.Debug("groupAdd")
+	logger.Debug("groupAdd")
 	if groupMod == nil {
 		return nil
 	}
@@ -1280,10 +1280,10 @@
 		fg.AddGroup(fu.GroupEntryFromGroupMod(groupMod))
 		deviceRules.AddFlowsAndGroup(agent.rootDeviceID, fg)
 
-		log.Debugw("rules", log.Fields{"rules for group-add": deviceRules.String()})
+		logger.Debugw("rules", log.Fields{"rules for group-add": deviceRules.String()})
 
 		if err := agent.updateLogicalDeviceFlowGroupsWithoutLock(ctx, &ofp.FlowGroups{Items: groups}); err != nil {
-			log.Errorw("cannot-update-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("cannot-update-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 
@@ -1293,7 +1293,7 @@
 		// Wait for completion
 		go func() {
 			if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChnls...); res != nil {
-				log.Warnw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
+				logger.Warnw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
 				//TODO: Revert flow changes
 			}
 		}()
@@ -1303,7 +1303,7 @@
 }
 
 func (agent *LogicalDeviceAgent) groupDelete(ctx context.Context, groupMod *ofp.OfpGroupMod) error {
-	log.Debug("groupDelete")
+	logger.Debug("groupDelete")
 	if groupMod == nil {
 		return nil
 	}
@@ -1337,17 +1337,17 @@
 		if err != nil {
 			return err
 		}
-		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
+		logger.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if groupsChanged {
 			if err := agent.updateLogicalDeviceFlowGroupsWithoutLock(ctx, &ofp.FlowGroups{Items: groups}); err != nil {
-				log.Errorw("cannot-update-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+				logger.Errorw("cannot-update-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 				return err
 			}
 		}
 		if flowsChanged {
 			if err := agent.updateLogicalDeviceFlowsWithoutLock(ctx, &ofp.Flows{Items: flows}); err != nil {
-				log.Errorw("cannot-update-flow", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+				logger.Errorw("cannot-update-flow", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 				return err
 			}
 		}
@@ -1358,7 +1358,7 @@
 		// Wait for completion
 		go func() {
 			if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChnls...); res != nil {
-				log.Warnw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
+				logger.Warnw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
 				//TODO: Revert flow changes
 			}
 		}()
@@ -1367,7 +1367,7 @@
 }
 
 func (agent *LogicalDeviceAgent) groupModify(ctx context.Context, groupMod *ofp.OfpGroupMod) error {
-	log.Debug("groupModify")
+	logger.Debug("groupModify")
 	if groupMod == nil {
 		return nil
 	}
@@ -1395,10 +1395,10 @@
 		fg.AddGroup(fu.GroupEntryFromGroupMod(groupMod))
 		deviceRules.AddFlowsAndGroup(agent.rootDeviceID, fg)
 
-		log.Debugw("rules", log.Fields{"rules for group-modify": deviceRules.String()})
+		logger.Debugw("rules", log.Fields{"rules for group-modify": deviceRules.String()})
 
 		if err := agent.updateLogicalDeviceFlowGroupsWithoutLock(ctx, &ofp.FlowGroups{Items: groups}); err != nil {
-			log.Errorw("Cannot-update-logical-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("Cannot-update-logical-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 
@@ -1408,7 +1408,7 @@
 		// Wait for completion
 		go func() {
 			if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChnls...); res != nil {
-				log.Warnw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
+				logger.Warnw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
 				//TODO: Revert flow changes
 			}
 		}()
@@ -1436,9 +1436,9 @@
 		copy(logicalDevice.Ports[index:], logicalDevice.Ports[index+1:])
 		logicalDevice.Ports[len(logicalDevice.Ports)-1] = nil
 		logicalDevice.Ports = logicalDevice.Ports[:len(logicalDevice.Ports)-1]
-		log.Debugw("logical-port-deleted", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		logger.Debugw("logical-port-deleted", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 		if err := agent.updateLogicalDeviceWithoutLock(ctx, logicalDevice); err != nil {
-			log.Errorw("logical-device-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+			logger.Errorw("logical-device-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 
@@ -1448,7 +1448,7 @@
 		// Reset the logical device routes
 		go func() {
 			if err := agent.buildRoutes(context.Background()); err != nil {
-				log.Warnw("device-routes-not-ready", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
+				logger.Warnw("device-routes-not-ready", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 			}
 		}()
 	}
@@ -1474,9 +1474,9 @@
 	}
 	logicalDevice.Ports = lPortstoKeep
 
-	log.Debugw("updated-logical-ports", log.Fields{"ports": lPortstoKeep})
+	logger.Debugw("updated-logical-ports", log.Fields{"ports": lPortstoKeep})
 	if err := agent.updateLogicalDeviceWithoutLock(ctx, logicalDevice); err != nil {
-		log.Errorw("logical-device-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		logger.Errorw("logical-device-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 		return err
 	}
 	// Remove the port from the cached logical ports set
@@ -1485,7 +1485,7 @@
 	// Reset the logical device routes
 	go func() {
 		if err := agent.buildRoutes(context.Background()); err != nil {
-			log.Warnw("routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
+			logger.Warnw("routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
 		}
 	}()
 
@@ -1539,9 +1539,9 @@
 }
 
 func (agent *LogicalDeviceAgent) getPreCalculatedRoute(ingress, egress uint32) ([]route.Hop, error) {
-	log.Debugw("ROUTE", log.Fields{"len": len(agent.deviceRoutes.Routes)})
+	logger.Debugw("ROUTE", log.Fields{"len": len(agent.deviceRoutes.Routes)})
 	for routeLink, route := range agent.deviceRoutes.Routes {
-		log.Debugw("ROUTELINKS", log.Fields{"ingress": ingress, "egress": egress, "routelink": routeLink})
+		logger.Debugw("ROUTELINKS", log.Fields{"ingress": ingress, "egress": egress, "routelink": routeLink})
 		if ingress == routeLink.Ingress && egress == routeLink.Egress {
 			return route, nil
 		}
@@ -1551,14 +1551,14 @@
 
 // GetRoute returns route
 func (agent *LogicalDeviceAgent) GetRoute(ctx context.Context, ingressPortNo uint32, egressPortNo uint32) ([]route.Hop, error) {
-	log.Debugw("getting-route", log.Fields{"ingress-port": ingressPortNo, "egress-port": egressPortNo})
+	logger.Debugw("getting-route", log.Fields{"ingress-port": ingressPortNo, "egress-port": egressPortNo})
 	routes := make([]route.Hop, 0)
 
 	// Note: A port value of 0 is equivalent to a nil port
 
 	//	Consider different possibilities
 	if egressPortNo != 0 && ((egressPortNo & 0x7fffffff) == uint32(ofp.OfpPortNo_OFPP_CONTROLLER)) {
-		log.Debugw("controller-flow", log.Fields{"ingressPortNo": ingressPortNo, "egressPortNo": egressPortNo, "logicalPortsNo": agent.logicalPortsNo})
+		logger.Debugw("controller-flow", log.Fields{"ingressPortNo": ingressPortNo, "egressPortNo": egressPortNo, "logicalPortsNo": agent.logicalPortsNo})
 		if agent.isNNIPort(ingressPortNo) {
 			//This is a trap on the NNI Port
 			if len(agent.deviceRoutes.Routes) == 0 {
@@ -1582,7 +1582,7 @@
 		//treat it as if the output port is the first NNI of the OLT
 		var err error
 		if egressPortNo, err = agent.getFirstNNIPort(); err != nil {
-			log.Warnw("no-nni-port", log.Fields{"error": err})
+			logger.Warnw("no-nni-port", log.Fields{"error": err})
 			return nil, err
 		}
 	}
@@ -1641,7 +1641,7 @@
 
 //rebuildRoutes rebuilds the device routes
 func (agent *LogicalDeviceAgent) buildRoutes(ctx context.Context) error {
-	log.Debugf("building-routes", log.Fields{"logical-device-id": agent.logicalDeviceID})
+	logger.Debugf("building-routes", log.Fields{"logical-device-id": agent.logicalDeviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -1665,7 +1665,7 @@
 
 //updateRoutes updates the device routes
 func (agent *LogicalDeviceAgent) updateRoutes(ctx context.Context, lp *voltha.LogicalPort) error {
-	log.Debugw("updateRoutes", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+	logger.Debugw("updateRoutes", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return err
 	}
@@ -1724,23 +1724,23 @@
 // the POST_ADD notification is fixed, we will use the logical device to
 // update that data.
 func (agent *LogicalDeviceAgent) portUpdated(ctx context.Context, args ...interface{}) interface{} {
-	log.Debugw("portUpdated-callback", log.Fields{"argsLen": len(args)})
+	logger.Debugw("portUpdated-callback", log.Fields{"argsLen": len(args)})
 
 	var oldLD *voltha.LogicalDevice
 	var newlD *voltha.LogicalDevice
 
 	var ok bool
 	if oldLD, ok = args[0].(*voltha.LogicalDevice); !ok {
-		log.Errorw("invalid-args", log.Fields{"args0": args[0]})
+		logger.Errorw("invalid-args", log.Fields{"args0": args[0]})
 		return nil
 	}
 	if newlD, ok = args[1].(*voltha.LogicalDevice); !ok {
-		log.Errorw("invalid-args", log.Fields{"args1": args[1]})
+		logger.Errorw("invalid-args", log.Fields{"args1": args[1]})
 		return nil
 	}
 
 	if reflect.DeepEqual(oldLD.Ports, newlD.Ports) {
-		log.Debug("ports-have-not-changed")
+		logger.Debug("ports-have-not-changed")
 		return nil
 	}
 
@@ -1769,16 +1769,16 @@
 // (true, nil).   If the device is not in the correct state it will return (false, nil) as this is a valid
 // scenario. This also applies to the case where the port was already added.
 func (agent *LogicalDeviceAgent) addNNILogicalPort(ctx context.Context, device *voltha.Device, port *voltha.Port) (bool, error) {
-	log.Debugw("addNNILogicalPort", log.Fields{"NNI": port})
+	logger.Debugw("addNNILogicalPort", log.Fields{"NNI": port})
 	if device.AdminState != voltha.AdminState_ENABLED || device.OperStatus != voltha.OperStatus_ACTIVE {
-		log.Infow("device-not-ready", log.Fields{"deviceId": device.Id, "admin": device.AdminState, "oper": device.OperStatus})
+		logger.Infow("device-not-ready", log.Fields{"deviceId": device.Id, "admin": device.AdminState, "oper": device.OperStatus})
 		return false, nil
 	}
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
 		return false, err
 	}
 	if agent.portExist(device, port) {
-		log.Debugw("port-already-exist", log.Fields{"port": port})
+		logger.Debugw("port-already-exist", log.Fields{"port": port})
 		agent.requestQueue.RequestComplete()
 		return false, nil
 	}
@@ -1788,7 +1788,7 @@
 	var err error
 	// First get the port capability
 	if portCap, err = agent.deviceMgr.getPortCapability(ctx, device.Id, port.PortNo); err != nil {
-		log.Errorw("error-retrieving-port-capabilities", log.Fields{"error": err})
+		logger.Errorw("error-retrieving-port-capabilities", log.Fields{"error": err})
 		return false, err
 	}
 
@@ -1799,7 +1799,7 @@
 	defer agent.requestQueue.RequestComplete()
 	// Double check again if this port has been already added since the getPortCapability could have taken a long time
 	if agent.portExist(device, port) {
-		log.Debugw("port-already-exist", log.Fields{"port": port})
+		logger.Debugw("port-already-exist", log.Fields{"port": port})
 		return false, nil
 	}
 
@@ -1820,7 +1820,7 @@
 	cloned.Ports = append(cloned.Ports, lp)
 
 	if err = agent.updateLogicalDeviceWithoutLock(ctx, cloned); err != nil {
-		log.Errorw("error-updating-logical-device", log.Fields{"error": err})
+		logger.Errorw("error-updating-logical-device", log.Fields{"error": err})
 		return false, err
 	}
 
@@ -1828,7 +1828,7 @@
 	clonedLP := (proto.Clone(lp)).(*voltha.LogicalPort)
 	go func() {
 		if err := agent.updateRoutes(context.Background(), clonedLP); err != nil {
-			log.Warnw("routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "logical-port": lp.OfpPort.PortNo, "error": err})
+			logger.Warnw("routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "logical-port": lp.OfpPort.PortNo, "error": err})
 		}
 	}()
 
@@ -1850,9 +1850,9 @@
 // (true, nil).   If the device is not in the correct state it will return (false, nil) as this is a valid
 // scenario. This also applies to the case where the port was already added.
 func (agent *LogicalDeviceAgent) addUNILogicalPort(ctx context.Context, childDevice *voltha.Device, port *voltha.Port) (bool, error) {
-	log.Debugw("addUNILogicalPort", log.Fields{"port": port})
+	logger.Debugw("addUNILogicalPort", log.Fields{"port": port})
 	if childDevice.AdminState != voltha.AdminState_ENABLED || childDevice.OperStatus != voltha.OperStatus_ACTIVE {
-		log.Infow("device-not-ready", log.Fields{"deviceId": childDevice.Id, "admin": childDevice.AdminState, "oper": childDevice.OperStatus})
+		logger.Infow("device-not-ready", log.Fields{"deviceId": childDevice.Id, "admin": childDevice.AdminState, "oper": childDevice.OperStatus})
 		return false, nil
 	}
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
@@ -1860,7 +1860,7 @@
 	}
 
 	if agent.portExist(childDevice, port) {
-		log.Debugw("port-already-exist", log.Fields{"port": port})
+		logger.Debugw("port-already-exist", log.Fields{"port": port})
 		agent.requestQueue.RequestComplete()
 		return false, nil
 	}
@@ -1869,7 +1869,7 @@
 	var err error
 	// First get the port capability
 	if portCap, err = agent.deviceMgr.getPortCapability(ctx, childDevice.Id, port.PortNo); err != nil {
-		log.Errorw("error-retrieving-port-capabilities", log.Fields{"error": err})
+		logger.Errorw("error-retrieving-port-capabilities", log.Fields{"error": err})
 		return false, err
 	}
 	if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
@@ -1878,13 +1878,13 @@
 	defer agent.requestQueue.RequestComplete()
 	// Double check again if this port has been already added since the getPortCapability could have taken a long time
 	if agent.portExist(childDevice, port) {
-		log.Debugw("port-already-exist", log.Fields{"port": port})
+		logger.Debugw("port-already-exist", log.Fields{"port": port})
 		return false, nil
 	}
 	// Get stored logical device
 	ldevice := agent.getLogicalDeviceWithoutLock()
 
-	log.Debugw("adding-uni", log.Fields{"deviceId": childDevice.Id})
+	logger.Debugw("adding-uni", log.Fields{"deviceId": childDevice.Id})
 	portCap.Port.RootPort = false
 	portCap.Port.Id = port.Label
 	portCap.Port.OfpPort.PortNo = port.PortNo
@@ -1903,7 +1903,7 @@
 
 	go func() {
 		if err := agent.updateRoutes(context.Background(), clonedLP); err != nil {
-			log.Warn("routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
+			logger.Warn("routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
 		}
 	}()
 
@@ -1911,7 +1911,7 @@
 }
 
 func (agent *LogicalDeviceAgent) packetOut(ctx context.Context, packet *ofp.OfpPacketOut) {
-	log.Debugw("packet-out", log.Fields{
+	logger.Debugw("packet-out", log.Fields{
 		"packet": hex.EncodeToString(packet.Data),
 		"inPort": packet.GetInPort(),
 	})
@@ -1919,19 +1919,19 @@
 	//frame := packet.GetData()
 	//TODO: Use a channel between the logical agent and the device agent
 	if err := agent.deviceMgr.packetOut(ctx, agent.rootDeviceID, outPort, packet); err != nil {
-		log.Error("packetout-failed", log.Fields{"logicalDeviceID": agent.rootDeviceID})
+		logger.Error("packetout-failed", log.Fields{"logicalDeviceID": agent.rootDeviceID})
 	}
 }
 
 func (agent *LogicalDeviceAgent) packetIn(port uint32, transactionID string, packet []byte) {
-	log.Debugw("packet-in", log.Fields{
+	logger.Debugw("packet-in", log.Fields{
 		"port":          port,
 		"packet":        hex.EncodeToString(packet),
 		"transactionId": transactionID,
 	})
 	packetIn := fu.MkPacketIn(port, packet)
 	agent.ldeviceMgr.grpcNbiHdlr.sendPacketIn(agent.logicalDeviceID, transactionID, packetIn)
-	log.Debugw("sending-packet-in", log.Fields{"packet": hex.EncodeToString(packetIn.Data)})
+	logger.Debugw("sending-packet-in", log.Fields{"packet": hex.EncodeToString(packetIn.Data)})
 }
 
 func (agent *LogicalDeviceAgent) addLogicalPortToMap(portNo uint32, nniPort bool) {
diff --git a/rw_core/core/logical_device_agent_test.go b/rw_core/core/logical_device_agent_test.go
index 957bb50..53e355e 100644
--- a/rw_core/core/logical_device_agent_test.go
+++ b/rw_core/core/logical_device_agent_test.go
@@ -22,7 +22,6 @@
 	com "github.com/opencord/voltha-lib-go/v3/pkg/adapters/common"
 	fu "github.com/opencord/voltha-lib-go/v3/pkg/flows"
 	"github.com/opencord/voltha-lib-go/v3/pkg/kafka"
-	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	lm "github.com/opencord/voltha-lib-go/v3/pkg/mocks"
 	ofp "github.com/opencord/voltha-protos/v3/go/openflow_13"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
@@ -377,7 +376,7 @@
 	var err error
 	test.etcdServer, test.kvClientPort, err = startEmbeddedEtcdServer("voltha.rwcore.lda.test", "voltha.rwcore.lda.etcd", "error")
 	if err != nil {
-		log.Fatal(err)
+		logger.Fatal(err)
 	}
 	// Create the kafka client
 	test.kClient = lm.NewKafkaClient()
@@ -454,7 +453,7 @@
 	cfg.InCompetingMode = inCompeteMode
 	grpcPort, err := freeport.GetFreePort()
 	if err != nil {
-		log.Fatal("Cannot get a freeport for grpc")
+		logger.Fatal("Cannot get a freeport for grpc")
 	}
 	cfg.GrpcPort = grpcPort
 	cfg.GrpcHost = "127.0.0.1"
@@ -463,7 +462,7 @@
 	lda.core = NewCore(ctx, lda.coreInstanceID, cfg, client, lda.kClient)
 	err = lda.core.Start(ctx)
 	if err != nil {
-		log.Fatal("Cannot start core")
+		logger.Fatal("Cannot start core")
 	}
 }
 
diff --git a/rw_core/core/logical_device_manager.go b/rw_core/core/logical_device_manager.go
index 1859784..070d4ef 100644
--- a/rw_core/core/logical_device_manager.go
+++ b/rw_core/core/logical_device_manager.go
@@ -64,16 +64,16 @@
 }
 
 func (ldMgr *LogicalDeviceManager) start(ctx context.Context) {
-	log.Info("starting-logical-device-manager")
+	logger.Info("starting-logical-device-manager")
 	probe.UpdateStatusFromContext(ctx, "logical-device-manager", probe.ServiceStatusRunning)
-	log.Info("logical-device-manager-started")
+	logger.Info("logical-device-manager-started")
 }
 
 func (ldMgr *LogicalDeviceManager) stop(ctx context.Context) {
-	log.Info("stopping-logical-device-manager")
+	logger.Info("stopping-logical-device-manager")
 	ldMgr.exitChannel <- 1
 	probe.UpdateStatusFromContext(ctx, "logical-device-manager", probe.ServiceStatusStopped)
-	log.Info("logical-device-manager-stopped")
+	logger.Info("logical-device-manager-stopped")
 }
 
 func sendAPIResponse(ctx context.Context, ch chan interface{}, result interface{}) {
@@ -81,10 +81,10 @@
 		// Returned response only of the ctx has not been cancelled/timeout/etc
 		// Channel is automatically closed when a context is Done
 		ch <- result
-		log.Debugw("sendResponse", log.Fields{"result": result})
+		logger.Debugw("sendResponse", log.Fields{"result": result})
 	} else {
 		// Should the transaction be reverted back?
-		log.Debugw("sendResponse-context-error", log.Fields{"context-error": ctx.Err()})
+		logger.Debugw("sendResponse-context-error", log.Fields{"context-error": ctx.Err()})
 	}
 }
 
@@ -104,7 +104,7 @@
 			// This can happen when an agent for the logical device has been created but the logical device
 			// itself is not ready for action as it is waiting for switch and port capabilities from the
 			// relevant adapter.  In such a case prevent any request aimed at that logical device.
-			log.Debugf("Logical device %s is not ready to serve requests", logicalDeviceID)
+			logger.Debugf("Logical device %s is not ready to serve requests", logicalDeviceID)
 			return nil
 		}
 		return lda
@@ -125,7 +125,7 @@
 // GetLogicalDevice provides a cloned most up to date logical device.  If device is not in memory
 // it will be fetched from the dB
 func (ldMgr *LogicalDeviceManager) getLogicalDevice(ctx context.Context, id string) (*voltha.LogicalDevice, error) {
-	log.Debugw("getlogicalDevice", log.Fields{"logicaldeviceid": id})
+	logger.Debugw("getlogicalDevice", log.Fields{"logicaldeviceid": id})
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id); agent != nil {
 		return agent.GetLogicalDevice(ctx)
 	}
@@ -133,7 +133,7 @@
 }
 
 func (ldMgr *LogicalDeviceManager) listManagedLogicalDevices(ctx context.Context) (*voltha.LogicalDevices, error) {
-	log.Debug("listManagedLogicalDevices")
+	logger.Debug("listManagedLogicalDevices")
 	result := &voltha.LogicalDevices{}
 	ldMgr.logicalDeviceAgents.Range(func(key, value interface{}) bool {
 		agent := value.(*LogicalDeviceAgent)
@@ -148,11 +148,11 @@
 
 //listLogicalDevices returns the list of all logical devices
 func (ldMgr *LogicalDeviceManager) listLogicalDevices(ctx context.Context) (*voltha.LogicalDevices, error) {
-	log.Debug("ListAllLogicalDevices")
+	logger.Debug("ListAllLogicalDevices")
 	result := &voltha.LogicalDevices{}
 	logicalDevices, err := ldMgr.clusterDataProxy.List(ctx, "/logical_devices", 0, true, "")
 	if err != nil {
-		log.Errorw("failed-to-list-logical-devices-from-cluster-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-list-logical-devices-from-cluster-proxy", log.Fields{"error": err})
 		return nil, err
 	}
 	if logicalDevices != nil {
@@ -164,7 +164,7 @@
 }
 
 func (ldMgr *LogicalDeviceManager) createLogicalDevice(ctx context.Context, device *voltha.Device) (*string, error) {
-	log.Debugw("creating-logical-device", log.Fields{"deviceId": device.Id})
+	logger.Debugw("creating-logical-device", log.Fields{"deviceId": device.Id})
 	// Sanity check
 	if !device.Root {
 		return nil, errors.New("device-not-root")
@@ -177,17 +177,17 @@
 	macAddress := device.MacAddress
 	id := strings.Replace(macAddress, ":", "", -1)
 	if id == "" {
-		log.Errorw("mac-address-not-set", log.Fields{"deviceId": device.Id})
+		logger.Errorw("mac-address-not-set", log.Fields{"deviceId": device.Id})
 		return nil, errors.New("mac-address-not-set")
 	}
-	log.Debugw("logical-device-id", log.Fields{"logicaldeviceId": id})
+	logger.Debugw("logical-device-id", log.Fields{"logicaldeviceId": id})
 
 	agent := newLogicalDeviceAgent(id, device.Id, ldMgr, ldMgr.deviceMgr, ldMgr.clusterDataProxy, ldMgr.defaultTimeout)
 	ldMgr.addLogicalDeviceAgentToMap(agent)
 
 	// Update the root device with the logical device Id reference
 	if err := ldMgr.deviceMgr.setParentID(ctx, device, id); err != nil {
-		log.Errorw("failed-setting-parent-id", log.Fields{"logicalDeviceId": id, "deviceId": device.Id})
+		logger.Errorw("failed-setting-parent-id", log.Fields{"logicalDeviceId": id, "deviceId": device.Id})
 		return nil, err
 	}
 
@@ -195,12 +195,12 @@
 		//agent := newLogicalDeviceAgent(id, device.Id, ldMgr, ldMgr.deviceMgr, ldMgr.clusterDataProxy, ldMgr.defaultTimeout)
 		err := agent.start(context.Background(), false)
 		if err != nil {
-			log.Errorw("unable-to-create-the-logical-device", log.Fields{"error": err})
+			logger.Errorw("unable-to-create-the-logical-device", log.Fields{"error": err})
 			ldMgr.deleteLogicalDeviceAgent(id)
 		}
 	}()
 
-	log.Debug("creating-logical-device-ends")
+	logger.Debug("creating-logical-device-ends")
 	return &id, nil
 }
 
@@ -208,15 +208,15 @@
 // reference of this logical device in cache.  The device Id is passed as param because the logical device may already
 // have been removed from the model.  This function returns the logical device Id if found
 func (ldMgr *LogicalDeviceManager) stopManagingLogicalDeviceWithDeviceID(ctx context.Context, id string) string {
-	log.Infow("stop-managing-logical-device", log.Fields{"deviceId": id})
+	logger.Infow("stop-managing-logical-device", log.Fields{"deviceId": id})
 	// Go over the list of logical device agents to find the one which has rootDeviceId as id
 	var ldID = ""
 	ldMgr.logicalDeviceAgents.Range(func(key, value interface{}) bool {
 		ldAgent := value.(*LogicalDeviceAgent)
 		if ldAgent.rootDeviceID == id {
-			log.Infow("stopping-logical-device-agent", log.Fields{"lDeviceId": key})
+			logger.Infow("stopping-logical-device-agent", log.Fields{"lDeviceId": key})
 			if err := ldAgent.stop(ctx); err != nil {
-				log.Errorw("failed-to-stop-LDAgent", log.Fields{"error": err})
+				logger.Errorw("failed-to-stop-LDAgent", log.Fields{"error": err})
 				return false
 			}
 			ldID = key.(string)
@@ -231,7 +231,7 @@
 func (ldMgr *LogicalDeviceManager) getLogicalDeviceFromModel(ctx context.Context, lDeviceID string) (*voltha.LogicalDevice, error) {
 	logicalDevice, err := ldMgr.clusterDataProxy.Get(ctx, "/logical_devices/"+lDeviceID, 0, false, "")
 	if err != nil {
-		log.Errorw("failed-to-get-logical-devices-from-cluster-proxy", log.Fields{"error": err})
+		logger.Errorw("failed-to-get-logical-devices-from-cluster-proxy", log.Fields{"error": err})
 		return nil, err
 	}
 	if logicalDevice != nil {
@@ -254,14 +254,14 @@
 			ldMgr.logicalDeviceLoadingInProgress[lDeviceID] = []chan int{make(chan int, 1)}
 			ldMgr.logicalDevicesLoadingLock.Unlock()
 			if _, err := ldMgr.getLogicalDeviceFromModel(ctx, lDeviceID); err == nil {
-				log.Debugw("loading-logical-device", log.Fields{"lDeviceId": lDeviceID})
+				logger.Debugw("loading-logical-device", log.Fields{"lDeviceId": lDeviceID})
 				agent := newLogicalDeviceAgent(lDeviceID, "", ldMgr, ldMgr.deviceMgr, ldMgr.clusterDataProxy, ldMgr.defaultTimeout)
 				if err := agent.start(ctx, true); err != nil {
 					return err
 				}
 				ldMgr.logicalDeviceAgents.Store(agent.logicalDeviceID, agent)
 			} else {
-				log.Debugw("logicalDevice not in model", log.Fields{"lDeviceId": lDeviceID})
+				logger.Debugw("logicalDevice not in model", log.Fields{"lDeviceId": lDeviceID})
 			}
 			// announce completion of task to any number of waiting channels
 			ldMgr.logicalDevicesLoadingLock.Lock()
@@ -289,7 +289,7 @@
 }
 
 func (ldMgr *LogicalDeviceManager) deleteLogicalDevice(ctx context.Context, device *voltha.Device) error {
-	log.Debugw("deleting-logical-device", log.Fields{"deviceId": device.Id})
+	logger.Debugw("deleting-logical-device", log.Fields{"deviceId": device.Id})
 	// Sanity check
 	if !device.Root {
 		return errors.New("device-not-root")
@@ -298,18 +298,18 @@
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, logDeviceID); agent != nil {
 		// Stop the logical device agent
 		if err := agent.stop(ctx); err != nil {
-			log.Errorw("failed-to-stop-agent", log.Fields{"error": err})
+			logger.Errorw("failed-to-stop-agent", log.Fields{"error": err})
 			return err
 		}
 		//Remove the logical device agent from the Map
 		ldMgr.deleteLogicalDeviceAgent(logDeviceID)
 		err := ldMgr.core.deviceOwnership.AbandonDevice(logDeviceID)
 		if err != nil {
-			log.Errorw("unable-to-abandon-the-device", log.Fields{"error": err})
+			logger.Errorw("unable-to-abandon-the-device", log.Fields{"error": err})
 		}
 	}
 
-	log.Debug("deleting-logical-device-ends")
+	logger.Debug("deleting-logical-device-ends")
 	return nil
 }
 
@@ -359,7 +359,7 @@
 
 // ListLogicalDeviceFlows returns the flows of logical device
 func (ldMgr *LogicalDeviceManager) ListLogicalDeviceFlows(ctx context.Context, id string) (*openflow_13.Flows, error) {
-	log.Debugw("ListLogicalDeviceFlows", log.Fields{"logicaldeviceid": id})
+	logger.Debugw("ListLogicalDeviceFlows", log.Fields{"logicaldeviceid": id})
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id); agent != nil {
 		return agent.ListLogicalDeviceFlows(ctx)
 	}
@@ -368,7 +368,7 @@
 
 // ListLogicalDeviceFlowGroups returns logical device flow groups
 func (ldMgr *LogicalDeviceManager) ListLogicalDeviceFlowGroups(ctx context.Context, id string) (*openflow_13.FlowGroups, error) {
-	log.Debugw("ListLogicalDeviceFlowGroups", log.Fields{"logicaldeviceid": id})
+	logger.Debugw("ListLogicalDeviceFlowGroups", log.Fields{"logicaldeviceid": id})
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id); agent != nil {
 		return agent.ListLogicalDeviceFlowGroups(ctx)
 	}
@@ -377,7 +377,7 @@
 
 // ListLogicalDevicePorts returns logical device ports
 func (ldMgr *LogicalDeviceManager) ListLogicalDevicePorts(ctx context.Context, id string) (*voltha.LogicalPorts, error) {
-	log.Debugw("ListLogicalDevicePorts", log.Fields{"logicaldeviceid": id})
+	logger.Debugw("ListLogicalDevicePorts", log.Fields{"logicaldeviceid": id})
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id); agent != nil {
 		return agent.ListLogicalDevicePorts(ctx)
 	}
@@ -419,12 +419,12 @@
 
 // deleteLogicalPort removes the logical port associated with a device
 func (ldMgr *LogicalDeviceManager) deleteLogicalPort(ctx context.Context, lPortID *voltha.LogicalPortId) error {
-	log.Debugw("deleting-logical-port", log.Fields{"LDeviceId": lPortID.Id})
+	logger.Debugw("deleting-logical-port", log.Fields{"LDeviceId": lPortID.Id})
 	// Get logical port
 	var logicalPort *voltha.LogicalPort
 	var err error
 	if logicalPort, err = ldMgr.getLogicalPort(ctx, lPortID); err != nil {
-		log.Debugw("no-logical-device-port-present", log.Fields{"logicalPortId": lPortID.PortId})
+		logger.Debugw("no-logical-device-port-present", log.Fields{"logicalPortId": lPortID.PortId})
 		return err
 	}
 	// Sanity check
@@ -433,17 +433,17 @@
 	}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, lPortID.Id); agent != nil {
 		if err := agent.deleteLogicalPort(ctx, logicalPort); err != nil {
-			log.Warnw("deleting-logicalport-failed", log.Fields{"LDeviceId": lPortID.Id, "error": err})
+			logger.Warnw("deleting-logicalport-failed", log.Fields{"LDeviceId": lPortID.Id, "error": err})
 		}
 	}
 
-	log.Debug("deleting-logical-port-ends")
+	logger.Debug("deleting-logical-port-ends")
 	return nil
 }
 
 // deleteLogicalPort removes the logical port associated with a child device
 func (ldMgr *LogicalDeviceManager) deleteLogicalPorts(ctx context.Context, deviceID string) error {
-	log.Debugw("deleting-logical-ports", log.Fields{"deviceId": deviceID})
+	logger.Debugw("deleting-logical-ports", log.Fields{"deviceId": deviceID})
 	// Get logical port
 	ldID, err := ldMgr.getLogicalDeviceIDFromDeviceID(ctx, deviceID)
 	if err != nil {
@@ -451,16 +451,16 @@
 	}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, *ldID); agent != nil {
 		if err = agent.deleteLogicalPorts(ctx, deviceID); err != nil {
-			log.Warnw("deleteLogicalPorts-failed", log.Fields{"ldeviceId": *ldID})
+			logger.Warnw("deleteLogicalPorts-failed", log.Fields{"ldeviceId": *ldID})
 			return err
 		}
 	}
-	log.Debug("deleting-logical-port-ends")
+	logger.Debug("deleting-logical-port-ends")
 	return nil
 }
 
 func (ldMgr *LogicalDeviceManager) setupUNILogicalPorts(ctx context.Context, childDevice *voltha.Device) error {
-	log.Debugw("setupUNILogicalPorts", log.Fields{"childDeviceId": childDevice.Id, "parentDeviceId": childDevice.ParentId, "current-data": childDevice})
+	logger.Debugw("setupUNILogicalPorts", log.Fields{"childDeviceId": childDevice.Id, "parentDeviceId": childDevice.ParentId, "current-data": childDevice})
 	// Sanity check
 	if childDevice.Root {
 		return errors.New("Device-root")
@@ -470,7 +470,7 @@
 	parentID := childDevice.ParentId
 	logDeviceID := ldMgr.deviceMgr.GetParentDeviceID(ctx, parentID)
 
-	log.Debugw("setupUNILogicalPorts", log.Fields{"logDeviceId": logDeviceID, "parentId": parentID})
+	logger.Debugw("setupUNILogicalPorts", log.Fields{"logDeviceId": logDeviceID, "parentId": parentID})
 
 	if parentID == "" || logDeviceID == "" {
 		return errors.New("device-in-invalid-state")
@@ -485,13 +485,13 @@
 }
 
 func (ldMgr *LogicalDeviceManager) deleteAllLogicalPorts(ctx context.Context, device *voltha.Device) error {
-	log.Debugw("deleteAllLogicalPorts", log.Fields{"deviceId": device.Id})
+	logger.Debugw("deleteAllLogicalPorts", log.Fields{"deviceId": device.Id})
 
 	var ldID *string
 	var err error
 	//Get the logical device Id for this device
 	if ldID, err = ldMgr.getLogicalDeviceID(ctx, device); err != nil {
-		log.Warnw("no-logical-device-found", log.Fields{"deviceId": device.Id, "error": err})
+		logger.Warnw("no-logical-device-found", log.Fields{"deviceId": device.Id, "error": err})
 		return err
 	}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, *ldID); agent != nil {
@@ -503,7 +503,7 @@
 }
 
 func (ldMgr *LogicalDeviceManager) deleteAllUNILogicalPorts(ctx context.Context, parentDevice *voltha.Device) error {
-	log.Debugw("delete-all-uni-logical-ports", log.Fields{"parent-device-id": parentDevice.Id})
+	logger.Debugw("delete-all-uni-logical-ports", log.Fields{"parent-device-id": parentDevice.Id})
 
 	var ldID *string
 	var err error
@@ -520,13 +520,13 @@
 }
 
 func (ldMgr *LogicalDeviceManager) updatePortState(ctx context.Context, deviceID string, portNo uint32, state voltha.OperStatus_Types) error {
-	log.Debugw("updatePortState", log.Fields{"deviceId": deviceID, "state": state, "portNo": portNo})
+	logger.Debugw("updatePortState", log.Fields{"deviceId": deviceID, "state": state, "portNo": portNo})
 
 	var ldID *string
 	var err error
 	//Get the logical device Id for this device
 	if ldID, err = ldMgr.getLogicalDeviceIDFromDeviceID(ctx, deviceID); err != nil {
-		log.Warnw("no-logical-device-found", log.Fields{"deviceId": deviceID, "error": err})
+		logger.Warnw("no-logical-device-found", log.Fields{"deviceId": deviceID, "error": err})
 		return err
 	}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, *ldID); agent != nil {
@@ -538,13 +538,13 @@
 }
 
 func (ldMgr *LogicalDeviceManager) updatePortsState(ctx context.Context, device *voltha.Device, state voltha.OperStatus_Types) error {
-	log.Debugw("updatePortsState", log.Fields{"deviceId": device.Id, "state": state, "current-data": device})
+	logger.Debugw("updatePortsState", log.Fields{"deviceId": device.Id, "state": state, "current-data": device})
 
 	var ldID *string
 	var err error
 	//Get the logical device Id for this device
 	if ldID, err = ldMgr.getLogicalDeviceID(ctx, device); err != nil {
-		log.Warnw("no-logical-device-found", log.Fields{"deviceId": device.Id, "error": err})
+		logger.Warnw("no-logical-device-found", log.Fields{"deviceId": device.Id, "error": err})
 		return err
 	}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, *ldID); agent != nil {
@@ -556,11 +556,11 @@
 }
 
 func (ldMgr *LogicalDeviceManager) updateFlowTable(ctx context.Context, id string, flow *openflow_13.OfpFlowMod, ch chan interface{}) {
-	log.Debugw("updateFlowTable", log.Fields{"logicalDeviceId": id})
+	logger.Debugw("updateFlowTable", log.Fields{"logicalDeviceId": id})
 	var res interface{}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id); agent != nil {
 		res = agent.updateFlowTable(ctx, flow)
-		log.Debugw("updateFlowTable-result", log.Fields{"result": res})
+		logger.Debugw("updateFlowTable-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id)
 	}
@@ -568,11 +568,11 @@
 }
 
 func (ldMgr *LogicalDeviceManager) updateMeterTable(ctx context.Context, id string, meter *openflow_13.OfpMeterMod, ch chan interface{}) {
-	log.Debugw("updateMeterTable", log.Fields{"logicalDeviceId": id})
+	logger.Debugw("updateMeterTable", log.Fields{"logicalDeviceId": id})
 	var res interface{}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id); agent != nil {
 		res = agent.updateMeterTable(ctx, meter)
-		log.Debugw("updateMeterTable-result", log.Fields{"result": res})
+		logger.Debugw("updateMeterTable-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id)
 	}
@@ -581,18 +581,18 @@
 
 // ListLogicalDeviceMeters returns logical device meters
 func (ldMgr *LogicalDeviceManager) ListLogicalDeviceMeters(ctx context.Context, id string) (*openflow_13.Meters, error) {
-	log.Debugw("ListLogicalDeviceMeters", log.Fields{"logicalDeviceId": id})
+	logger.Debugw("ListLogicalDeviceMeters", log.Fields{"logicalDeviceId": id})
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id); agent != nil {
 		return agent.ListLogicalDeviceMeters(ctx)
 	}
 	return nil, status.Errorf(codes.NotFound, "%s", id)
 }
 func (ldMgr *LogicalDeviceManager) updateGroupTable(ctx context.Context, id string, groupMod *openflow_13.OfpGroupMod, ch chan interface{}) {
-	log.Debugw("updateGroupTable", log.Fields{"logicalDeviceId": id})
+	logger.Debugw("updateGroupTable", log.Fields{"logicalDeviceId": id})
 	var res interface{}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id); agent != nil {
 		res = agent.updateGroupTable(ctx, groupMod)
-		log.Debugw("updateGroupTable-result", log.Fields{"result": res})
+		logger.Debugw("updateGroupTable-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id)
 	}
@@ -600,11 +600,11 @@
 }
 
 func (ldMgr *LogicalDeviceManager) enableLogicalPort(ctx context.Context, id *voltha.LogicalPortId, ch chan interface{}) {
-	log.Debugw("enableLogicalPort", log.Fields{"logicalDeviceId": id})
+	logger.Debugw("enableLogicalPort", log.Fields{"logicalDeviceId": id})
 	var res interface{}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id); agent != nil {
 		res = agent.enableLogicalPort(ctx, id.PortId)
-		log.Debugw("enableLogicalPort-result", log.Fields{"result": res})
+		logger.Debugw("enableLogicalPort-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id.Id)
 	}
@@ -612,11 +612,11 @@
 }
 
 func (ldMgr *LogicalDeviceManager) disableLogicalPort(ctx context.Context, id *voltha.LogicalPortId, ch chan interface{}) {
-	log.Debugw("disableLogicalPort", log.Fields{"logicalDeviceId": id})
+	logger.Debugw("disableLogicalPort", log.Fields{"logicalDeviceId": id})
 	var res interface{}
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id); agent != nil {
 		res = agent.disableLogicalPort(ctx, id.PortId)
-		log.Debugw("disableLogicalPort-result", log.Fields{"result": res})
+		logger.Debugw("disableLogicalPort-result", log.Fields{"result": res})
 	} else {
 		res = status.Errorf(codes.NotFound, "%s", id.Id)
 	}
@@ -624,11 +624,11 @@
 }
 
 func (ldMgr *LogicalDeviceManager) packetIn(ctx context.Context, logicalDeviceID string, port uint32, transactionID string, packet []byte) error {
-	log.Debugw("packetIn", log.Fields{"logicalDeviceId": logicalDeviceID, "port": port})
+	logger.Debugw("packetIn", log.Fields{"logicalDeviceId": logicalDeviceID, "port": port})
 	if agent := ldMgr.getLogicalDeviceAgent(ctx, logicalDeviceID); agent != nil {
 		agent.packetIn(port, transactionID, packet)
 	} else {
-		log.Error("logical-device-not-exist", log.Fields{"logicalDeviceId": logicalDeviceID})
+		logger.Error("logical-device-not-exist", log.Fields{"logicalDeviceId": logicalDeviceID})
 	}
 	return nil
 }
diff --git a/rw_core/core/transaction.go b/rw_core/core/transaction.go
index fc55683..a353ef2 100644
--- a/rw_core/core/transaction.go
+++ b/rw_core/core/transaction.go
@@ -88,13 +88,6 @@
 	"ABANDONED-BY-OTHER",
 	"ABANDONED_WATCH_BY_SELF"}
 
-func init() {
-	_, err := log.AddPackage(log.JSON, log.DebugLevel, nil)
-	if err != nil {
-		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
-	}
-}
-
 // NewTransactionContext creates transaction context instance
 func NewTransactionContext(
 	owner string,
@@ -201,7 +194,7 @@
 		if err := c.tryToReserveTxn(ctx, durationInSecs*2); err == nil {
 			res = SeizedBySelf
 		} else {
-			log.Debugw("watch-other-server",
+			logger.Debugw("watch-other-server",
 				log.Fields{"transactionId": c.txnID, "owner": currOwner, "timeout": durationInSecs})
 			res = c.Watch(ctx, durationInSecs)
 		}
@@ -214,7 +207,7 @@
 	default:
 		acquired = false
 	}
-	log.Debugw("acquire-transaction-status", log.Fields{"transactionId": c.txnID, "acquired": acquired, "result": txnState[res]})
+	logger.Debugw("acquire-transaction-status", log.Fields{"transactionId": c.txnID, "acquired": acquired, "result": txnState[res]})
 	return acquired, nil
 }
 
@@ -225,11 +218,11 @@
 	value, _ := ctx.kvClient.Reserve(ctxt, c.txnKey, ctx.owner, durationInSecs)
 	if value != nil {
 		if currOwner, err = kvstore.ToString(value); err != nil { // This should never happen
-			log.Errorw("unexpected-owner-type", log.Fields{"transactionId": c.txnID, "error": err})
+			logger.Errorw("unexpected-owner-type", log.Fields{"transactionId": c.txnID, "error": err})
 			return err
 		}
 		if currOwner == ctx.owner {
-			log.Debugw("acquired-transaction", log.Fields{"transactionId": c.txnID, "result": txnState[res]})
+			logger.Debugw("acquired-transaction", log.Fields{"transactionId": c.txnID, "result": txnState[res]})
 			// Setup the monitoring channel
 			c.monitorCh = make(chan int)
 			go c.holdOnToTxnUntilProcessingCompleted(ctxt, c.txnKey, ctx.owner, durationInSecs)
@@ -256,14 +249,14 @@
 				// Do an immediate delete of the transaction in the KV Store to free up KV Storage faster
 				err = c.Delete(ctxt)
 				if err != nil {
-					log.Errorw("unable-to-delete-the-transaction", log.Fields{"error": err})
+					logger.Errorw("unable-to-delete-the-transaction", log.Fields{"error": err})
 				}
 				return res
 			}
 		} else {
 			// An unexpected value - let's get out of here as something did not go according to plan
 			res = AbandonedWatchBySelf
-			log.Debugw("cannot-read-transaction-value", log.Fields{"txn": c.txnID, "error": err})
+			logger.Debugw("cannot-read-transaction-value", log.Fields{"txn": c.txnID, "error": err})
 			return res
 		}
 	}
@@ -272,7 +265,7 @@
 		select {
 		case event := <-events:
 			transactionWasAcquiredByOther = true
-			log.Debugw("received-event", log.Fields{"txn": c.txnID, "type": event.EventType})
+			logger.Debugw("received-event", log.Fields{"txn": c.txnID, "type": event.EventType})
 			if event.EventType == kvstore.DELETE {
 				// The other core failed to process the request
 				res = AbandonedByOther
@@ -285,14 +278,14 @@
 						// Successful request completion has been detected. Remove the transaction key
 						err := c.Delete(ctxt)
 						if err != nil {
-							log.Errorw("unable-to-delete-the-transaction", log.Fields{"error": err})
+							logger.Errorw("unable-to-delete-the-transaction", log.Fields{"error": err})
 						}
 					} else {
-						log.Debugw("Ignoring-PUT-event", log.Fields{"val": val, "key": key})
+						logger.Debugw("Ignoring-PUT-event", log.Fields{"val": val, "key": key})
 						continue
 					}
 				} else {
-					log.Warnw("received-unexpected-PUT-event", log.Fields{"txn": c.txnID, "key": key, "ctxKey": c.txnKey})
+					logger.Warnw("received-unexpected-PUT-event", log.Fields{"txn": c.txnID, "key": key, "ctxKey": c.txnKey})
 				}
 			}
 		case <-time.After(time.Duration(durationInSecs) * time.Second):
@@ -303,7 +296,7 @@
 			// guarantee that the peer is actually gone instead of limiting the time the peer can get hold of a
 			// request.
 			if !transactionWasAcquiredByOther {
-				log.Debugw("timeout-no-peer", log.Fields{"txId": c.txnID})
+				logger.Debugw("timeout-no-peer", log.Fields{"txId": c.txnID})
 				res = AbandonedByOther
 			} else {
 				continue
@@ -316,14 +309,14 @@
 
 // Close closes transaction
 func (c *KVTransaction) Close(ctxt context.Context) error {
-	log.Debugw("close", log.Fields{"txn": c.txnID})
+	logger.Debugw("close", log.Fields{"txn": c.txnID})
 	// Stop monitoring the key (applies only when there has been no transaction switch over)
 	if c.monitorCh != nil {
 		close(c.monitorCh)
 		err := ctx.kvClient.Put(ctxt, c.txnKey, TransactionComplete)
 
 		if err != nil {
-			log.Errorw("unable-to-write-a-key-value-pair-to-the-KV-store", log.Fields{"error": err})
+			logger.Errorw("unable-to-write-a-key-value-pair-to-the-KV-store", log.Fields{"error": err})
 		}
 	}
 	return nil
@@ -331,7 +324,7 @@
 
 // Delete deletes transaction
 func (c *KVTransaction) Delete(ctxt context.Context) error {
-	log.Debugw("delete", log.Fields{"txn": c.txnID})
+	logger.Debugw("delete", log.Fields{"txn": c.txnID})
 	return ctx.kvClient.Delete(ctxt, c.txnKey)
 }
 
@@ -339,7 +332,7 @@
 // is used to calculate the frequency at which the Core processing the transaction renews the lease.  This function
 // exits only when the transaction is Closed, i.e completed.
 func (c *KVTransaction) holdOnToTxnUntilProcessingCompleted(ctxt context.Context, key string, owner string, durationInSecs int64) {
-	log.Debugw("holdOnToTxnUntilProcessingCompleted", log.Fields{"txn": c.txnID})
+	logger.Debugw("holdOnToTxnUntilProcessingCompleted", log.Fields{"txn": c.txnID})
 	renewInterval := durationInSecs / NumTxnRenewalPerRequest
 	if renewInterval < MinTxnRenewalIntervalInSec {
 		renewInterval = MinTxnRenewalIntervalInSec
@@ -348,12 +341,12 @@
 	for {
 		select {
 		case <-c.monitorCh:
-			log.Debugw("transaction-renewal-exits", log.Fields{"txn": c.txnID})
+			logger.Debugw("transaction-renewal-exits", log.Fields{"txn": c.txnID})
 			break forLoop
 		case <-time.After(time.Duration(renewInterval) * time.Second):
 			if err := ctx.kvClient.RenewReservation(ctxt, c.txnKey); err != nil {
 				// Log and continue.
-				log.Warnw("transaction-renewal-failed", log.Fields{"txnId": c.txnKey, "error": err})
+				logger.Warnw("transaction-renewal-failed", log.Fields{"txnId": c.txnKey, "error": err})
 			}
 		}
 	}
