Laravel Idea for PhpStorm - Full-featured IDE for productive artisans!

Laravel Log Files Support in PhpStorm

Published on by

Laravel Log Files Support in PhpStorm image

Today I want to look at a new feature in PhpStorm, one that I think many Laravel developers will find very interesting. Now, to be clear, I’m a Developer Advocate at JetBrains, so you might think it’s obvious I’m excited about PhpStorm. Well, I wouldn’t be writing this post if I weren’t genuinely thrilled about it myself. First and foremost, I’m a PHP and Laravel developer, and I write code daily. So yes, I can say from experience: I’m really excited about this one!

So, let’s take a look at how the latest version of PhpStorm has improved logger support!

Improved log files

Until recently, log files in PhpStorm have been pretty… boring. They are huge blobs of text – that’s it:

Now, I don’t know about you, but scrolling through those huge blobs becomes annoying pretty quickly – especially when you’re trying to debug production issues, which is probably the most common use case for reading a log file.

To streamline the experience of working with logs, the latest version of PhpStorm presents log files in a format that's much easier to understand at a glance. They will now look something like this:

You can see how the lines are color-coded, errors are highlighted in the scroll bar, and links are styled and clickable. On top of that, bigger log files no longer affect PhpStorm’s performance. A special new renderer for log files allows the IDE to highlight only the code that is visible at any given time, which drastically reduces the amount of memory and CPU needed. Naturally, when you scroll, any new lines that appear will be styled properly as well.

Speaking of scrolling, another use case for log files is to tail them in a terminal window. We’ve added the same styling on that output as well, which means that you can keep your log file open and any new lines will be automatically styled correctly:

Log files on remote servers

Another common use case is browsing production log files via SSH. Let’s take a look at how that works in PhpStorm.

First you need to configure an SSH connection, which you can do by going to Settings | Tools | SSH Configurations.

Next, with the SSH configuration in place, you can start a new SSH session. Go to Tools | Deployment | Browse Remote Host and choose your newly created SSH configuration.

PhpStorm will open a new tool window for browsing the remote server. You can navigate to the log file, open it, and…

It looks just the same!

Pretty neat, right?

Finally, let’s talk about settings. You can go to Settings | Editor | Log Highlighting to configure how log files should be styled. You can enable or disable the heatmap (the colored scroll bar), choose whether links are highlighted, patterns, filters, and configure log formats (we’ve got support for Laravel, Symfony, WordPress, and more).

The section that’s probably most interesting is the patterns table, where you can change the styling of highlighted log entries. For example, I don’t like errors being bold, so I can change the error pattern accordingly:

On top of that, you can create your own patterns if you want to, which is pretty powerful if you want to create your own log highlighting rules, or if you’re reading a log file whose format isn’t supported out of the box.

In closing

The new support for log files is quite impressive if you ask me. Introduced in PhpStorm 2024.2, you can experience it now by starting a 30-day free trial or simply updating your IDE if you’re already a PhpStorm user.

Brent Roose photo

Brent has been an active member of the PHP community for over a decade. He has a well-known blog and newsletter called stitcher.io, works as a Developer Advocate for PhpStorm by JetBrains, and hosts the community-focused YouTube channel PHP Annotated.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Join the Mastering Laravel community logo

Join the Mastering Laravel community

Connect with experienced developers in a friendly, noise-free environment. Get insights, share ideas, and find support for your coding challenges. Join us today and elevate your Laravel skills!

Join the Mastering Laravel community
Laravel Idea for PhpStorm logo

Laravel Idea for PhpStorm

Ultimate PhpStorm plugin for Laravel developers, delivering lightning-fast code completion, intelligent navigation, and powerful generation tools to supercharge productivity.

Laravel Idea for PhpStorm
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
Enum-Powered Route Permissions in Laravel image

Enum-Powered Route Permissions in Laravel

Read article
NativePHP for iOS image

NativePHP for iOS

Read article
Using Relative Date Helpers in Laravel's Query Builder image

Using Relative Date Helpers in Laravel's Query Builder

Read article
Fine-tuning Pagination Links in Laravel image

Fine-tuning Pagination Links in Laravel

Read article
Relative Date Helpers in Laravel 11.42 image

Relative Date Helpers in Laravel 11.42

Read article
Smart Route Detection in Laravel image

Smart Route Detection in Laravel

Read article