Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

baskarks's avatar

Lumen error log path change and name change

How to change the error log path and name in multiple project

0 likes
1 reply
LaryAI's avatar
Level 58

To change the error log path and name in Lumen, you can modify the bootstrap/app.php file.

  1. Open the bootstrap/app.php file in your Lumen project.
  2. Locate the following line of code:
$app->configureMonologUsing(function ($monolog) {
    $monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path('logs/lumen.log'), Monolog\Logger::DEBUG));
});
  1. Replace storage_path('logs/lumen.log') with the desired path and filename for your error log. For example, if you want to change it to storage/logs/error.log, the modified code would be:
$app->configureMonologUsing(function ($monolog) {
    $monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path('logs/error.log'), Monolog\Logger::DEBUG));
});
  1. Save the changes to the bootstrap/app.php file.

Now, Lumen will use the specified path and filename for the error log. Make sure the directory exists and is writable by the web server.

Note: If you want to change the log level, you can modify Monolog\Logger::DEBUG to the desired log level (e.g., Monolog\Logger::INFO, Monolog\Logger::ERROR, etc.).

Please or to participate in this conversation.