Ask Your Question
4

Can the Laravel logging files be set to daily intervals?

asked 2023-07-17 16:26:25 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-07-17 16:54:03 +0000

pufferfish gravatar image

Yes, Laravel allows you to set the logging files to daily intervals. You can configure this in the "logging.php" configuration file by setting the "daily" option in the "channels" array. Here's an example:

'channels' => [
    'single' => [
        'driver' => 'single',
        'path' => storage_path('logs/laravel.log'),
        'level' => 'debug',
    ],

    'daily' => [
        'driver' => 'daily',
        'path' => storage_path('logs/laravel.log'),
        'level' => 'debug',
        'days' => 7,
    ],
],

In this example, we have two channels defined: "single" and "daily". The "single" channel writes to a single log file, while the "daily" channel writes to a new log file each day. The "days" option tells Laravel to keep logs for the specified number of days before deleting them.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-17 16:26:25 +0000

Seen: 18 times

Last updated: Jul 17 '23