Including Extra Debugging Information in Your Symfony Error Log

tomat
tomat
Published in
1 min readJan 7, 2017

--

The production error logs in Symfony are a bit sparse by default. Here’s a simple tip to add some extra info you might need when debugging.

In this example we add the username of the logged in user, and any POST data the request may contain.

For this to be useful though you’ll have to add the extra part of the log record to your log output, either by adding your own formatter, or by using a built-in handler that has support for the include_extra configuration option.

Something like this; no extra coding required. Note the %%extra.username%% and %%extra.postParams%% parameters on line 6.

--

--