I'm using scala-based scalatra for web frameworks and I'm having trouble setting up logback.xml.
I set my logback.xml file in PROJECT_ROOT/src/main/resources/logback.xml like below
logback.xml
<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>server_error.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
and I set javaOptions variable in build.sbt file like below
build.sbt
settings = ScalatraPlugin.scalatraSettings ++ scalateSettings ++ Seq(
organization := Organization,
name := Name,
version := Version,
scalaVersion := ScalaVersion,
fork := true,
javaOptions := Seq("-Dlogback.configurationFile=src/main/resources/logback.xml"),
resolvers += Classpaths.typesafeReleases,
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % ScalatraVersion,
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
"ch.qos.logback" % "logback-classic" % "1.1.5" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "9.2.15.v20160210" % "container",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
"com.typesafe" % "config" % "1.3.1",
"com.amazonaws" % "aws-java-sdk-dynamodb" % "1.11.142",
"org.mongodb.scala" %% "mongo-scala-driver" % "1.2.1"
)
Logging process works really fine when I run this project on local environment, but from production server I cannot find "server_error.log" file from anywhere that should be generated by logback.xml. I'm using aws elasticbeanstalk and deployed on elasticbeanstalk the .war file generated by using 'package' command from sbt.