Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15375909
D17777.id42748.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D17777.id42748.diff
View Options
diff --git a/src/filesystem/PhutilDeferredLog.php b/src/filesystem/PhutilDeferredLog.php
--- a/src/filesystem/PhutilDeferredLog.php
+++ b/src/filesystem/PhutilDeferredLog.php
@@ -177,25 +177,31 @@
// and invoke possible __toString() calls.
$line = $this->format();
- if ($this->file !== null) {
- $dir = dirname($this->file);
- if (!Filesystem::pathExists($dir)) {
- Filesystem::createDirectory($dir, 0755, true);
- }
+ try {
+ if ($this->file !== null) {
+ $dir = dirname($this->file);
+ if (!Filesystem::pathExists($dir)) {
+ Filesystem::createDirectory($dir, 0755, true);
+ }
- $ok = @file_put_contents(
- $this->file,
- $line,
- FILE_APPEND | LOCK_EX);
+ $ok = @file_put_contents(
+ $this->file,
+ $line,
+ FILE_APPEND | LOCK_EX);
- if ($ok === false) {
- $message = pht("Unable to write to logfile '%s'!", $this->file);
- if ($this->failQuietly) {
- phlog($message);
- } else {
- throw new Exception($message);
+ if ($ok === false) {
+ throw new Exception(
+ pht(
+ 'Unable to write to logfile "%s"!',
+ $this->file));
}
}
+ } catch (Exception $ex) {
+ if ($this->failQuietly) {
+ phlog($ex);
+ } else {
+ throw $ex;
+ }
}
$this->didWrite = true;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 12:41 AM (5 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7638594
Default Alt Text
D17777.id42748.diff (1 KB)
Attached To
Mode
D17777: Make "fail quietly" flag in DeferredLog a little more quiet
Attached
Detach File
Event Timeline
Log In to Comment