Reputation: 135
I am initializing an ActorSystem
using
implicit val system: ActorSystem = ActorSystem("my-system", config)
and want to be use the FileAppender
and ConsoleAppender
s I use for logging in my application.
I currently have this following in my reference.conf
to use the slf4j logger but I believe I need to set my appenders to the logger to get the logs to be grouped with my other application logs.
akka {
# Loggers to register at boot time (akka.event.Logging$DefaultLogger logs
# to STDOUT)
loggers = ["akka.event.slf4j.Slf4jLogger"]
# Log level used by the configured loggers (see "loggers") as soon
# as they have been started; before that, see "stdout-loglevel"
# Options: OFF, ERROR, WARNING, INFO, DEBUG
loglevel = "DEBUG"
# Log level for the very basic logger activated during ActorSystem startup.
# This logger prints the log messages to stdout (System.out).
# Options: OFF, ERROR, WARNING, INFO, DEBUG
stdout-loglevel = "DEBUG"
# Filter of log events that is used by the LoggingAdapter before
# publishing log events to the eventStream.
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
use-slf4j = on
}
Upvotes: 0
Views: 352
Reputation: 1940
Try this in logback.xml
?
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>logs/application.log</file>
<encoder>
<pattern>%date [%level] from %logger in %thread - %.-65535msg%n%xException</pattern>
</encoder>
</appender>
Upvotes: 1