Reputation: 521
I am finding the way how to log in Akka for Scala. And I read some thing in akka website (below). But cannot find out where to type these lines of code into my program. Could you please show me how or give me an example? It's quite ambiguous for me.
If you want very detailed logging of all lifecycle changes of Actors (restarts, deaths etc):
akka {
actor {
debug {
# enable DEBUG logging of actor lifecycle changes
lifecycle = on
}
}
}
Thank you.
Upvotes: 3
Views: 1706
Reputation: 2226
You need to add those lines in typesafe config file. By default, the name of this file is application.conf (or application.json/application.properties on the root of the classpath. This syntax which looks like json is HOCON format which is superset of JSON.
Akka uses Typesafe Config Library for defining configuration including logging, actor system, serialization etc.
Even if you don't have application.conf, akka uses reasonable defaults and works - but if you want to override, you can create a configuration using this reference.
The file should be placed on the root of classpath, e.g. under src/main/resources folder (for SBT or maven projects). You can customize your logging configuration from these logging examples and your actors should use akka.event.Logging API for logging.
Upvotes: 1