[GH-ISSUE #1737] StreamHandler isn't finding laravel.log file, path url stops with app/storage. No app/storage/logs/laravel.log #732

Closed
opened 2026-03-04 02:17:28 +03:00 by kerem · 4 comments
Owner

Originally created by @Vigneshkavi on GitHub (Jul 20, 2022).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1737

Monolog version 1|2

Hi, I'm using PHP 8.0.2 and laravel 8. While trying to access the app via browser, it gives me the error in the attached screenshot. On debugging I found that the path URL for the laravel.log file is not complete. it stops with app/storage. I don't understand why this happens. Please help me solve this issue.

screencapture-localhost-8003-2022-07-20-09_42_26

Thanks!

Originally created by @Vigneshkavi on GitHub (Jul 20, 2022). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1737 Monolog version 1|2 Hi, I'm using PHP 8.0.2 and laravel 8. While trying to access the app via browser, it gives me the error in the attached screenshot. On debugging I found that the path URL for the laravel.log file is not complete. it stops with app/storage. I don't understand why this happens. Please help me solve this issue. ![screencapture-localhost-8003-2022-07-20-09_42_26](https://user-images.githubusercontent.com/89829245/179895469-9e0b292d-1825-4b35-8fbf-defca25eb49b.png) Thanks!
kerem 2026-03-04 02:17:28 +03:00
  • closed this issue
  • added the
    Support
    label
Author
Owner

@parallels999 commented on GitHub (Jul 20, 2022):

Folder permissions

<!-- gh-comment-id:1190358187 --> @parallels999 commented on GitHub (Jul 20, 2022): Folder permissions
Author
Owner

@Seldaek commented on GitHub (Jul 22, 2022):

That looks like you configured the log file path to point to a directory which exists. Make sure the log file is a full path including filename.

<!-- gh-comment-id:1192508326 --> @Seldaek commented on GitHub (Jul 22, 2022): That looks like you configured the log file path to point to a directory which exists. Make sure the log file is a full path including filename.
Author
Owner

@Vigneshkavi commented on GitHub (Aug 8, 2022):

<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
  /*
    |--------------------------------------------------------------------------
    | Default Log Channel
    |--------------------------------------------------------------------------
    |
    | This option defines the default log channel that gets used when writing
    | messages to the logs. The name specified in this option should match
    | one of the channels defined in the "channels" configuration array.
    |
    */
  'default' => env('LOG_CHANNEL', 'stack'),
  /*
    |--------------------------------------------------------------------------
    | Log Channels
    |--------------------------------------------------------------------------
    |
    | Here you may configure the log channels for your application. Out of
    | the box, Laravel uses the Monolog PHP logging library. This gives
    | you a variety of powerful log handlers / formatters to utilize.
    |
    | Available Drivers: "single", "daily", "slack", "syslog",
    |                    "errorlog", "monolog",
    |                    "custom", "stack"
    |
    */
  'channels' => [
    'stack' => [
      'driver'            => 'stack',
      'channels'          => ['single'],
      'ignore_exceptions' => false,
    ],
    'single' => [
      'driver' => 'single',
      'path'   => storage_path('logs/laravel.log'),
      'level'  => env('LOG_LEVEL', 'debug'),
    ],
    'daily' => [
      'driver' => 'daily',
      'path'   => storage_path('logs/laravel.log'),
      'level'  => env('LOG_LEVEL', 'info'),
      'days'   => 14,
    ],
    'slack' => [
      'driver'   => 'slack',
      'url'      => env('LOG_SLACK_WEBHOOK_URL'),
      'username' => 'Laravel Log',
      'emoji'    => ':boom:',
      'level'    => env('LOG_LEVEL', 'critical'),
    ],
    'papertrail' => [
      'driver'       => 'monolog',
      'level'        => env('LOG_LEVEL', 'debug'),
      'handler'      => SyslogUdpHandler::class,
      'handler_with' => [
        'host' => env('PAPERTRAIL_URL'),
        'port' => env('PAPERTRAIL_PORT'),
      ],
    ],
    'stderr' => [
      'driver'    => 'monolog',
      'handler'   => StreamHandler::class,
      'formatter' => env('LOG_STDERR_FORMATTER'),
      'with'      => [
        'stream' => 'php://stderr',
      ],
    ],
    'syslog' => [
      'driver' => 'syslog',
      'level'  => env('LOG_LEVEL', 'debug'),
    ],
    'errorlog' => [
      'driver' => 'errorlog',
      'level'  => env('LOG_LEVEL', 'debug'),
    ],
    'null' => [
      'driver'  => 'monolog',
      'handler' => NullHandler::class,
    ],
    'emergency' => [
      'path' => storage_path('logs/laravel.log'),
    ],
  ],
];
<!-- gh-comment-id:1207687348 --> @Vigneshkavi commented on GitHub (Aug 8, 2022): ``` <?php use Monolog\Handler\NullHandler; use Monolog\Handler\StreamHandler; use Monolog\Handler\SyslogUdpHandler; return [ /* |-------------------------------------------------------------------------- | Default Log Channel |-------------------------------------------------------------------------- | | This option defines the default log channel that gets used when writing | messages to the logs. The name specified in this option should match | one of the channels defined in the "channels" configuration array. | */ 'default' => env('LOG_CHANNEL', 'stack'), /* |-------------------------------------------------------------------------- | Log Channels |-------------------------------------------------------------------------- | | Here you may configure the log channels for your application. Out of | the box, Laravel uses the Monolog PHP logging library. This gives | you a variety of powerful log handlers / formatters to utilize. | | Available Drivers: "single", "daily", "slack", "syslog", | "errorlog", "monolog", | "custom", "stack" | */ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single'], 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), ], 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'info'), 'days' => 14, ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', 'emoji' => ':boom:', 'level' => env('LOG_LEVEL', 'critical'), ], 'papertrail' => [ 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), 'handler' => SyslogUdpHandler::class, 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), ], ], 'stderr' => [ 'driver' => 'monolog', 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], ], 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => env('LOG_LEVEL', 'debug'), ], 'null' => [ 'driver' => 'monolog', 'handler' => NullHandler::class, ], 'emergency' => [ 'path' => storage_path('logs/laravel.log'), ], ], ]; ```
Author
Owner

@Vigneshkavi commented on GitHub (Aug 8, 2022):

Thanks for the reply Mr. Seldaek The above file (Logging.php) is working with our teammates but not working with mine only, Kindly help us.

<!-- gh-comment-id:1207687683 --> @Vigneshkavi commented on GitHub (Aug 8, 2022): Thanks for the reply Mr. Seldaek The above file (Logging.php) is working with our teammates but not working with mine only, Kindly help us.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#732
No description provided.