From f7f686e0dd9526d7c6344a24f836ef4a8e226de0 Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Thu, 23 Jul 2020 10:28:18 -0400 Subject: [PATCH] add debug logging to device security settings --- .../java/bubble/service/cloud/StandardDeviceIdService.java | 7 +++++-- bubble-server/src/main/resources/logback.xml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bubble-server/src/main/java/bubble/service/cloud/StandardDeviceIdService.java b/bubble-server/src/main/java/bubble/service/cloud/StandardDeviceIdService.java index 702d4dd7..f74c7084 100644 --- a/bubble-server/src/main/java/bubble/service/cloud/StandardDeviceIdService.java +++ b/bubble-server/src/main/java/bubble/service/cloud/StandardDeviceIdService.java @@ -126,14 +126,17 @@ public class StandardDeviceIdService implements DeviceIdService { @Override public void setDeviceSecurityLevel(Device device) { if (configuration.testMode()) return; for (String ip : findIpsByDevice(device.getUuid())) { - redis.set_plaintext(REDIS_KEY_DEVICE_SECURITY_LEVEL_PREFIX+ip, device.getSecurityLevel().name()); + if (log.isDebugEnabled()) log.debug("setDeviceSecurityLevel("+device.getName()+") setting "+REDIS_KEY_DEVICE_SECURITY_LEVEL_PREFIX+ip+" = "+device.getSecurityLevel().name()); + redis.set_plaintext(REDIS_KEY_DEVICE_SECURITY_LEVEL_PREFIX + ip, device.getSecurityLevel().name()); for (AppSite site : siteDAO.findByAccount(device.getAccount())) { + final String siteKey = REDIS_KEY_DEVICE_SITE_MAX_SECURITY_LEVEL_PREFIX + ip; if (site.hasMaxSecurityHosts()) { - final String siteKey = REDIS_KEY_DEVICE_SITE_MAX_SECURITY_LEVEL_PREFIX + ip; if (site.enableMaxSecurityHosts()) { + if (log.isDebugEnabled()) log.debug("setDeviceSecurityLevel("+device.getName()+") adding to "+REDIS_KEY_DEVICE_SITE_MAX_SECURITY_LEVEL_PREFIX+ip+": "+ site.getMaxSecurityHostsJson()); redis.sadd_plaintext(siteKey, site.getMaxSecurityHosts()); } else { + if (log.isDebugEnabled()) log.debug("setDeviceSecurityLevel("+device.getName()+") removing from "+REDIS_KEY_DEVICE_SITE_MAX_SECURITY_LEVEL_PREFIX+ip+": "+ site.getMaxSecurityHostsJson()); redis.srem(siteKey, site.getMaxSecurityHosts()); } } diff --git a/bubble-server/src/main/resources/logback.xml b/bubble-server/src/main/resources/logback.xml index 4285f4fe..95187ddd 100644 --- a/bubble-server/src/main/resources/logback.xml +++ b/bubble-server/src/main/resources/logback.xml @@ -62,6 +62,7 @@ +