Update debug and error logs

loggers^2
parent b58b8c931b
commit a6a9e82c35

@ -419,26 +419,32 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager {
@Override @Override
public void deleteDeviceLocation(Device device) throws DeviceDetailsMgtException { public void deleteDeviceLocation(Device device) throws DeviceDetailsMgtException {
try { try {
if (log.isDebugEnabled()) {
log.debug("Deleting device location for device: " + device.getId());
}
DeviceManagementDAOFactory.beginTransaction(); DeviceManagementDAOFactory.beginTransaction();
DeviceLocation deviceLocation = deviceDetailsDAO.getDeviceLocation(device.getId(), DeviceLocation deviceLocation = deviceDetailsDAO.getDeviceLocation(device.getId(),
device.getEnrolmentInfo().getId()); device.getEnrolmentInfo().getId());
if (deviceLocation != null) { if (deviceLocation != null) {
deviceDetailsDAO.deleteDeviceLocation(device.getId(), device.getEnrolmentInfo().getId()); deviceDetailsDAO.deleteDeviceLocation(device.getId(), device.getEnrolmentInfo().getId());
} else { } else {
throw new DeviceDetailsMgtException("Device location not found."); log.error("Device location not found for device: " + device.getId());
throw new DeviceDetailsMgtException("Device location not found for device: " + device.getId());
} }
DeviceManagementDAOFactory.commitTransaction(); DeviceManagementDAOFactory.commitTransaction();
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
throw new DeviceDetailsMgtException("Transactional error occurred while deleting the device location " + "information.", e); log.error("Transactional error occurred while deleting the device location information. Device ID: " + device.getId(), e);
throw new DeviceDetailsMgtException("Transactional error occurred while deleting the device location " +
"information.", e);
} catch (DeviceDetailsMgtDAOException e) { } catch (DeviceDetailsMgtDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction(); DeviceManagementDAOFactory.rollbackTransaction();
log.error("Error occurred while deleting the device location information. Device ID: " + device.getId(), e);
throw new DeviceDetailsMgtException("Error occurred while deleting the device location information.", e); throw new DeviceDetailsMgtException("Error occurred while deleting the device location information.", e);
} finally { } finally {
DeviceManagementDAOFactory.closeConnection(); DeviceManagementDAOFactory.closeConnection();
} }
} }
@Override @Override
public void addDeviceLocations(Device device, List<DeviceLocation> deviceLocations) throws DeviceDetailsMgtException { public void addDeviceLocations(Device device, List<DeviceLocation> deviceLocations) throws DeviceDetailsMgtException {
try { try {

Loading…
Cancel
Save