Fix Logger Disconnect (#1563)

This commit is contained in:
Radosław Waśko 2021-03-10 17:20:01 +01:00 committed by GitHub
parent 8290dedcda
commit 8b023e2549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 12 deletions

View File

@ -39,19 +39,43 @@ trait ServiceWithActorSystem extends Service {
import scala.jdk.CollectionConverters._
val loggers: java.lang.Iterable[String] =
Seq("akka.event.Logging$StandardOutLogger").asJava
val config = ConfigFactory
.empty()
.withValue("akka.loggers", ConfigValueFactory.fromAnyRef(loggers))
.withValue(
"akka.logging-filter",
ConfigValueFactory.fromAnyRef("akka.event.DefaultLoggingFilter")
val config = {
val baseConfig = ConfigFactory
.empty()
.withValue("akka.loggers", ConfigValueFactory.fromAnyRef(loggers))
.withValue(
"akka.logging-filter",
ConfigValueFactory.fromAnyRef("akka.event.DefaultLoggingFilter")
)
.withValue("akka.loglevel", ConfigValueFactory.fromAnyRef("WARNING"))
.withValue(
"akka.coordinated-shutdown.run-by-actor-system-terminate",
ConfigValueFactory.fromAnyRef("off")
)
.withValue("akka.daemonic", ConfigValueFactory.fromAnyRef("on"))
.withValue(
"akka.http.server.websocket.periodic-keep-alive-mode",
ConfigValueFactory.fromAnyRef("ping")
)
.withValue(
"akka.http.server.websocket.periodic-keep-alive-max-idle",
ConfigValueFactory.fromAnyRef("30 seconds")
)
val timeouts = Seq(
"akka.http.server.idle-timeout",
"akka.http.client.idle-timeout",
"akka.http.host-connection-pool.client.idle-timeout",
"akka.http.host-connection-pool.idle-timeout"
)
.withValue("akka.loglevel", ConfigValueFactory.fromAnyRef("WARNING"))
.withValue(
"akka.coordinated-shutdown.run-by-actor-system-terminate",
ConfigValueFactory.fromAnyRef("off")
)
.withValue("akka.daemonic", ConfigValueFactory.fromAnyRef("on"))
val configWithTimeouts = timeouts.foldLeft(baseConfig) {
case (config, key) =>
config.withValue(key, ConfigValueFactory.fromAnyRef("120 seconds"))
}
configWithTimeouts
}
ActorSystem(
name,
config,

View File

@ -29,6 +29,10 @@ class FileOutputPrinter(
override def print(message: WSLogMessage): Unit = {
val lines = renderer.render(message)
writer.println(lines)
// TODO [RW] we may consider making flushing configurable as it is mostly
// useful for debugging crashes, whereas for usual usecases buffering could
// give slightly better performance
writer.flush()
}
/** @inheritdoc */