Monolog is a logging library for PHP 5.3 used by Symfony2. It is inspired by the Python LogBook library.
Questions tagged [monolog]
514 questions
11
votes
2 answers
Laravel 5 different log levels for development and production
I'm using Laravel 5.1 and trying to set different logging logic for a development and production environment.
Throughout my application I am using the Log facade with most of the following different…

dev7
- 6,259
- 6
- 32
- 65
11
votes
1 answer
Logs an entire array using Monolog
Is there any way to log an entire array using Monolog? I have been reading several docs but didn't find a way to log the entire array in a readable format, any advice?
Docs I've read:
Monolog, how to log PHP array into…

ReynierPM
- 17,594
- 53
- 193
- 363
11
votes
2 answers
Package for viewing "pretty" monolog files
Is there a package that is used for parsing monolog files and displaying them in a "pretty" HTML format with filtering for log level, etc?

Steven Musumeche
- 2,886
- 5
- 33
- 55
11
votes
5 answers
Can Laravel 4 log to a MySQL database?
If so how can it be done? By default L4 writes to a text file. I notice that Monolog can Log to Database on its github page.

Nyxynyx
- 61,411
- 155
- 482
- 830
10
votes
1 answer
Monolog: Send error logs by mail causes an extra mail for every error sent
For every error log sent by mail we get another extra email with 2 lines of smtp debug log messages.
Newly created symfony demo (symfony new --demo)
Configured monolog to send error messages by mail as in the docs
symfony/monolog-bundle…

virtualize
- 2,287
- 2
- 25
- 36
10
votes
8 answers
Log file is not being written in Laravel 5.5
I have logging enabled by default on Laravel 5.5.
The settings are:
In config/app.php file:
'log' => env('APP_LOG', 'single'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
In .env file:
APP_LOG_LEVEL=debug
If any error happens on the…

Debiprasad
- 5,895
- 16
- 67
- 95
10
votes
1 answer
Monolog stdout/stderr logs to current terminal process in Docker
I have a PHP/Symfony app running in Docker which uses Monolog to log to stdout/stderr. This all works great, except when running Symfony console commands inside a container.
monolog:
handlers:
stdout:
type: filter
…

Egon Olieux
- 709
- 1
- 10
- 18
10
votes
1 answer
Should I log errors in a controller or in a service?
I have a Symfony controller which basically checks if requested parameters are in the request, then passes these parameters to a service. The service use Guzzle to call an API, does some things with the result and then passes it back to the…

iBadGamer
- 566
- 6
- 22
10
votes
3 answers
How to add additional information (Host, URL, etc.) to Symfony/Monolog log output?
I am working on my first Symfony based WebApp project. I have configured Symfony to not only write log messages to the different log files but also to send critical error messages immediately as e-mail. This works fine. However I would like to add…

Andrei Herford
- 17,570
- 19
- 91
- 225
10
votes
1 answer
Graylog2 with Symfony 2 (Monolog)
I want to use the "Monolog -> GelfHandler" in a SF2 project. So I've added the following to my composer.json:
"graylog2/gelf-php": "dev-master"
My SF2 config.yml:
monolog:
handlers:
main:
type: gelf
publisher:
…

Volker
- 611
- 1
- 7
- 21
10
votes
2 answers
Log PHP fatal errors in Symfony2 using Monolog
I need a way to capture PHP fatal errors (but also notices and warnings) and logging them by using Monolog.
I found that Monolog 1.6+ has the ErrorHandler::register() method, but I can't figure out how to use it in a Symfony2 (production)…

fdellutri
- 963
- 1
- 7
- 16
10
votes
3 answers
Symfony 2.1 - Switch Monolog channel in controller
I want to log into a different file than the usual dev.log or prod.log
I know that this can be done with different channels and I used it in several services, but I'm not very clear about switching the Monolog channel in a controller.
In a service…

Johannes Klauß
- 10,676
- 16
- 68
- 122
9
votes
1 answer
Monolog Logger outputs empty arrays at the end of each log message
My logger object is outputting empty arrays at the end of each line - [] []. For example;
[2017-08-17 12:26:02] import_log.INFO: checkForDuplicates::is_processing [] []
[2017-08-17 12:26:04] import_log.INFO: is duplicate [] []
Is there anyway…

sazr
- 24,984
- 66
- 194
- 362
9
votes
3 answers
Custom HandlerWrapper with MonologBundle
I am using Symfony 3.1 and I try to configure Monolog in such a way, that requests from the Googlebot are not logged. For this I wrote a UserAgentProcessorwhich already works as intended. In the next step I tried to write BotFilter which looks like…

Emanuel Oster
- 1,296
- 10
- 21
9
votes
3 answers
Laravel logging: extra square brackets at end of log lines?
I'm newish to Laravel, and I've noticed when I use its Monolog-based logging, e.g. Log::info('blah blah'), the lines it writes to my logfile are suffixed with two empty sets of square brackets. What are they for, and how can I turn them off? …

curtisdf
- 4,130
- 4
- 33
- 42