monolog

Symfony2 Monolog configure to use raven handler (Sentry)

杀马特。学长 韩版系。学妹 提交于 2019-12-10 13:47:28
问题 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 handler, but unfortunately I haven't found documentation about it. config.yml would be something like: monolog: handlers: sentry: type: stream level: error //Log to database parameter (raven for sentry) Does anybody knows the right configuration? 回答1:

yaml/symfony2: Override configurations

亡梦爱人 提交于 2019-12-10 13:32:49
问题 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: %kernel.logs_dir%/%kernel.environment%.log level: debug firephp: type: firephp level: info In my test environment, I want no logger at all. So I tried monolog: ~ with no effect. I also tried: monolog: handlers: main: ~ firephp: ~ again without any effect. Then I tested monolog: handlers: main: type: ~ path: ~ level

Symfony doesn't create logs in production environment

偶尔善良 提交于 2019-12-08 04:50:55
问题 I'm having yet another weird case where Symfony 3.3 doesn't produce logs in production environment. My main config has following monolog section: monolog: channels: - job.execution - job.clean-up - job.notification handlers: main: type: rotating_file max_files: 10 path: '%kernel.logs_dir%/%kernel.environment%/application.log' level: debug formatter: Monolog\Formatter\LineFormatter channels: - '!event' - '!job.execution' - '!job.clean-up' - '!job.notification' console: type: console channels:

Monolog - logging only specific level of errors

六眼飞鱼酱① 提交于 2019-12-08 02:22:13
问题 I am using Monolog in vanilla PHP application. I'd like to log errors of only specific level - INFO and not above , since I have other handlers for that. Here's my code: <?php $logger = new Logger('mylogger'); $logger->pushHandler(new StreamHandler(__DIR__.'/log/errors.log', Logger::WARNING)); $logger->pushHandler(new StreamHandler(__DIR__.'/log/info.log', Logger::INFO)); Is there any way to log just INFO mesages to info.log ? 回答1: I had the same issue today which brought me to here. Anyway I

Send email when error occurs in console command of Symfony2 app

折月煮酒 提交于 2019-12-07 12:08:27
问题 How is it possible to send email with log when something wrong in console command? Currently I've configured my app to send emails from web interface and it works correctly. Swiftmailer spool is disabled. My config is: monolog: handlers: main: type: fingers_crossed action_level: critical handler: grouped grouped: type: group members: [streamed, buffered] streamed: type: stream path: "%kernel.logs_dir%/%kernel.environment%.log" level: debug buffered: type: buffer handler: swift swift: type:

Laravel Log useFiles method is making Log write in multiple files

女生的网名这么多〃 提交于 2019-12-07 11:43:21
问题 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 this: Class Mailer { static function init() { Log::useFiles(storage_path('logs/mandrill-'.date("Y-m-d").'.log')); } static function send() { // some code here... Log::error("Email not sent"); } } And I am ending up with log being written in both Laravel

How come log lines written by Monolog don't get messed/mixed up when two script instances are writing to log concurrently?

纵饮孤独 提交于 2019-12-06 10:38:54
问题 When using Monolog with StreamHandler , it is normal situation that several instances of PHP script would be writing to the same log file in parallel. (eg. in my Symfony application, when mulitple users open "Login page" at the same time, it would result in multiple instances of my app script ( app.php ) running and thus two instances of Monolog StreamHandler would be writing into same app/logs/prod.log .) How come that despite of concurrent writing to the file, each log lines is not broken

Monolog - logging only specific level of errors

时光怂恿深爱的人放手 提交于 2019-12-06 07:35:36
I am using Monolog in vanilla PHP application. I'd like to log errors of only specific level - INFO and not above , since I have other handlers for that. Here's my code: <?php $logger = new Logger('mylogger'); $logger->pushHandler(new StreamHandler(__DIR__.'/log/errors.log', Logger::WARNING)); $logger->pushHandler(new StreamHandler(__DIR__.'/log/info.log', Logger::INFO)); Is there any way to log just INFO mesages to info.log ? I had the same issue today which brought me to here. Anyway I solved it by using Monologs FilterHandler . The FilterHandler allows you to pass in another handler as an

Why does Symfony still log to a dev.log file, even when I didn't define it in a loghandler?

纵然是瞬间 提交于 2019-12-06 03:55:58
问题 During the execution of Symfony Commands, I want to log messages to a different file. I have read the Symfony and Monolog documentation, and it should work like I describe here. (Note that I know messages from the 'doctrine', 'event', ... channels will still be logged by the main handler, but that doesn't matter for me) In my config.yml , I have this: monolog: channels: [commandline] handlers: main: type: stream path: "%kernel.logs_dir%/%kernel.environment%.main.log" level: debug channels: [

win7安装composer

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 01:52:40
安装composer 1. 在Composer官网里下载 Composer-Setup.exe 2. 一键式安装,Settings Check选择php.exe的地址 Proxy Settings不需要填 验证composer 打开DOS窗口,输入composer,有下界面的图形则成功 使用composer 需要使用composer在项目下加入QueryList包 在项目目录下新建composer.json { "require": { "guzzlehttp/guzzle": "6.2.*", "jaeger/g-http": "^1.1", "monolog/monolog": "1.2.*", "jaeger/querylist": "^4.0", "jaeger/querylist-rule-baidu": "^4.0" } } 使用DOS进入到项目目录下,执行composer install,会出现vendor文件夹和composer.lock文件 如果已执行过composer install,需要新增QueryLlist则可以使用下边的方法 在composer.json里添加 "jaeger/querylist": "^4.0" 并执行composer update 或者直接执行 composer require jaeger/querylist 来源: https:/