Using papertrail logging in Slim Framework v3 with MonoLog


I was looking for a good way to group logs from different webapplications into one managable place, without too much configuration work on the different webservers, since some run on shared hosting, and some have different setups.

I came across Paper Trail App A hosted log management tool, which gives you the ability to aggegrate logs from different places into one location, and here you can filter and group different webservers together, and search the log history.

I’m not a big fan of saving sensitive data to a cloud based solution, so I chose not to send any server logs etc to papertrail, only debugging logs for my own use, without sensitive data, so I can easily track if all systems are running (I only log if crons are running, how many results certain functions are parsing, and if any errors occured).

If you want to use papertrail as your central logging server with slim framework V3 you can add this to your dependencies.php file:

And add this to your settings.php:

Then you can easily log data inside your classes with: