DEV Community

Cover image for Log Viewer v3 is out
Arunas Skirius
Arunas Skirius

Posted on • Originally published at arunas.dev

Log Viewer v3 is out

Log Viewer v3 brings several quality of life features that I'm sure you will enjoy - different log format support, and email previews.

Support for multiple log formats

Log Viewer can now view not just Laravel logs, but also Apache, Nginx, Redis, Postgres, Supervisor, and more. Here you can see the types of logs that are now supported by Log Viewer out of the box.

Showing these logs in the new Log Viewer is as easy as adding the paths to your logs in the config/log-viewer.php configuration, like so:

    /*
    |---------------------------------------------------------
    | Include file patterns
    |---------------------------------------------------------
    |
    */

    'include_files' => [
        '*.log',
        '**/*.log',

        // You can include paths to other log types as well, such as apache, nginx, and more.
        '/var/log/httpd/*',
        '/var/log/nginx/*',

        // For example, logs can be found on MacOS Apple Silicon machines
        '/opt/homebrew/var/log/nginx/*',
        '/opt/homebrew/var/log/httpd/*',
        '/opt/homebrew/var/log/php-fpm.log',
        '/opt/homebrew/var/log/postgres*log',
        '/opt/homebrew/var/log/redis*log',
        '/opt/homebrew/var/log/supervisor*log',

        // '/absolute/paths/supported',
    ],
Enter fullscreen mode Exit fullscreen mode

If you don't see a particular log format, don't worry - you can now define custom log formats which will allow you to browse these custom logs within the Log Viewer UI that you love. Defining custom logs also works for overriding the existing, built-in log formats. If, for example, your Laravel or HTTP logs are somehow different from factory defaults, you can extend the parser classes to include the custom modifications you've made. You can read all about extending log formats here.

Log type switcher

Supporting multiple types of logs means there a lot more... logs... To help find exactly what you're looking for, or to focus your search on particular log types, we have added a log type selector. The selector will show up as soon as Log Viewer finds more than one type of log.

Log Viewer log type switcher in action

Email previews

How often do you use the log mail driver? I know I don't, simply because it's very difficult to read these raw emails with headers and MIME parts, much less see how they actually look. I've always opted in for other solutions like Mailtrap, Helo, or just sending real emails.

Well, all the other tools require additional setup, separate apps, or can be plain dangerous in test environments (ever sent a test email to a real person by mistake?)

The log mail driver is the simplest, and safest approach to sending emails locally. It becomes even more useful with Log Viewer v3, which brings email previews directly within the Log Viewer:

Log Viewer email previews in action

All you need to make this work is to set this in your .env:

MAIL_MAILER=log
Enter fullscreen mode Exit fullscreen mode

The emails you send will instead be logged to your Laravel log, and they will then be viewable within the Log Viewer. Nifty little feature, don't you think? :)

Upgrading

Log Viewer v3 is an easy upgrade without any breaking changes for most users. You can learn how to upgrade from v2 to v3 here. The documentation has been updated for Log Viewer v3.

Questions / Feedback

If you have any questions, issues, bugs to report - please send them directly to the project's GitHub page - issues or discussions.

Support

If you enjoy using this free, open-source project, there's several ways you can give back:

  • Submit a PR - fix a bug, add a new feature, refactor code. All PRs are welcome.
  • Add support for additional log formats - there's tons of different log formats in the world, and the more we can support in the Log Viewer - the better. Submit a PR with a new format support.
  • Buy me a coffee! ☕️ I'm an avid coffee drinker, which helps me work through the weekends after my full-time job to provide you with the Log Viewer for free :)

Top comments (0)