100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Logging improvements
Rich Turner166e82f8b15d
diff --git a/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java b/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.javaindex 751b65816..25170ae4a 100644--- a/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java+++ b/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java@@ -350,11 +350,12 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {grant.setTokenEndpointUri(getTokenUri("master").toString());}- WebTargetBuilder targetBuilder = new WebTargetBuilder(httpClient, keycloakServiceUri.build())+ URI proxyURI = keycloakServiceUri.build();+ WebTargetBuilder targetBuilder = new WebTargetBuilder(httpClient, proxyURI).setOAuthAuthentication(grant);keycloakTarget = targetBuilder.build();realmsResourcePool.clear();- LOG.info("Keycloak proxy credentials set to: " + grant);+ LOG.info("Keycloak proxy URI set to: " + proxyURI);}protected LoadingCache<KeycloakRealmClient, KeycloakDeployment> createKeycloakDeploymentCache() {diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java b/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.javaindex a7cd7e0d5..99d678ccb 100644--- a/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java+++ b/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java@@ -726,7 +726,6 @@ public class AssetStorageService extends RouteBuilder implements ContainerServic// Update all empty attribute timestamps with server-time (a caller which doesn't have a// reliable time source such as a browser should clear the timestamp when setting an attribute// value).- // Ensure attribute names are not stored in the value objectasset.getAttributes().forEach(attribute -> {if (!attribute.hasExplicitTimestamp()) {attribute.setTimestamp(timerService.getCurrentTimeMillis());@@ -753,9 +752,17 @@ public class AssetStorageService extends RouteBuilder implements ContainerServic} else {updatedAsset = em.merge(asset);if (existingAsset == null) {- LOG.fine("Asset created: " + updatedAsset);+ if (LOG.isLoggable(Level.FINE)) {+ LOG.fine("Asset created: " + updatedAsset.toStringAll());+ } else {+ LOG.info("Asset created: " + updatedAsset);+ }} else {- LOG.fine("Asset updated: " + updatedAsset);+ if (LOG.isLoggable(Level.FINE)) {+ LOG.fine("Asset updated: new = " + updatedAsset.toStringAll() + ", old = " + existingAsset.toStringAll());+ } else {+ LOG.info("Asset updated: " + updatedAsset);+ }}}diff --git a/model/src/main/java/org/openremote/model/asset/Asset.java b/model/src/main/java/org/openremote/model/asset/Asset.javaindex 094cb9e66..2858e436b 100644--- a/model/src/main/java/org/openremote/model/asset/Asset.java+++ b/model/src/main/java/org/openremote/model/asset/Asset.java@@ -30,6 +30,7 @@ import org.openremote.model.asset.impl.ThingAsset;import org.openremote.model.asset.impl.UnknownAsset;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeMap;+import org.openremote.model.attribute.MetaMap;import org.openremote.model.geo.GeoJSONPoint;import org.openremote.model.jackson.AssetTypeIdResolver;import org.openremote.model.util.AssetModelUtil;@@ -37,6 +38,7 @@ import org.openremote.model.util.TsIgnore;import org.openremote.model.validation.AssetValid;import org.openremote.model.value.AttributeDescriptor;import org.openremote.model.value.ValueType;+import org.openremote.model.value.Values;import javax.persistence.*;import javax.validation.Valid;@@ -547,10 +549,31 @@ public abstract class Asset<T extends Asset<?>> implements IdentifiableEntity<T>", parentType='" + parentType + '\'' +", realm='" + realm + '\'' +", path=" + Arrays.toString(path) +- ", attributes=" + attributes ++ ", attributes=" + getAttributesString() +'}';}+ protected String getAttributesString() {+ if (attributes == null || attributes.isEmpty()) {+ return "";+ }+ return "[" ++ attributes.values().stream().map(attr ->+ "attr=" + attr.getName() + ",timestamp=" + attr.getTimestamp().orElse(null) + ",meta=" + getMetaString(attr.getMeta())) ++ "]";+ }++ protected String getMetaString(MetaMap meta) {+ if (meta == null || meta.isEmpty()) {+ return "[]";+ }++ return "[" ++ meta.entrySet().stream().map(nameAndValue ->+ "meta=" + nameAndValue.getKey() + ",value=" + Values.asJSON(nameAndValue.getValue().getValue()).orElse(null)) ++ "]";+ }+/* WELL KNNOWN ATTRIBUTE GETTER / SETTERS */