1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Monologでログファイルのパーミッションを指定する

Posted at

Monologでファイルにログを出力する場合、StreamHandlerまたはStreamHandlerを継承したクラスを使用しますが、ファイルのパーミッションを指定する方法を記述します。
ファイルのパーミッションを指定する場合、コンストラクタの第4引数の$filePermissionに8進数で指定します。

new StreamHandler('/app.log', Logger::INFO, true, 0755);

StreamHandler.phpの105行目でchmod関数で設定しています。(chmodなのでWindowsでは効果はありません。)

StreamHandler.php
if ($this->filePermission !== null) {
    @chmod($this->url, $this->filePermission);
}
1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?