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
4
votes
1 answer

Symfony2 Monolog email only some exceptions

I am using Monolog in a Symfony2 project and I'm getting tired of seeing exception emails that occur because of Access Denied and a few other cases that are not interesting to me (there are automated requests that cause this). Is there a way to…
Tower
  • 98,741
  • 129
  • 357
  • 507
4
votes
1 answer

No logging in production environment when running Console commands

When running Console commands in prod mode, I need to log Doctrine related debug messages. Everything works fine in dev with the following configuration, so I assume I forgot something to set when in prod? My system: PHP 7.3 Symfony…
k00ni
  • 315
  • 4
  • 17
4
votes
2 answers

How to config symfony to log deprecations?

I'd like to upgrade from Symfony 4.4. to 5.0. So I have to check for deprecations in the code. The symfony migration guide says I have to use the web dev toolbar, but in my API-app there is no frontend for the tool-bar. How can I configure…
oceanBT
  • 204
  • 6
  • 11
4
votes
1 answer

How to output a string with new lines in a log file using Monolog?

I am trying to print out this: return $message . "\n\n in: " . $file . "\n\n Line: " . $line ."\n\n\n Trace: \n\n". $trace; the \n do not work when passing it though: $this->logger->info($message, $variables); I get everything in one line in…
Imnotapotato
  • 5,308
  • 13
  • 80
  • 147
4
votes
1 answer

How I make log by day in Symfony

community. I need make logs files daily with Symfony4; or push a current date in a yml file. Specifically in monologo.yml. handlers: app: type: stream path: "%kernel.logs_dir%/system_compact_%kernel.environment%-***date***.log" …
4
votes
2 answers

Monolog implementation with common class

I succeeded in implementing a Monolog logger for test purposes. And now I'm trying to use it in a project. This project doesn't use any MVC framework. I'm trying to write a common class file to wrap access to the Monolog instance. Common class…
Raja
  • 3,477
  • 12
  • 47
  • 89
4
votes
1 answer

Send error log to slack [Logger::getMonolog() undefined]

I want to send logs directly to slack channell. Service provider that I make for Laravel projects works great but when I add provider to Lumen I got error: Call to undefined method Monolog\Logger::getMonolog() This is boot method in my…
nicponim
  • 41
  • 1
  • 4
4
votes
0 answers

Visual Studio Code debugging PHP and logging

I am debugging server side PHP code in Visual Studio Code with PHP Debug -extension and Xdebug. I am also using Monolog as a logger for my project. Is it possible to print Monolog logs into VSCode Debug Console? I would like to see the outputs while…
ikenator
  • 670
  • 8
  • 22
4
votes
4 answers

Laravel: multiple log providers using `configureMonologUsing()`?

I'm using configureMonologUsing() to add in two custom loggers. Doing the standard SOLID principal, I have two providers: ConsoleLoggerProvider and MailLogProvider. Both of these have a register similar to: public function register() { …
guice
  • 976
  • 4
  • 11
  • 31
4
votes
2 answers

How do I change the default file permissions for log files created by PHP Monologger?

Laravel documentation shows that you can define custom configurations for your Monologger by placing the following code into your bootstrap/app.php file: $app->configureMonologUsing(function($monolog) { $monolog->pushHandler(); }); What are…
Anamus
  • 43
  • 1
  • 5
4
votes
1 answer

Having mapping issues when trying to save monolog logs into Elasticsearch use ElasticsearchHandler

I'm trying to start sending my logs into elastic search using monolog. (I'm using Symfony2). I've set up monolog like this: monolog: handlers: elasticsearch: elasticsearch: host: %logger_elastic_host% …
Fabrice Kabongo
  • 671
  • 10
  • 23
4
votes
3 answers

Disable Log::info in production using Laravel

I assumed that by default the Log::info calls wouldn't log in production, but they are still coming in. Im setting production using my .env file APP_ENV=production APP_DEBUG=false Ive tried these commands as well, but no luck composer…
Parampal Pooni
  • 2,958
  • 8
  • 34
  • 40
4
votes
2 answers

Laravel 5.2 Monolog to output in Chrome console

I'm trying to implement monolog so it outputs to chrome console. So far I have this, but when I log a message it doesn't output anything. Is there anything else that needs to be done to make this work that I've missed? In the past in CakePHP or…
mtpultz
  • 17,267
  • 22
  • 122
  • 201
4
votes
1 answer

Laravel Monolog. Log INFO level to separate file

How to specify a separate file for logging INFO level in Laravel 5.1 and monolog?
Dmitrii G.
  • 895
  • 1
  • 7
  • 21
4
votes
1 answer

Monolog, log class and method names

I use Monolog 1.10 as logging tool. Along with the date and loglevel I need to persist class and method names from which logging method has been called. Seems that I need to configure formatter. But I could not find any examples for such case. How…
Victor Mezrin
  • 2,797
  • 2
  • 32
  • 48