From: Aaron Schulz Date: Mon, 2 Jan 2017 21:26:18 +0000 (-0800) Subject: Make some replication logging more structured X-Git-Tag: 1.31.0-rc.0~4406^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=11d0f9a8c5e1d3e1099d231725e2e931aed14fa2;p=lhc%2Fweb%2Fwiklou.git Make some replication logging more structured Change-Id: I0ec3c615047b666ff5ee430453c1de2a1316ef61 --- diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php index 14d049c485..95f55b6a86 100644 --- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php @@ -241,10 +241,14 @@ class LoadBalancer implements ILoadBalancer { $host = $this->getServerName( $i ); if ( $lag === false && !is_infinite( $maxServerLag ) ) { - $this->replLogger->error( "Server $host (#$i) is not replicating?" ); + $this->replLogger->error( + "Server {host} (#$i) is not replicating?", [ 'host' => $host ] ); unset( $loads[$i] ); } elseif ( $lag > $maxServerLag ) { - $this->replLogger->warning( "Server $host (#$i) has >= $lag seconds of lag" ); + $this->replLogger->warning( + "Server {host} (#$i) has {lag} seconds of lag (>= {maxlag})", + [ 'host' => $host, 'lag' => $lag, 'maxlag' => $maxServerLag ] + ); unset( $loads[$i] ); } } @@ -503,8 +507,10 @@ class LoadBalancer implements ILoadBalancer { if ( $result == -1 || is_null( $result ) ) { // Timed out waiting for replica DB, use master instead - $msg = __METHOD__ . ": Timed out waiting on $server pos {$this->mWaitForPos}"; - $this->replLogger->warning( "$msg" ); + $this->replLogger->warning( + __METHOD__ . ": Timed out waiting on {host} pos {$this->mWaitForPos}", + [ 'host' => $server ] + ); $ok = false; } else { $this->replLogger->info( __METHOD__ . ": Done" );