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
0
votes
1 answer
Using monolog within a class with output to screen and e-mail
I'm using Monolog (https://github.com/Seldaek/monolog) in my PHP 8.1 project with no other framework (it's only a small project), it has a main class that does the bulk of the work and the main file. I want my program to write to the screen/a file…

trevrobwhite
- 443
- 1
- 7
- 22
0
votes
0 answers
CakePHP : Monolog package throw runtime exception and application stop working
composer.json packages as below,
"monolog/monolog": "~1.25.4",
"newrelic/monolog-enricher": "^1.0",
Below file is throwing run time exception,
vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php

hetal gohel
- 335
- 9
- 21
0
votes
1 answer
Monolog messages called multiple times
I am having a wrapper class for monolog as below
log.php

Alaksandar Jesus Gene
- 6,523
- 12
- 52
- 83
0
votes
1 answer
Monolog add additional data at the end when something is logged
Coming from Yii2 at the end of each request when something is logged, Yii2 adds additional data to your log, for example the $_POST data so you know what paramaters caused the issue.
Is there a way to add these information in Monolog too?
I don't…

Robin Schambach
- 617
- 3
- 11
- 26
0
votes
1 answer
Symfony custom channel / logger
I am trying to add a simple logger channel "brp" with the following SF6.2-DEV environment:
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
- brp
type:…

Alex.Barylski
- 2,843
- 4
- 45
- 68
0
votes
3 answers
How do I use Monolog with Symfony Mailer on Laravel 9?
I want that all errors that are logged with Monolog in my Laravel 9 application are sent to a predefined email address. Using SwiftMailer with Monolog has been deprecated (see this PR). Instead, Symfony Mailer should be used.
How do I use Monolog…

askuri
- 345
- 3
- 10
0
votes
0 answers
Access monolog configuration values
I need to get the list of available channels from monolog configuration file , whene i try to inject these parameters into my custom service like this
logger:
class: App\Services\Logger
arguments:
$channels: '%monolog.channels%'
i…
0
votes
1 answer
New lines in context data do not output valid json
Monolog version 2
Noticed when using in a Laravel project and trying to ingest logs into ELK.
Something like this:
Log::debug('Testing new lines in log context.', ['yep' => "This\nhas\nNew Lines."]);
Outputs
[2022-01-25 09:53:22] local.DEBUG:…

Liam Mitchell
- 1,001
- 13
- 23
0
votes
1 answer
Show container deprecation log in human-readable format?
I have a Symfony 5.3 application. When the container is compiled, the following file appears:
var/cache/dev/App_KernelDevDebugContainerDeprecations.log
In contains a serialized list of deprecation…

BenMorel
- 34,448
- 50
- 182
- 322
0
votes
1 answer
How to style (HTML) Monolog emails sent via Symfony Mailer
Due to depreciation, I'm converting my Monolog email logging from Swiftmailer to Symfony Mailer (as recommended here).
I have successfully completed the conversion and am receiving the emails.
However, with Swift Mailer all Monolog emails were…

GlennM
- 300
- 1
- 14
0
votes
1 answer
Make Laravel 6.x/Monolog output stack trace of previous exceptions
Laravel console exception output uses nunomaduro/collision package, which seems to merge the exception and all chained exception stack traces into one incredibly useful output.
Laravel log output however uses Monolog, which doesn't appear to do this…

Leigh Bicknell
- 854
- 9
- 19
0
votes
1 answer
How to log every request to the REST API in the Database?
I have a PHP application built in Symfony. All the infrastructure is on AWS. I also have multiple APIs which are hosted on a ec2 instance connected to a READ-ONLY replica of MySQL Aurora.
My question is how can I log(store in the DB) every API call…

rashidkhan
- 462
- 8
- 24
0
votes
0 answers
Laravel Log Content Before Being Written to File
I am trying to access the log output content in Laravel, before being written to a file.
I am searching for in on laravel/framework/src/Illuminate/Log/LogManager.php and the monolog/monolog package but do not find any related method for it.
I mean…

Majid Alaeinia
- 962
- 2
- 11
- 27
0
votes
1 answer
How to log request channel into a log file?
I am currently running a Symfony 5 project in dev environment.
I would like to output requests logs (like 10:01:39 request.INFO Matched route "login_route") into a file.
I have the following config/packages/dev/monolog.yaml file:
monolog:
…

jean553
- 621
- 10
- 29
0
votes
0 answers
Monolog : Large file loading issue
I am using monolog with Symfony for displaying contenet.
I am facing issues when the file is large like more than 120 m.b or g.b then the server is stuck.
I have also added pagination but didn't succeed with load performance.
Can anyone suggest to…

Preeti
- 11
- 2