Skip to content

Commit

Permalink
Merge pull request #144 from bjoernhaeuser/logging
Browse files Browse the repository at this point in the history
Add default logging for akka
  • Loading branch information
patelh committed Oct 27, 2015
2 parents b0fb7f2 + b6bc8b9 commit e76c2ee
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
8 changes: 3 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -81,7 +83,3 @@ rpmUrl := Some("https://github.com/yahoo/kafka-manager")
rpmLicense := Some("Apache")

/* End RPM Settings */




6 changes: 5 additions & 1 deletion conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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`
#
Expand Down Expand Up @@ -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"
}
33 changes: 33 additions & 0 deletions conf/logger.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<configuration>

<conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${application.home}/logs/application.log</file>
<encoder>
<pattern>%date - [%level] - from %logger in %thread %n%message%n%xException%n</pattern>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>application.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>5</maxHistory>
</rollingPolicy>
</appender>

<logger name="play" level="INFO" />
<logger name="application" level="DEBUG" />

<!-- Off these ones as they are annoying, and anyway we manage configuration ourself -->
<logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF" />
<logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader" level="OFF" />
<logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread" level="OFF" />
<logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF" />

<logger name="akka" level="INFO" />
<logger name="kafka" level="INFO" />

<root level="INFO">
<appender-ref ref="FILE" />
</root>

</configuration>
4 changes: 1 addition & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion src/templates/etc-default
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ---------------
Expand Down

0 comments on commit e76c2ee

Please sign in to comment.