Questions tagged [monolog]

Monolog is a logging library for PHP 5.3 used by Symfony2. It is inspired by the Python LogBook library.

514 questions
6
votes
2 answers

Trying to create custom log channel Laravel 5.6

Inside config/logging.php: 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'mongo'], ], 'mongo' => [ 'driver' => 'monolog', 'handler' =>…
Tarasovych
  • 2,228
  • 3
  • 19
  • 51
6
votes
2 answers

Milliseconds in \Monolog\Formatter\LineFormatter (PHP)

I use Cascade'ed Monolog and configure loggers using YAML. This is a part of my config: formatters: dashed: class: Monolog\Formatter\LineFormatter format: "%datetime%-%channel%.%level_name% - %message%\n" This is a formatted log…
Alex Gusev
  • 1,526
  • 3
  • 16
  • 35
6
votes
3 answers

Monolog RotatingFileHandler save to a specific file according to log type

I'm trying to do something with monolog that I'm not sure it's possible. So I was thinking of a practical way to organize the log files. First I thought to have 3 different files, INFO, WARNING and ERROR, but it would be difficult to search a…
Carla Sousa
  • 393
  • 4
  • 12
6
votes
1 answer

Symfony 2: Injecting logger for specific channel/handler to services

I am working on a Symfony 2 web app and I would like to inject a Monolog logger using a specific channel to a service: The Config: monolog: handlers: main: type: stream path:…
Andrei Herford
  • 17,570
  • 19
  • 91
  • 225
6
votes
1 answer

to send logs from php application to graylog using monolog

I have installed graylog server and its dependencies.Trying to send logs from my php application to graylog server using Monolog. But I am not aware of how to use the Gelf handler.I have seen the GelfHandlerTest.php that is present inside the…
Rajeshwar
  • 391
  • 1
  • 5
  • 19
6
votes
1 answer

How to Turn off Debugging Logs with Monolog

I'm using Monolog in a project, it's not Symfony, just my own application that uses the stand-alone Monolog composer package. What I'd like to do is programmatically turn off debugging logs. I'm writing to a log file and I'm using the…
Halfstop
  • 1,710
  • 17
  • 34
6
votes
2 answers

Monolog: how to catch all errors and exceptions

I'm missing something really obvious. How can I make monolog record all php errors, php user errors, and exceptions? Before using monolog, I wrote my own functions which I passed to set_error_handler(), register_shutdown_function() and…
Jodes
  • 14,118
  • 26
  • 97
  • 156
6
votes
1 answer

Laravel Log useFiles method is making Log write in multiple files

I am using Laravel Log Facade in my app. And I have several services like Mandrill, Twilio, Stripe, etc., that need to be logged in separate file. But when I use Log::useFiles() to set separate file for one of the service wrapper class, like…
Mladen Janjetovic
  • 13,844
  • 8
  • 72
  • 82
6
votes
1 answer

conditionally create and save separate log file in php/symfony2

On a project i am working we use Symfony2 console commands to run image converting (using LaTeX and some imagick). Due to the nature of project, not all conditions may be met during the console command run so the execution will fail, to be later…
Eduard Sukharev
  • 1,188
  • 2
  • 15
  • 37
6
votes
1 answer

Configure symfony monolog to keep apache logs

I'm using the below Monolog configuration in Symfony 2 to log lesser errors in files in the /app/logs/ directory and send emails for all critical errors. monolog: handlers: main: level: error type: stream …
trajan
  • 416
  • 1
  • 4
  • 10
6
votes
3 answers

Log Fatal errors in symfony

I'm trying to configure an email logging in Symfony. I followed the cookbook and it works but I have a problem with Fatal errors. Those errors aren't logged in prod mode. I figured out that when I add Debug::enable(); to app.php, the error get…
Nemo64
  • 2,535
  • 3
  • 20
  • 24
6
votes
1 answer

how to use swiftmailer handler with monolog

i would like to know how exactly to use SwiftMailerHandler within Monolog packagist? In the Monolog documentation i don't see any usage example regarding SwiftMailerHandler or maybe i missed out. Here is the SwiftMailerHandler constructor code: …
Firman Hidayat
  • 415
  • 4
  • 13
6
votes
1 answer

how are channels defined in symfony monolog?

I've spent several hours going over the monolog documentation.. and I just couldn't figure out this basic question: how are channels defined in monolog? I got this symfony2 project that has this in the config.yml file: monolog: handlers: …
abbood
  • 23,101
  • 16
  • 132
  • 246
6
votes
2 answers

Symfony2 Monolog configure to use raven handler (Sentry)

I want to use sentry to evaluate possible errors, exceptions, etc. I tried to use the KunstmaanSentryBundle and it's great to catch all kind of errors like undefined functions and so on, but I want to define my own Monolog channel with it's own…
felipep
  • 2,442
  • 1
  • 28
  • 35
6
votes
3 answers

yaml/symfony2: Override configurations

I wanto to override some configurations from config_dev.yml in my config_test.yml. So, imagine the following part in the config_dev.yml: monolog: handlers: main: type: stream path:…
Sgoettschkes
  • 13,141
  • 5
  • 60
  • 78