From 229327ef40ecb72a0bbca8e5c2f9360c72dc6c89 Mon Sep 17 00:00:00 2001 From: Ben Spencer Date: Wed, 12 Sep 2018 15:32:06 +0100 Subject: [PATCH] Prepend class name to connection / state machine loggers. This makes it easier to filter out messages in logback etc. --- .../com/twitter/finagle/postgres/connection/Connection.scala | 2 +- .../finagle/postgres/connection/ConnectionStateMachine.scala | 2 +- .../com/twitter/finagle/postgres/connection/StateMachine.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/scala/com/twitter/finagle/postgres/connection/Connection.scala b/src/main/scala/com/twitter/finagle/postgres/connection/Connection.scala index d453b1ff..6ead9356 100644 --- a/src/main/scala/com/twitter/finagle/postgres/connection/Connection.scala +++ b/src/main/scala/com/twitter/finagle/postgres/connection/Connection.scala @@ -11,7 +11,7 @@ import scala.collection.mutable.ListBuffer */ class Connection(startState: State = AuthenticationRequired) { val id = Connection.nextId() - private[this] val logger = Logger(s"connection-$id") + private[this] val logger = Logger(s"${getClass.getName}.connection-$id") private[this] val stateMachine = new ConnectionStateMachine(startState, id) diff --git a/src/main/scala/com/twitter/finagle/postgres/connection/ConnectionStateMachine.scala b/src/main/scala/com/twitter/finagle/postgres/connection/ConnectionStateMachine.scala index 3911712e..cfaa3504 100644 --- a/src/main/scala/com/twitter/finagle/postgres/connection/ConnectionStateMachine.scala +++ b/src/main/scala/com/twitter/finagle/postgres/connection/ConnectionStateMachine.scala @@ -11,7 +11,7 @@ import scala.collection.mutable.ListBuffer * See associated Postgres documentation: http://www.postgresql.org/docs/9.0/static/protocol-flow.html */ class ConnectionStateMachine(state: State = AuthenticationRequired, val id: Int) extends StateMachine[Message, PgResponse, State] { - private[this] val logger = Logger(s"psql state machine:$id") + private[this] val logger = Logger(s"${getClass.getName}.psql state machine:$id") startState(state) diff --git a/src/main/scala/com/twitter/finagle/postgres/connection/StateMachine.scala b/src/main/scala/com/twitter/finagle/postgres/connection/StateMachine.scala index 348bace3..04fb7262 100644 --- a/src/main/scala/com/twitter/finagle/postgres/connection/StateMachine.scala +++ b/src/main/scala/com/twitter/finagle/postgres/connection/StateMachine.scala @@ -20,7 +20,7 @@ trait StateMachine[E, R, S] { val id: Int - private[this] val logger = Logger(s"state machine-$id") + private[this] val logger = Logger(s"${getClass.getName}.state machine-$id") private[this] var transitionFunction: Transition = Undefined @volatile private[this] var currentState: S = _