From 69e61398a6f1370c36a35d15de6093aeaac0cf15 Mon Sep 17 00:00:00 2001 From: mposolda Date: Thu, 2 Mar 2017 10:27:31 +0100 Subject: [PATCH] KEYCLOAK-4520 Enable testsuite logging when running test from IDE --- testsuite/integration-arquillian/HOW-TO-RUN.md | 11 +++++++++++ .../tests/base/src/test/resources/log4j.properties | 4 +++- testsuite/integration-arquillian/tests/pom.xml | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/testsuite/integration-arquillian/HOW-TO-RUN.md b/testsuite/integration-arquillian/HOW-TO-RUN.md index c1341fb3d7..f8306bacd0 100644 --- a/testsuite/integration-arquillian/HOW-TO-RUN.md +++ b/testsuite/integration-arquillian/HOW-TO-RUN.md @@ -47,6 +47,17 @@ and you will be able to attach remote debugger to the test. Unfortunately server TODO: Improve and add more info about Wildfly debugging... +## Testsuite logging + +It is configured in `testsuite/integration-arquillian/tests/base/src/test/resources/log4j.properties` . You can see that logging of testsuite itself (category `org.keycloak.testsuite`) is debug by default. + +When you run tests with undertow (which is by default), there is logging for Keycloak server and adapter (category `org.keycloak` ) in `info` when you run tests from IDE, but `off` when +you run tests with maven. The reason is that, we don't want huge logs when running mvn build. However using system property `keycloak.logging.level` will override it. This can be used for both IDE or maven. +So for example using `-Dkeycloak.logging.level=debug` will enable debug logging for keycloak server and adapter. + +For more fine-tuning of individual categories, you can look at log4j.properties file and temporarily enable/disable them here. + +TODO: Add info about Wildfly logging ## Run adapter tests diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/log4j.properties b/testsuite/integration-arquillian/tests/base/src/test/resources/log4j.properties index b9541e9678..58fde2c984 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/log4j.properties +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/log4j.properties @@ -25,7 +25,9 @@ log4j.appender.testsuite=org.apache.log4j.ConsoleAppender log4j.appender.testsuite.layout=org.apache.log4j.PatternLayout log4j.appender.testsuite.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%C{1}] %m%n -log4j.logger.org.keycloak=off, keycloak +# Logging with "info" when running test from IDE, but disabled when running test with "mvn" . Both cases can be overriden by use system property "keycloak.logging.level" (eg. -Dkeycloak.logging.level=debug ) +keycloak.logging.level=info +log4j.logger.org.keycloak=${keycloak.logging.level}, keycloak log4j.logger.org.jboss.resteasy.resteasy_jaxrs.i18n=off diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index f12e4dbff8..799053e4d8 100755 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -78,6 +78,8 @@ true true + off + ${project.build.directory}/dependency/test-constants.properties false @@ -187,6 +189,8 @@ ${firefox_binary} ${phantomjs.cli.args} + ${keycloak.logging.level} + ${project.version} ${migration.project.version} ${migration.product.version}