From b6bc8b954bcb239a12ae7cd7c3216003d45a15a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20H=C3=A4user?= Date: Sat, 24 Oct 2015 14:25:43 +0200 Subject: [PATCH] Add default logging for akka --- build.sbt | 8 +++----- conf/application.conf | 6 +++++- conf/logger.xml | 33 +++++++++++++++++++++++++++++++++ project/plugins.sbt | 4 +--- src/templates/etc-default | 2 +- 5 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 conf/logger.xml diff --git a/build.sbt b/build.sbt index a4a4bd1ba..b1e5cb94f 100644 --- a/build.sbt +++ b/build.sbt @@ -13,12 +13,14 @@ scalacOptions ++= Seq("-Xlint:-missing-interpolator","-Xfatal-warnings","-deprec // From https://www.playframework.com/documentation/2.3.x/ProductionDist assemblyMergeStrategy in assembly := { + case "logger.xml" => MergeStrategy.first case "play/core/server/ServerWithStop.class" => MergeStrategy.first case other => (assemblyMergeStrategy in assembly).value(other) } libraryDependencies ++= Seq( - "com.typesafe.akka" %% "akka-actor" % "2.3.10", + "com.typesafe.akka" %% "akka-actor" % "2.3.14", + "com.typesafe.akka" %% "akka-slf4j" % "2.3.14", "com.google.code.findbugs" % "jsr305" % "2.0.1", "org.webjars" %% "webjars-play" % "2.3.0-2", "org.webjars" % "bootstrap" % "3.3.4", @@ -81,7 +83,3 @@ rpmUrl := Some("https://github.com/yahoo/kafka-manager") rpmLicense := Some("Apache") /* End RPM Settings */ - - - - diff --git a/conf/application.conf b/conf/application.conf index 982df57c7..2582539fb 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -23,7 +23,7 @@ application.langs="en" # global=Global # Database configuration -# ~~~~~ +# ~~~~~ # You can declare as many datasources as you want. # By convention, the default datasource is named `default` # @@ -66,3 +66,7 @@ pinned-dispatcher.type="PinnedDispatcher" pinned-dispatcher.executor="thread-pool-executor" application.features=["KMClusterManagerFeature","KMTopicManagerFeature","KMPreferredReplicaElectionFeature","KMReassignPartitionsFeature"] +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + loglevel = "DEBUG" +} diff --git a/conf/logger.xml b/conf/logger.xml new file mode 100644 index 000000000..a139b86f3 --- /dev/null +++ b/conf/logger.xml @@ -0,0 +1,33 @@ + + + + + + ${application.home}/logs/application.log + + %date - [%level] - from %logger in %thread %n%message%n%xException%n + + + + application.%d{yyyy-MM-dd}.log + 5 + + + + + + + + + + + + + + + + + + + + diff --git a/project/plugins.sbt b/project/plugins.sbt index 81d2f9467..a9623e56f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -19,9 +19,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0") addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.2") -addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") - -addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4") +addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.5") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0") diff --git a/src/templates/etc-default b/src/templates/etc-default index 2ce248771..27aa65384 100644 --- a/src/templates/etc-default +++ b/src/templates/etc-default @@ -20,7 +20,7 @@ # Setting JAVA_OPTS # ----------------- -JAVA_OPTS="-Dpidfile.path=/var/run/${{app_name}}/play.pid -Dconfig.file=/etc/${{app_name}}/application.conf $JAVA_OPTS" +JAVA_OPTS="-Dpidfile.path=/var/run/${{app_name}}/play.pid -Dconfig.file=/etc/${{app_name}}/application.conf -Dlogger.file=/etc/${{app_name}}/logger.xml $JAVA_OPTS" # Setting PIDFILE # ---------------