Combine custom logging from Symfony packages

Volodymyr Ustinov
2 min readApr 29, 2021


Hi to all. This is my first article in my life at public space, so please dont hate me so much :-).

Recently i was faced with problem of lack documentation about logging based on Symfony packages. Actually there is documentation but its related to Symfony ecosystem, and its not my case.

My task was just add logging system to existed project, I choose Monolog because I like the way how its decoupled in components, actually as usually Symfony components.

Monolog consist from such common components like:

Logger — common class that combine all other components and make all job for logging.

Handler — class that handle log in some specified way, monolog prepare for us big amount of handlers. There is StreamHandler for storing log in file, RotatingFileHandler for same storing logs in file but with rotation of files. And also there is such handlers like AmqpHandler, TelegramBotHandler and many others, amount is impressive.

Formatter — class that perform formatting for your logs, I had use JsonFormatter.

Processor — class for adding some specified info to your log. And again amount of this processors is huge. In my case I use UidProcessor, it adds unique id to all you log entries, this allow you trace all log for one request for example.

Logger implements LoggerInterface.

And final one example of Logger combined from different components:



Volodymyr Ustinov

Hi, I’m a software engineer. My career started at 2012. My common ecosystem is backend with PHP