From 69643348fb199a25dc3c97989eb9bc8c3fab654d Mon Sep 17 00:00:00 2001 From: Enno Date: Sun, 26 Nov 2017 20:53:54 +0100 Subject: [PATCH] logging to files in tests (#611) All modules are now set up to log to files this makes the build output much easier for the human eye. * Add akka-slf4j and logback as default dependency in Common * Log to file consistently in all modules * Append all log files to travis log --- .travis.yml | 1 + amqp/src/test/resources/application.conf | 5 ++ amqp/src/test/resources/logback-test.xml | 13 +++++ awslambda/src/test/resources/application.conf | 5 ++ awslambda/src/test/resources/logback-test.xml | 13 +++++ .../src/test/resources/application.conf | 5 ++ .../src/test/resources/logback-test.xml | 13 +++++ build.sbt | 6 +-- cassandra/src/test/resources/application.conf | 5 ++ cassandra/src/test/resources/logback-test.xml | 13 +++++ csv/src/test/resources/application.conf | 5 ++ csv/src/test/resources/logback-test.xml | 13 +++++ dynamodb/src/test/resources/application.conf | 5 ++ dynamodb/src/test/resources/logback-test.xml | 13 +++++ .../elasticsearch/ElasticsearchTest.java | 3 +- .../src/test/resources/application.conf | 5 ++ .../src/test/resources/logback-test.xml | 13 +++++ .../elasticsearch/ElasticsearchSpec.scala | 1 + file/src/test/resources/application.conf | 5 ++ file/src/test/resources/logback-test.xml | 13 +++++ ftp/src/test/resources/application.conf | 7 ++- ftp/src/test/resources/logback-test.xml | 19 +++++++ ftp/src/test/resources/logback.xml | 44 ----------------- geode/src/test/resources/application.conf | 5 ++ geode/src/test/resources/log4j2.xml | 6 +-- geode/src/test/resources/logback-test.xml | 14 ++++++ geode/src/test/resources/logback.xml | 16 ------ .../src/test/resources/application.conf | 5 ++ .../src/test/resources/logback-test.xml | 13 +++++ hbase/src/test/resources/logback-test.xml | 20 ++++++++ hbase/src/test/resources/logback.xml | 20 -------- hbase/src/test/resources/reference.conf | 7 ++- ironmq/src/test/resources/application.conf | 7 ++- ironmq/src/test/resources/logback-test.xml | 14 ++++++ jms/src/test/resources/application.conf | 5 ++ jms/src/test/resources/logback-test.xml | 13 +++++ kinesis/src/test/resources/application.conf | 5 +- kinesis/src/test/resources/logback-test.xml | 13 +++++ mongodb/src/test/resources/application.conf | 6 +++ mongodb/src/test/resources/logback-test.xml | 13 +++++ .../alpakka/mongodb/MongoSourceSpec.scala | 2 + mqtt/src/test/resources/application.conf | 6 +++ mqtt/src/test/resources/logback-test.xml | 13 +++++ project/Common.scala | 7 ++- project/Dependencies.scala | 49 ++++++++----------- s3/src/test/resources/application.conf | 4 +- s3/src/test/resources/logback-test.xml | 15 ++++++ s3/src/test/resources/logback.xml | 38 -------------- scripts/cat-log.sh | 6 +++ slick/src/test/resources/logback-test.xml | 13 +++++ slick/src/test/resources/logback.xml | 15 ------ sns/src/test/resources/application.conf | 5 ++ sns/src/test/resources/logback-test.xml | 13 +++++ .../src/test/resources/application.conf | 5 ++ .../src/test/resources/logback-test.xml | 13 +++++ sqs/src/test/resources/application.conf | 5 ++ sqs/src/test/resources/logback-test.xml | 13 +++++ sse/src/test/resources/application.conf | 5 ++ sse/src/test/resources/logback-test.xml | 13 +++++ xml/src/test/resources/application.conf | 5 ++ xml/src/test/resources/logback-test.xml | 13 +++++ 61 files changed, 483 insertions(+), 182 deletions(-) create mode 100644 amqp/src/test/resources/application.conf create mode 100644 amqp/src/test/resources/logback-test.xml create mode 100644 awslambda/src/test/resources/application.conf create mode 100644 awslambda/src/test/resources/logback-test.xml create mode 100644 azure-storage-queue/src/test/resources/application.conf create mode 100644 azure-storage-queue/src/test/resources/logback-test.xml create mode 100644 cassandra/src/test/resources/application.conf create mode 100644 cassandra/src/test/resources/logback-test.xml create mode 100644 csv/src/test/resources/application.conf create mode 100644 csv/src/test/resources/logback-test.xml create mode 100644 dynamodb/src/test/resources/logback-test.xml create mode 100644 elasticsearch/src/test/resources/application.conf create mode 100644 elasticsearch/src/test/resources/logback-test.xml create mode 100644 file/src/test/resources/application.conf create mode 100644 file/src/test/resources/logback-test.xml create mode 100644 ftp/src/test/resources/logback-test.xml delete mode 100644 ftp/src/test/resources/logback.xml create mode 100644 geode/src/test/resources/application.conf create mode 100644 geode/src/test/resources/logback-test.xml delete mode 100644 geode/src/test/resources/logback.xml create mode 100644 google-cloud-pub-sub/src/test/resources/application.conf create mode 100644 google-cloud-pub-sub/src/test/resources/logback-test.xml create mode 100644 hbase/src/test/resources/logback-test.xml delete mode 100644 hbase/src/test/resources/logback.xml create mode 100644 ironmq/src/test/resources/logback-test.xml create mode 100644 jms/src/test/resources/application.conf create mode 100644 jms/src/test/resources/logback-test.xml create mode 100644 kinesis/src/test/resources/logback-test.xml create mode 100644 mongodb/src/test/resources/application.conf create mode 100644 mongodb/src/test/resources/logback-test.xml create mode 100644 mqtt/src/test/resources/application.conf create mode 100644 mqtt/src/test/resources/logback-test.xml create mode 100644 s3/src/test/resources/logback-test.xml delete mode 100644 s3/src/test/resources/logback.xml create mode 100755 scripts/cat-log.sh create mode 100644 slick/src/test/resources/logback-test.xml delete mode 100644 slick/src/test/resources/logback.xml create mode 100644 sns/src/test/resources/application.conf create mode 100644 sns/src/test/resources/logback-test.xml create mode 100644 spring-web/src/test/resources/application.conf create mode 100644 spring-web/src/test/resources/logback-test.xml create mode 100644 sqs/src/test/resources/application.conf create mode 100644 sqs/src/test/resources/logback-test.xml create mode 100644 sse/src/test/resources/application.conf create mode 100644 sse/src/test/resources/logback-test.xml create mode 100644 xml/src/test/resources/application.conf create mode 100644 xml/src/test/resources/logback-test.xml diff --git a/.travis.yml b/.travis.yml index af1529e1de..91e6ee0772 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,7 @@ script: - git diff --exit-code --color || { echo "[error] Unformatted code found. Please run 'test:compile' and commit the reformatted code."; false; } && sbt -J-XX:ReservedCodeCacheSize=128m ++$TRAVIS_SCALA_VERSION ";testChanged" # check policies, if on master also upload - if [[ "$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_EVENT_TYPE" == "push" ]]; then sbt 'set credentials += Credentials("whitesource", "whitesourcesoftware.com", "", System.getenv("WHITESOURCE_KEY"))' whitesourceCheckPolicies whitesourceUpdate; else sbt 'set credentials += Credentials("whitesource", "whitesourcesoftware.com", "", System.getenv("WHITESOURCE_KEY"))' whitesourceCheckPolicies; fi ; fi + - find . -name "*.log" -exec ./scripts/cat-log.sh {} \; after_failure: - docker-compose logs mqtt diff --git a/amqp/src/test/resources/application.conf b/amqp/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/amqp/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/amqp/src/test/resources/logback-test.xml b/amqp/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..adbbac344a --- /dev/null +++ b/amqp/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/amqp.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/awslambda/src/test/resources/application.conf b/awslambda/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/awslambda/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/awslambda/src/test/resources/logback-test.xml b/awslambda/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..adf68aa1da --- /dev/null +++ b/awslambda/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/awslambda.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/azure-storage-queue/src/test/resources/application.conf b/azure-storage-queue/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/azure-storage-queue/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/azure-storage-queue/src/test/resources/logback-test.xml b/azure-storage-queue/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..9d2a9d6be1 --- /dev/null +++ b/azure-storage-queue/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/azure-storage-queue.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/build.sbt b/build.sbt index 2796566f97..a356cca415 100644 --- a/build.sbt +++ b/build.sbt @@ -178,10 +178,6 @@ def alpakkaProject(projectId: String, additionalSettings: sbt.Def.SettingsDefini Project(id = projectId, base = file(projectId)) .enablePlugins(AutomateHeaderPlugin) .settings( - name := s"akka-stream-alpakka-$projectId", - // By default scalatest futures time out in 150 ms, dilate that to 600ms. - // This should not impact the total test time as we don't expect to hit this - // timeout. - testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-F", "4") + name := s"akka-stream-alpakka-$projectId" ) .settings(additionalSettings: _*) diff --git a/cassandra/src/test/resources/application.conf b/cassandra/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/cassandra/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/cassandra/src/test/resources/logback-test.xml b/cassandra/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..ff64cea974 --- /dev/null +++ b/cassandra/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/cassandra.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/csv/src/test/resources/application.conf b/csv/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/csv/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/csv/src/test/resources/logback-test.xml b/csv/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..c221e03a56 --- /dev/null +++ b/csv/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/csv.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/dynamodb/src/test/resources/application.conf b/dynamodb/src/test/resources/application.conf index d79e7cc1ae..3ad890c55a 100644 --- a/dynamodb/src/test/resources/application.conf +++ b/dynamodb/src/test/resources/application.conf @@ -4,3 +4,8 @@ akka.stream.alpakka.dynamodb { region = "us-east-1" parallelism = 5 } +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/dynamodb/src/test/resources/logback-test.xml b/dynamodb/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..a3f3fb735d --- /dev/null +++ b/dynamodb/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/dynamodb.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/elasticsearch/src/test/java/akka/stream/alpakka/elasticsearch/ElasticsearchTest.java b/elasticsearch/src/test/java/akka/stream/alpakka/elasticsearch/ElasticsearchTest.java index 5a9d3bb823..02c9cff7cc 100644 --- a/elasticsearch/src/test/java/akka/stream/alpakka/elasticsearch/ElasticsearchTest.java +++ b/elasticsearch/src/test/java/akka/stream/alpakka/elasticsearch/ElasticsearchTest.java @@ -45,7 +45,8 @@ public static void setup() throws IOException { runner.build(ElasticsearchClusterRunner.newConfigs() .baseHttpPort(9200) .baseTransportPort(9300) - .numOfNode(1)); + .numOfNode(1) + .disableESLogger()); runner.ensureYellow(); //#init-client diff --git a/elasticsearch/src/test/resources/application.conf b/elasticsearch/src/test/resources/application.conf new file mode 100644 index 0000000000..b623cf2f76 --- /dev/null +++ b/elasticsearch/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka.stream.akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/elasticsearch/src/test/resources/logback-test.xml b/elasticsearch/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..75e8ef8734 --- /dev/null +++ b/elasticsearch/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/elasticsearch.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/elasticsearch/src/test/scala/akka/stream/alpakka/elasticsearch/ElasticsearchSpec.scala b/elasticsearch/src/test/scala/akka/stream/alpakka/elasticsearch/ElasticsearchSpec.scala index 1036b79349..6fc3542e7b 100644 --- a/elasticsearch/src/test/scala/akka/stream/alpakka/elasticsearch/ElasticsearchSpec.scala +++ b/elasticsearch/src/test/scala/akka/stream/alpakka/elasticsearch/ElasticsearchSpec.scala @@ -47,6 +47,7 @@ class ElasticsearchSpec extends WordSpec with Matchers with BeforeAndAfterAll { .baseHttpPort(9200) .baseTransportPort(9300) .numOfNode(1) + .disableESLogger() ) runner.ensureYellow() diff --git a/file/src/test/resources/application.conf b/file/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/file/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/file/src/test/resources/logback-test.xml b/file/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..bd524aec1f --- /dev/null +++ b/file/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/files.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/ftp/src/test/resources/application.conf b/ftp/src/test/resources/application.conf index d462dee7b0..497cd7dbe1 100644 --- a/ftp/src/test/resources/application.conf +++ b/ftp/src/test/resources/application.conf @@ -1 +1,6 @@ -akka.test.single-expect-default = 30 seconds \ No newline at end of file +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} +akka.test.single-expect-default = 30 seconds diff --git a/ftp/src/test/resources/logback-test.xml b/ftp/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..0920d4abf4 --- /dev/null +++ b/ftp/src/test/resources/logback-test.xml @@ -0,0 +1,19 @@ + + + target/ftp.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + + + + + + + \ No newline at end of file diff --git a/ftp/src/test/resources/logback.xml b/ftp/src/test/resources/logback.xml deleted file mode 100644 index a6a0ce6621..0000000000 --- a/ftp/src/test/resources/logback.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - UTF-8 - - - %highlight(%date{HH:mm:ss.SSS} %-5level %-50.50([%logger{50}])) - %msg%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/geode/src/test/resources/application.conf b/geode/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/geode/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/geode/src/test/resources/log4j2.xml b/geode/src/test/resources/log4j2.xml index d75580b962..5b14031534 100644 --- a/geode/src/test/resources/log4j2.xml +++ b/geode/src/test/resources/log4j2.xml @@ -5,9 +5,9 @@ true - + - + @@ -17,7 +17,7 @@ - + diff --git a/geode/src/test/resources/logback-test.xml b/geode/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..8933251d9f --- /dev/null +++ b/geode/src/test/resources/logback-test.xml @@ -0,0 +1,14 @@ + + + + target/geode.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + diff --git a/geode/src/test/resources/logback.xml b/geode/src/test/resources/logback.xml deleted file mode 100644 index c15c9b85a5..0000000000 --- a/geode/src/test/resources/logback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - System.out - - - %-6level[%logger{0}]: %msg%n - - - - - - - - - diff --git a/google-cloud-pub-sub/src/test/resources/application.conf b/google-cloud-pub-sub/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/google-cloud-pub-sub/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/google-cloud-pub-sub/src/test/resources/logback-test.xml b/google-cloud-pub-sub/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..cff3740eab --- /dev/null +++ b/google-cloud-pub-sub/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/google-cloud-pub-sub.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/hbase/src/test/resources/logback-test.xml b/hbase/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..863f1f4019 --- /dev/null +++ b/hbase/src/test/resources/logback-test.xml @@ -0,0 +1,20 @@ + + + + target/hbase.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + + + + + + + diff --git a/hbase/src/test/resources/logback.xml b/hbase/src/test/resources/logback.xml deleted file mode 100644 index eef7e94346..0000000000 --- a/hbase/src/test/resources/logback.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - System.out - - - %-6level[%logger{0}]: %msg%n - - - - - - - - - - - - - diff --git a/hbase/src/test/resources/reference.conf b/hbase/src/test/resources/reference.conf index f4132a405b..7bdde8d7f2 100644 --- a/hbase/src/test/resources/reference.conf +++ b/hbase/src/test/resources/reference.conf @@ -1,6 +1,5 @@ akka { -// loggers = ["akka.event.slf4j.Slf4jLogger"] + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" loglevel = "DEBUG" -// logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" - logger-startup-timeout = 15s -} \ No newline at end of file +} diff --git a/ironmq/src/test/resources/application.conf b/ironmq/src/test/resources/application.conf index 6abde402ff..4a1aefa96f 100644 --- a/ironmq/src/test/resources/application.conf +++ b/ironmq/src/test/resources/application.conf @@ -4,4 +4,9 @@ akka.stream.alpakka.ironmq { credentials { token = "adminToken" } -} \ No newline at end of file +} +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/ironmq/src/test/resources/logback-test.xml b/ironmq/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..aa105ec39e --- /dev/null +++ b/ironmq/src/test/resources/logback-test.xml @@ -0,0 +1,14 @@ + + + + target/ironmq.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + diff --git a/jms/src/test/resources/application.conf b/jms/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/jms/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/jms/src/test/resources/logback-test.xml b/jms/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..ccfa9f2453 --- /dev/null +++ b/jms/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/jms.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/kinesis/src/test/resources/application.conf b/kinesis/src/test/resources/application.conf index 1ae21d0296..e3e6889380 100644 --- a/kinesis/src/test/resources/application.conf +++ b/kinesis/src/test/resources/application.conf @@ -1,5 +1,6 @@ akka { - loggers = ["akka.testkit.TestEventListener"] - loglevel = DEBUG + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" } diff --git a/kinesis/src/test/resources/logback-test.xml b/kinesis/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..be37b87dd6 --- /dev/null +++ b/kinesis/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/kinesis.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/mongodb/src/test/resources/application.conf b/mongodb/src/test/resources/application.conf new file mode 100644 index 0000000000..e3e6889380 --- /dev/null +++ b/mongodb/src/test/resources/application.conf @@ -0,0 +1,6 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} + diff --git a/mongodb/src/test/resources/logback-test.xml b/mongodb/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..0c6718272c --- /dev/null +++ b/mongodb/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/mongodb.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/mongodb/src/test/scala/akka/stream/alpakka/mongodb/MongoSourceSpec.scala b/mongodb/src/test/scala/akka/stream/alpakka/mongodb/MongoSourceSpec.scala index d3d0912b9c..6522af8509 100644 --- a/mongodb/src/test/scala/akka/stream/alpakka/mongodb/MongoSourceSpec.scala +++ b/mongodb/src/test/scala/akka/stream/alpakka/mongodb/MongoSourceSpec.scala @@ -32,6 +32,8 @@ class MongoSourceSpec override protected def beforeAll(): Unit = Await.result(db.drop().toFuture(), 5.seconds) + java.util.logging.Logger.getLogger("org.mongodb.driver").setLevel(java.util.logging.Level.SEVERE) + //#init-connection private lazy val client = MongoClient(s"mongodb://localhost:27017") private lazy val db = client.getDatabase("alpakka-mongo") diff --git a/mqtt/src/test/resources/application.conf b/mqtt/src/test/resources/application.conf new file mode 100644 index 0000000000..e3e6889380 --- /dev/null +++ b/mqtt/src/test/resources/application.conf @@ -0,0 +1,6 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} + diff --git a/mqtt/src/test/resources/logback-test.xml b/mqtt/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..db6a3e35b5 --- /dev/null +++ b/mqtt/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/mqtt.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + diff --git a/project/Common.scala b/project/Common.scala index 41ed0515e2..d0456e5e61 100644 --- a/project/Common.scala +++ b/project/Common.scala @@ -43,9 +43,12 @@ object Common extends AutoPlugin { apiURL := Some(url(s"http://developer.lightbend.com/docs/api/alpakka/${version.value}")), // show full stack traces and test case durations testOptions in Test += Tests.Argument("-oDF"), - // -v Log "test run started" / "test started" / "test run finished" events on log level "info" instead of "debug". // -a Show stack traces and exception class name for AssertionErrors. - testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-a"), + testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a"), + // By default scalatest futures time out in 150 ms, dilate that to 600ms. + // This should not impact the total test time as we don't expect to hit this + // timeout. + testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-F", "4"), scalafmtOnCompile := true, headerLicense := Some(HeaderLicense.Custom("Copyright (C) 2016-2017 Lightbend Inc. ")) ) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 8ff2da5f0a..73112a98d7 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,9 +11,12 @@ object Dependencies { val AkkaHttpVersion = "10.0.10" val Common = Seq( + // These libraries are added to all modules via the `Common` AutoPlugin libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-stream" % AkkaVersion, "com.typesafe.akka" %% "akka-stream-testkit" % AkkaVersion % Test, + "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion % Test, + "ch.qos.logback" % "logback-classic" % "1.2.3" % Test, // Eclipse Public License 1.0 "org.scalatest" %% "scalatest" % "3.0.1" % Test, // ApacheV2 "com.novocode" % "junit-interface" % "0.11" % Test, // BSD-style "junit" % "junit" % "4.12" % Test // Eclipse Public License 1.0 @@ -41,12 +44,13 @@ object Dependencies { val Cassandra = Seq( libraryDependencies ++= Seq( - "com.datastax.cassandra" % "cassandra-driver-core" % "3.3.0", // ApacheV2 - "ch.qos.logback" % "logback-classic" % "1.1.7" % Test // Eclipse Public License 1.0 + "com.datastax.cassandra" % "cassandra-driver-core" % "3.3.0" // ApacheV2 ) ) - val Csv = Seq() + val Csv = Seq( + libraryDependencies ++= Seq() + ) val DynamoDB = Seq( libraryDependencies ++= Seq( @@ -77,26 +81,20 @@ object Dependencies { "org.apache.ftpserver" % "ftpserver-core" % "1.1.1" % Test, // ApacheV2 "org.apache.sshd" % "sshd-core" % "1.6.0" % Test, // ApacheV2 "net.i2p.crypto" % "eddsa" % "0.2.0" % Test, // CC0 1.0 Universal - "com.google.jimfs" % "jimfs" % "1.1" % Test, // ApacheV2 - "org.slf4j" % "slf4j-api" % "1.7.21" % Test, // MIT - "ch.qos.logback" % "logback-classic" % "1.1.7" % Test, // Eclipse Public License 1.0 - "ch.qos.logback" % "logback-core" % "1.1.7" % Test // Eclipse Public License 1.0 + "com.google.jimfs" % "jimfs" % "1.1" % Test // ApacheV2 ) ) val Geode = { val geodeVersion = "1.3.0" val slf4jVersion = "1.7.25" - val logbackVersion = "1.2.3" Seq( - libraryDependencies ++= Seq("com.chuusai" %% "shapeless" % "2.3.2") ++ + libraryDependencies ++= Seq("geode-core", "geode-cq") .map("org.apache.geode" % _ % geodeVersion exclude ("org.slf4j", "slf4j-log4j12")) ++ Seq( - "org.slf4j" % "log4j-over-slf4j" % slf4jVersion % Test, // MIT like: http://www.slf4j.org/license.html - "org.slf4j" % "slf4j-api" % slf4jVersion % Test, // MIT like: http://www.slf4j.org/license.html - "ch.qos.logback" % "logback-classic" % logbackVersion % Test, // Eclipse Public License 1.0: http://logback.qos.ch/license.html - "ch.qos.logback" % "logback-core" % logbackVersion % Test // Eclipse Public License 1.0: http://logback.qos.ch/license.html + "com.chuusai" %% "shapeless" % "2.3.2", + "org.slf4j" % "log4j-over-slf4j" % slf4jVersion % Test // MIT like: http://www.slf4j.org/license.html ) ) } @@ -119,10 +117,7 @@ object Dependencies { "org.apache.hbase" % "hbase-common" % hbaseVersion exclude ("log4j", "log4j") exclude ("org.slf4j", "slf4j-log4j12"), // ApacheV2, "org.apache.hadoop" % "hadoop-common" % hadoopVersion exclude ("log4j", "log4j") exclude ("org.slf4j", "slf4j-log4j12"), // ApacheV2, "org.apache.hadoop" % "hadoop-mapreduce-client-core" % hadoopVersion exclude ("log4j", "log4j") exclude ("org.slf4j", "slf4j-log4j12"), // ApacheV2, - "org.slf4j" % "log4j-over-slf4j" % "1.7.21" % Test, // MIT like: http://www.slf4j.org/license.html - "org.slf4j" % "slf4j-api" % "1.7.21" % Test, // MIT like: http://www.slf4j.org/license.html - "ch.qos.logback" % "logback-classic" % "1.1.7" % Test, // Eclipse Public License 1.0: http://logback.qos.ch/license.html - "ch.qos.logback" % "logback-core" % "1.1.7" % Test // Eclipse Public License 1.0: http://logback.qos.ch/license.html + "org.slf4j" % "log4j-over-slf4j" % "1.7.21" % Test // MIT like: http://www.slf4j.org/license.html ) ) } @@ -143,6 +138,12 @@ object Dependencies { resolvers += ("jboss" at "https://repository.jboss.org/nexus/content/groups/public") ) + val Kinesis = Seq( + libraryDependencies ++= Seq( + "com.amazonaws" % "aws-java-sdk-kinesis" % AwsSdkVersion, // ApacheV2 + "org.mockito" % "mockito-core" % "2.7.11" % Test // MIT + ) + ) val MongoDb = Seq( libraryDependencies ++= Seq( "org.mongodb.scala" %% "mongo-scala-driver" % "2.1.0" // ApacheV2 @@ -178,7 +179,7 @@ object Dependencies { "org.springframework.boot" % "spring-boot-autoconfigure" % SpringBootVersion, // TODO should this be provided? // for examples - "org.springframework.boot" % "spring-boot-starter-web" % SpringBootVersion % "test" + "org.springframework.boot" % "spring-boot-starter-web" % SpringBootVersion % Test ) ) } @@ -187,9 +188,7 @@ object Dependencies { libraryDependencies ++= Seq( "com.typesafe.slick" %% "slick" % "3.2.1", // BSD 2-clause "Simplified" License "com.typesafe.slick" %% "slick-hikaricp" % "3.2.1", // BSD 2-clause "Simplified" License - "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion % Test, - "com.h2database" % "h2" % "1.4.196" % Test, // Eclipse Public License 1.0 - "ch.qos.logback" % "logback-classic" % "1.2.3" % Test // Eclipse Public License 1.0 + "com.h2database" % "h2" % "1.4.196" % Test // Eclipse Public License 1.0 ) ) @@ -207,8 +206,6 @@ object Dependencies { // elasticmq-rest-sqs depends on Akka 2.5, exclude it, so we can choose Akka version ExclusionRule(organization = "com.typesafe.akka") // ), // ApacheV2 - // elasticmq-rest-sqs depends on akka-slf4j which was excluded - "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion % Test, // ApacheV2 // pull up akka-http version to the latest version for elasticmq-rest-sqs "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion % Test, // ApacheV2 "org.mockito" % "mockito-core" % "2.12.0" % Test // MIT @@ -229,10 +226,4 @@ object Dependencies { ) ) - val Kinesis = Seq( - libraryDependencies ++= Seq( - "com.amazonaws" % "aws-java-sdk-kinesis" % AwsSdkVersion, // ApacheV2 - "org.mockito" % "mockito-core" % "2.7.11" % Test // MIT - ) - ) } diff --git a/s3/src/test/resources/application.conf b/s3/src/test/resources/application.conf index 4be5a3feae..25b29008d2 100644 --- a/s3/src/test/resources/application.conf +++ b/s3/src/test/resources/application.conf @@ -1,5 +1,7 @@ akka { - loggers = ["akka.testkit.TestEventListener"] + loggers = ["akka.testkit.TestEventListener", "akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "INFO" } aws { diff --git a/s3/src/test/resources/logback-test.xml b/s3/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..1ef81cf71e --- /dev/null +++ b/s3/src/test/resources/logback-test.xml @@ -0,0 +1,15 @@ + + + target/s3.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + + + \ No newline at end of file diff --git a/s3/src/test/resources/logback.xml b/s3/src/test/resources/logback.xml deleted file mode 100644 index d4ea5cb281..0000000000 --- a/s3/src/test/resources/logback.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - UTF-8 - - - %highlight(%date{HH:mm:ss.SSS} %-5level %-50.50([%logger{50}])) - %msg%n - - - - - - - - - - - - \ No newline at end of file diff --git a/scripts/cat-log.sh b/scripts/cat-log.sh new file mode 100755 index 0000000000..f79f038506 --- /dev/null +++ b/scripts/cat-log.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# ---------- helper script to separate log files in travis build +printf "\n\n\n" +ls -lh $1 +printf "\n\n" +cat $1 diff --git a/slick/src/test/resources/logback-test.xml b/slick/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..fa02819d54 --- /dev/null +++ b/slick/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/slick.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/slick/src/test/resources/logback.xml b/slick/src/test/resources/logback.xml deleted file mode 100644 index 2724043628..0000000000 --- a/slick/src/test/resources/logback.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - System.out - - %d{ISO8601} %-5level [%logger{0}] - %msg%n - - - - diff --git a/sns/src/test/resources/application.conf b/sns/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/sns/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/sns/src/test/resources/logback-test.xml b/sns/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..c0be772651 --- /dev/null +++ b/sns/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/sns.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/spring-web/src/test/resources/application.conf b/spring-web/src/test/resources/application.conf new file mode 100644 index 0000000000..75440a057b --- /dev/null +++ b/spring-web/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} \ No newline at end of file diff --git a/spring-web/src/test/resources/logback-test.xml b/spring-web/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..c24e444fbf --- /dev/null +++ b/spring-web/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/spring-web.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/sqs/src/test/resources/application.conf b/sqs/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/sqs/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/sqs/src/test/resources/logback-test.xml b/sqs/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..53fbe41e89 --- /dev/null +++ b/sqs/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/sqs.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/sse/src/test/resources/application.conf b/sse/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/sse/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/sse/src/test/resources/logback-test.xml b/sse/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..247c9b80df --- /dev/null +++ b/sse/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/sse.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file diff --git a/xml/src/test/resources/application.conf b/xml/src/test/resources/application.conf new file mode 100644 index 0000000000..7bdde8d7f2 --- /dev/null +++ b/xml/src/test/resources/application.conf @@ -0,0 +1,5 @@ +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + loglevel = "DEBUG" +} diff --git a/xml/src/test/resources/logback-test.xml b/xml/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..fe2741b3b6 --- /dev/null +++ b/xml/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + target/xml.log + false + + %d{ISO8601} %-5level [%thread] [%logger{36}] %msg%n + + + + + + + \ No newline at end of file