monolog

Using Monolog WebProcessor with Laravel 5.6

房东的猫 提交于 2019-12-24 10:18:05
问题 I see that new logging stack/channels provides a way to tap or define handlers . However, I'm trying to get WebProcessor loaded and it doesn't seem to work. Should this be tapped? Or is there a different way to load this? This is specific to Laravel 5.6. Here is what I used in my older application that uses Laravel 5.2 ( bootstrap/app.php ): $app->configureMonologUsing(function (Monolog\Logger $monolog) { /* Include basic http props in logs */ $webProcessor = new Monolog\Processor

How to configure Monolog to send errors via SwiftMailer to alternate mailer in Symfony2

隐身守侯 提交于 2019-12-24 04:56:07
问题 In my symfony2 application I have two mailers, and I'd like to use the non-default mailer to send monolog errors. Errors are being sent as expected now, but I can't get it to send to the non default mailer. Here's my Swift Mailer configuration, in which I'd like to send errors using the "phpmail" mailer: Swiftmailer Configuration default_mailer: authsmtp mailers: authsmtp: transport: %mailer_transport% host: %mailer_host% username: %mailer_user% password: %mailer_password% port: %mailer_port%

How to use custom HandlerWrapper for Monolog in Symfony config.yml?

荒凉一梦 提交于 2019-12-23 06:06:09
问题 I would like to create a custom HandlerWrapper to use it with Monolog in my Symfony 2.8 project. The goal is to use this CustomHandler as a filter that decides wether the wrapped/nested handler is called or not. ============== UPDATE: The following question is already solved thanks to the answer of @Yonel. However this brought ab a new problem described below. Extending Monolog\Handler\HandlerWrapper is no problem of course. But I am struggling to us the custom class in the Monolog config

How to get Doctrine to log queries in Symfony2

落爺英雄遲暮 提交于 2019-12-22 04:31:23
问题 I'm pretty new to Symfony2, and I'm looking for a way to log SQL queries (including timings) to the same log file as the rest of my application. From what I can determine from the documentation this should all work out of the box, but after a few hours of trying I can't figure out what I'm doing wrong. config_dev.yml monolog: handlers: doctrine: action_level: debug type: stream path: %kernel.logs_dir%/%kernel.environment%_doctrine.log channels: doctrine config.yml # Doctrine Configuration

How to do advanced filtering of Monolog messages in Symfony?

℡╲_俬逩灬. 提交于 2019-12-22 03:51:03
问题 I am using the MonologBundle in my Symfony 2.8 project to manage log messages. Using different Handlers it is no problem to write logs to file and to send them by e-mail at the same time. I would like to reduce the number of messages I receive by mail. I already use the DeduplicationHandler and the FingersCrossed handler to filter by error level and to avoid duplicate messages. This works fine but is not enough. For example I would like to reduce the number of mail about PageNotFound errors.

How to log multiline entries with monolog like a formatted array?

China☆狼群 提交于 2019-12-21 07:49:23
问题 I am trying to log an array with monolog in symfony . $logger = $this->get('logger'); $logger->info(=print_R($user,true)); the output i get is not formatted as a print_r would be expected. It logs it all on one line. I do not have any monolog settings in my config.yml and suspect this may be the issue. How can I log a print_r(array) using monolog so it displays formatted in a tail -f ? 回答1: Monolog uses Monolog\Formatter\LineFormatter by default without any arguments. Formatter is basically

What is the correct configuration for Monolog / Swiftmailer Html Formatter in Symonfy2?

◇◆丶佛笑我妖孽 提交于 2019-12-21 04:16:07
问题 I'm having trouble setting up Monolog to use Swiftmailer and the Html formatter. I have multiple monolog handlers and swiftmail mailers which might be the issue. Here's my config.yml Monolog section: services: monolog.formatter.html: class: Monolog\Formatter\HtmlFormatter monolog: channels: ["orders", "support"] handlers: # Called orders: type: stream path: "%kernel.logs_dir%/%kernel.environment%_orders.log" level: info channels: orders # Called support: type: fingers_crossed action_level:

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

五迷三道 提交于 2019-12-20 02:06:12
问题 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() { app()->configureMonologUsing(function(\Monolog\Logger $monolog) { $monolog->pushHandler(new HandlerClass()); }); } However, I have noticed over logger will overwrite another logger... How do I stack these? I've tried to use boot() as well, and that didn't work

How to configure Monolog to store logs into MongoDB with Symfony2 and Doctrine

萝らか妹 提交于 2019-12-19 10:23:30
问题 Would it be possible to get a full example of how is it possible to configure Monolog to store its logs into MongoDB using Symfony 2.6 and Doctrine 2? 回答1: Full configuration /app/parameters.yml mongodb_server: "mongodb://localhost:27017" mongodb_username: "vagrant" mongodb_password: "password" mongodb_database: "testdb" /app/config.yml # Doctrine2 MongoDB Bundle # http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html doctrine_mongodb: default_database: %mongodb_database%

Composer 安装与使用

本小妞迷上赌 提交于 2019-12-17 08:55:38
Composer 是 PHP 的一个依赖管理工具。我们可以在项目中声明所依赖的外部工具库,Composer 会帮你安装这些依赖的库文件,有了它,我们就可以很轻松的使用一个命令将其他人的优秀代码引用到我们的项目中来。 Composer 默认情况下不是全局安装,而是基于指定的项目的某个目录中(例如 vendor)进行安装。 Composer 需要 PHP 5.3.2+ 以上版本,且需要开启 openssl。 Composer 可运行在 Windows 、 Linux 以及 OSX 平台上。 Composer 的安装 Wondows 平台 Wondows 平台上,我们只需要下载 Composer-Setup.exe 后,一步步安装即可。 需要注意的是你需要开启 openssl 配置,我们打开 php 目录下的 php.ini,将 extension=php_openssl.dll 前面的分号去掉就可以了。 安装成功后,我们可以通过命令窗口(cmd) 输入 composer --version 命令来查看是否安装成功: 接下来我们可以更改 Packagist 为国内镜像: composer config -g repo.packagist composer https://packagist.phpcomposer.com Linux 平台 Linux 平台可以使用以下命令来安装: #