You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by jk...@apache.org on 2021/01/05 13:01:11 UTC

[unomi] branch logMore updated: UNOMI-412: code review improvements

This is an automated email from the ASF dual-hosted git repository.

jkevan pushed a commit to branch logMore
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/logMore by this push:
     new 729aff5  UNOMI-412: code review improvements
729aff5 is described below

commit 729aff5e68ab0b1581df6c3f48904fc83d29fc31
Author: Kevan <ke...@jahia.com>
AuthorDate: Tue Jan 5 14:01:02 2021 +0100

    UNOMI-412: code review improvements
---
 .../apache/unomi/graphql/commands/ProcessEventsCommand.java    | 10 ++++++++--
 .../GeoLocationByPointSessionConditionEvaluator.java           |  5 ++++-
 .../unomi/plugins/request/actions/SetRemoteHostInfoAction.java | 10 ++++++++--
 .../services/impl/definitions/DefinitionsServiceImpl.java      |  2 +-
 4 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/commands/ProcessEventsCommand.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/commands/ProcessEventsCommand.java
index d373874..fbd9208 100644
--- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/commands/ProcessEventsCommand.java
+++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/commands/ProcessEventsCommand.java
@@ -104,7 +104,10 @@ public class ProcessEventsCommand extends BaseCommand<Integer> {
                         }
 
                     } catch (Exception e) {
-                        LOG.warn("Process field " + eventProcessor.getFieldName() + " is failed", e);
+                        LOG.warn("Process field {} is failed. enable debug log to see the full stack trace", eventProcessor.getFieldName());
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("Process field failed", e);
+                        }
                     }
                 });
     }
@@ -115,7 +118,10 @@ public class ProcessEventsCommand extends BaseCommand<Integer> {
                 try {
                     processField(fieldDefinition, eventInputAsMap);
                 } catch (Exception e) {
-                    LOG.warn("Process field " + fieldDefinition + " is failed", e);
+                    LOG.warn("Process field {} is failed. enable debug log to see the full stack trace", fieldDefinition);
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Process field failed", e);
+                    }
                 }
             }
         });
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionEvaluator.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionEvaluator.java
index 6e798a3..12e8da6 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionEvaluator.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/GeoLocationByPointSessionConditionEvaluator.java
@@ -61,7 +61,10 @@ public class GeoLocationByPointSessionConditionEvaluator implements ConditionEva
                 }
             }
         } catch (Exception e) {
-            logger.warn("Cannot evaluate condition, properties 'properties.location.lat' or 'properties.location.lon' not found");
+            logger.warn("Cannot evaluate condition, properties 'properties.location.lat' or 'properties.location.lon' not found, enable debug log level to see full stacktrace");
+            if (logger.isDebugEnabled()) {
+                logger.debug("Cannot evaluate condition", e);
+            }
         }
         return false;
     }
diff --git a/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
index 9e60118..d18aa56 100644
--- a/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
+++ b/plugins/request/src/main/java/org/apache/unomi/plugins/request/actions/SetRemoteHostInfoAction.java
@@ -232,7 +232,10 @@ public class SetRemoteHostInfoAction implements ActionExecutor {
             }
             return true;
         } catch (IOException | GeoIp2Exception e) {
-            logger.warn("Cannot resolve IP", e);
+            logger.warn("Cannot resolve IP {}, enable debug log level for complete stacktrace", remoteAddr);
+            if (logger.isDebugEnabled()) {
+                logger.debug("Cannot resolve IP", e);
+            }
         }
         return false;
     }
@@ -243,7 +246,10 @@ public class SetRemoteHostInfoAction implements ActionExecutor {
             try {
                 addr = InetAddress.getByName(remoteAddr);
             } catch (UnknownHostException e) {
-                logger.warn("Cannot resolve IP", e);
+                logger.warn("Cannot resolve IP {}, enable debug log level for complete stacktrace", remoteAddr);
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Cannot resolve IP", e);
+                }
                 return false;
             }
             // Check if the address is a valid special local or loop back
diff --git a/services/src/main/java/org/apache/unomi/services/impl/definitions/DefinitionsServiceImpl.java b/services/src/main/java/org/apache/unomi/services/impl/definitions/DefinitionsServiceImpl.java
index cf4d4c1..18ad41e 100644
--- a/services/src/main/java/org/apache/unomi/services/impl/definitions/DefinitionsServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/impl/definitions/DefinitionsServiceImpl.java
@@ -268,7 +268,7 @@ public class DefinitionsServiceImpl implements DefinitionsService, SynchronousBu
                         valueTypeByTag.put(tag, valueTypes);
                     } else {
                         // we found a tag that is not defined, we will define it automatically
-                        logger.warn("Unknown tag " + tag + " used in property type definition " + predefinedPropertyURL);
+                        logger.warn("Unknown tag {} used in property type definition {}", tag, predefinedPropertyURL);
                     }
                 }
             } catch (Exception e) {