@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fail quietly when failing to write access log

Summary: See D5874. PhutilDeferredLog's exception on `write()`/`__destruct()` is not especially important and can come at an awkward time. Instead of throwing, just emit an error message to the log.

Test Plan: Faked failed writes and saw an error message in the log instead of many terrible things everywhere.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3144

Differential Revision: https://secure.phabricator.com/D5875

+14 -18
+9 -8
src/infrastructure/PhabricatorAccessLog.php
··· 22 22 // NOTE: Path may be null. We still create the log, it just won't write 23 23 // anywhere. 24 24 25 - $log = new PhutilDeferredLog($path, $format); 26 - $log->setData( 27 - array( 28 - 'D' => date('r'), 29 - 'h' => php_uname('n'), 30 - 'p' => getmypid(), 31 - 'e' => time(), 32 - )); 25 + $log = id(new PhutilDeferredLog($path, $format)) 26 + ->setFailQuietly(true) 27 + ->setData( 28 + array( 29 + 'D' => date('r'), 30 + 'h' => php_uname('n'), 31 + 'p' => getmypid(), 32 + 'e' => time(), 33 + )); 33 34 34 35 self::$log = $log; 35 36 }
+5 -10
support/PhabricatorStartup.php
··· 194 194 if ($access_log) { 195 195 // We may end up here before the access log is initialized, e.g. from 196 196 // verifyPHP(). 197 - 198 - try { 199 - $access_log->setData( 200 - array( 201 - 'c' => 500, 202 - )); 203 - $access_log->write(); 204 - } catch (Exception $ex) { 205 - $message .= "\n(Moreover, unable to write to access log.)"; 206 - } 197 + $access_log->setData( 198 + array( 199 + 'c' => 500, 200 + )); 201 + $access_log->write(); 207 202 } 208 203 209 204 header(