To write a log file to another location, use the method useDailyFiles or useFiles, and then info to log to the log file at the path you just specified something like below:
Log::useFiles('path/to/file.log');
Log::info([info to log]);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am trying to understand how I could write a log message to a custom log. Right now I am able to write to storage/logs/laravel.log using Log::debug('message')
\Log::debug('Hello world!');
And the message gets added to laravel.log which is great!
But I would also like to add a custom log for example /storage/logs/myownlog.log
\Log::debug('Hello world!'); // logs to laravel.log
\Log::mycustomlog('Hello!'); // logs to myownlog.log
I was reading through the documentation on it but I could not understand what I need to change in /config/logging.php to add a custom log file. Channels, stacks and drivers seem really confusing to me....
Laravel 5.6
Please or to participate in this conversation.