Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Added more verbose logging for tests to help identify issues during tests

Rich Turner7eda46141e85
diff --git a/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOClient.java b/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOClient.java
index 38e664462..090acce08 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOClient.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOClient.java
@@ -228,12 +228,13 @@ public abstract class AbstractNettyIOClient<T, U extends SocketAddress> implemen
LOG.fine("Re-connection scheduled in '" + execution.getDelay() + "' for: " + getClientUri()))
.onFailedAttempt((execution) ->
LOG.fine("Re-connection attempt failed '" + execution.getAttemptCount() + "' for: " + getClientUri()))
- .onRetry((execution) ->
- LOG.fine("Re-connection attempt '" + (execution.getAttemptCount()+1) + "' for: " + getClientUri()))
.withMaxRetries(Integer.MAX_VALUE)
.build();
connectRetry = Failsafe.with(retryPolicy).with(executorService).runAsyncExecution((execution) -> {
+
+ LOG.fine("Connection attempt '" + (execution.getAttemptCount()+1) + "' for: " + getClientUri());
+
boolean success = doConnect().get();
if (connectRetry.isCancelled()) {
diff --git a/test/build.gradle b/test/build.gradle
index fa73d2a40..1e7322989 100644
--- a/test/build.gradle
+++ b/test/build.gradle
@@ -24,6 +24,10 @@ dependencies {
}
}
+tasks.withType(Test) {
+ environment("LOGGING_CONFIG_FILE", "test/src/logging-test.properties")
+}
+
test {
workingDir = findProject(":openremote") != null ? resolveProject("").projectDir : rootProject.projectDir
outputs.upToDateWhen {false}
diff --git a/test/src/logging-test.properties b/test/src/logging-test.properties
new file mode 100644
index 000000000..5c0642207
--- /dev/null
+++ b/test/src/logging-test.properties
@@ -0,0 +1,105 @@
+# Logging config for tests
+
+###############################################################################
+# Output handlers
+###############################################################################
+
+# Log on STDOUT and internal syslog service (monitoring in Manager UI)
+handlers=java.util.logging.ConsoleHandler, \
+ org.openremote.manager.syslog.SyslogService
+
+# Log on STDOUT, to a file, and internal syslog service (monitoring in Manager UI)
+#handlers=java.util.logging.ConsoleHandler, \
+# java.util.logging.FileHandler \
+# org.openremote.manager.syslog.SyslogService
+
+###############################################################################
+# Console handler
+###############################################################################
+
+# Set to FINEST to get all enabled log categories on console handler
+java.util.logging.ConsoleHandler.level=FINEST
+
+# Console format, you can colorize this in IntelliJ IDEA "Run Application " console
+# with the GrepConsole plugin and after copying the configuration file of your
+# choice to ~/Library/Preferences/IntelliJ*/options/GrepConsole.xml:
+#
+# - tools/intellijTheme-Default-GrepConsole.xml
+# - tools/intellijTheme-Darcula-GrepConsole.xml
+#
+java.util.logging.ConsoleHandler.formatter=org.openremote.container.util.LogFormatter
+
+###############################################################################
+# File handler
+###############################################################################
+
+# Set to FINEST to get all enabled log categories on file handler
+java.util.logging.FileLogger.level=FINEST
+
+# Output file and format
+java.util.logging.FileHandler.pattern=/deployment/openremote.log
+java.util.logging.FileHandler.formatter=org.openremote.container.util.LogFormatter
+# Rotate between 10 log files
+java.util.logging.FileHandler.count=10
+# 10 mb per file
+java.util.logging.FileHandler.limit=10000000
+# Set to false to clear log on restart
+java.util.logging.FileHandler.append=false
+
+###############################################################################
+# Categories
+###############################################################################
+
+# The root logger category, the default for all categories not configured here
+.level=INFO
+
+# The root logger category of OpenRemote, FINER logs much more than INFO
+org.openremote.level=FINER
+
+# Increase agent logging for fault finding
+org.openremote.agent.level=FINEST
+
+# Rule execution logging
+#
+# - Use "global java.util.logging.Logger LOG;" in rule RHS to access this logger
+# - Set to FINEST to automatically log all fact additions, removals, and updates
+# - Set to INFO and prefix your rule name with "-" or "--" to log execution details
+org.openremote.rules.Rules.level=FINE
+
+# Set to INFO to get rules engine statistics periodically, FINEST to dump all facts
+org.openremote.rules.RulesEngineStats.level=OFF
+
+# Set to INFO or higher to debug internal messaging
+org.openremote.container.message.MessageBrokerContext.level=WARNING
+
+# Set to FINE to log full exception stack traces
+org.openremote.container.web.WebServiceExceptions.level=FINE
+
+# Set to SEVERE to log invalid access tokens
+org.keycloak.adapters.BearerTokenRequestAuthenticator.level=SEVERE
+
+# Set this to FINEST to log outgoing HTTP traffic
+org.apache.http.level=WARNING
+org.apache.http.impl.conn.DefaultClientConnection.level=WARNING
+org.apache.http.client.protocol.level=SEVERE
+
+# Set this to FINEST to log SQL execution
+org.hibernate.SQL.level=WARNING
+org.hibernate.type.descriptor.sql.BasicBinder.level=WARNING
+
+# Log only attribute event processing begin/end, useful to debug many events
+org.openremote.container.web.level=INFO
+org.openremote.manager.server.level=INFO
+
+org.openremote.manager.datapoint.level=FINEST
+
+# Low-level debugging overrides, most of them are to stop chatty categories
+org.hibernate.level=WARNING
+org.hibernate.cfg.beanvalidation.TypeSafeActivator.level=SEVERE
+com.zaxxer.hikari.level=WARNING
+javax.management.level=WARNING
+org.xnio.level=WARNING
+org.apache.camel.management.level=WARNING
+org.apache.camel.impl.converter.DefaultTypeConverter.level=WARNING
+org.apache.camel.impl.DefaultShutdownStrategy.level=SEVERE
+org.jeasy.rules.level=WARNING