From 720b08b291f91e5059d81642dbf6378963da0c4a Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 1 Nov 2017 10:23:01 -0700 Subject: [PATCH] Improve connection logging a little more Don't include the trace in the actual message, that keeps us from grouping these messages by type. Instead inject the trace as an extra parameter we'll pick up in logstash Change-Id: I48184c1af2560827ef50baff4fc0443f00697504 --- includes/libs/rdbms/database/Database.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index a9dd07483f..e04566eb49 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -948,9 +948,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $msg = __METHOD__ . ': lost connection to {dbserver}; reconnected'; $params = [ 'dbserver' => $this->getServer() ]; $this->connLogger->warning( $msg, $params ); - $this->queryLogger->warning( - "$msg:\n" . ( new RuntimeException() )->getTraceAsString(), - $params ); + $this->queryLogger->warning( $msg, $params + + [ 'trace' => ( new RuntimeException() )->getTraceAsString() ] ); if ( !$recoverable ) { # Callers may catch the exception and continue to use the DB -- 2.20.1