monolog

Composer 安装和使用

♀尐吖头ヾ 提交于 2020-01-10 17:02:14
curl -sS https://getcomposer.org/installer | php //下载composer.phar 可执行文件 要检查 Composer 是否正常工作,只需要通过 php 来执行 PHAR: php composer.phar // sudo cp composer.phar /usr/local/bin/composer //执行composer验证,如果执行失败,进入/usr/local/bin/修改composer的权限 ls -al 查看用户权限 sudo chmod -R 755 composer 修改权限 执行composer 如果出现 安装成功 配置中国镜像 composer config -g repo.packagist composer https://packagist.phpcomposer.com init composer 进入新建文件夹下执行 composer init vi composer.json composer search monolog composer show --all monolog/monolog 在composer.json中加入monolog/monolog,类似cocopods中的Podfile文件 { "name": "imooc/test", "description": "test"

PHP 的一个依赖管理工具Composer

感情迁移 提交于 2020-01-07 06:39:58
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1:下载 curl -sS https://getcomposer.org/installer | php 或者 php -r "readfile('https://getcomposer.org/installer');" | php 2:移动到bin目录下,以后每次使用直接使用composer命令 mv composer.phar /usr/local/bin/composer 查看版本 composer -V 3.composer.json 在项目中安装monolog composer.json文件内容如下 { "require": { "monolog/monolog": "1.0.*" } } 使用composer install 安装,在当前目录下回创建vendor/monolog/monolog 目录 Composer 生成了一个 vendor/autoload.php 文件。你可以简单的引入这个文件,你会得到一个免费的自动加载支持。 这使得你可以很容易的使用第三方代码。项目依赖 monolog,你就可以像这样开始使用这个类库,并且他们将被自动加载。 $log = new Monolog\Logger('name'); $log->pushHandler(new Monolog\Handler

ThinkPHP开发必备composer扩展包

≡放荡痞女 提交于 2020-01-07 06:39:25
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 本文假设读者有能力正常使用composer 环境隔离 dotenv 真实世界的开发往往是这样, 多个团队成员共同开发, 线上线下的代码通过版本控制系统保持一致. 但你无法保证也没理由要求所有机器上的应用配置一致. 例如,要求所有成员使用相同的本地数据库用户名和密码是不合理的. 线上线下使用相同的数据库配置更加不合理. 我们有很多种方式避免这种问题, 一种常见的方法是, 将配置文件重命名为config.example.php, 然后在每个部署的环境再重命名为config.php,并在分发时排除这个文件. 这种方法很容易实现,但缺点是他是静态的. 每当你增加了一项配置, 或者减少了一项配置, 都需要告诉别人手动处理config.php. 否则, 它的程序可能无法正常运行. 通过专门的环境配置区分不同的部署环境,是另一种被广泛采用的方案. 它的原理很简单: 不同的部署环境中, 需要区别的配置往往非常有限, 所有将config.php纳入版本控制或者分发包中更合理. 这样config.php有变化时,其他环境中的应用可以第一时间更新. 那有限的几个有环境有关配置, 往往都是诸如数据库配置这种必不可少的. 将它们单独隔离出来更加合理. 通常, 实施这种方案会把 隔离的配置放在一个名为 .env 的文件中. 因此这种方案,

Monolog日志库简单介绍

家住魔仙堡 提交于 2020-01-07 00:50:42
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> php中的日志库 php中并没有内建的日志接口,故长期以来也没一个功能完备并且应用广泛的日志库。monolog是一个为5.3以上版本php开发的日志库,但是需要注意的是现在主干版本只支持php 7以上版本,如果你的服务器环境还是php 5的话,可以使用monolog的1.x版本。 monolog的github地址: https://github.com/Seldaek/monolog 中文文档地址: https://github.com/Clarence-pan/monolog-zh-doc psr规范官方地址: https://www.php-fig.org/psr 值得一提的是monolog是一个符合psr-3规范的日志类库,并且符合psr-4加载规范。这有利于松耦合的融入框架中。下面是正在使用monolog作为日志组件的框架。 框架集成 使用 PSR-3 的框架和库可以非常简单地集成 Monolog, 因为它实现了这个接口。 Symfony2 开箱即用 Monolog. Silex 开箱即用 Monolog. Laravel 4 & 5 开箱即用 Monolog. Lumen 开箱即用 Monolog. PPI 开箱即用 Monolog. CakePHP 可以通过 cakephp-monolog

Disable logging in Laravel?

拜拜、爱过 提交于 2020-01-06 11:16:44
问题 Is there any global configuration option to disable all logging? I don't just mean disabling the logging of errors. I mean actually disabling writing to the file when Log:: is called. 回答1: If you don't want to write to a log file you can simply comment out the following line in file start/global.php //Log::useFiles(storage_path().'/logs/laravel.log'); From this point on, your log file will never be updated. 来源: https://stackoverflow.com/questions/26321898/disable-logging-in-laravel

Disable logging in Laravel?

删除回忆录丶 提交于 2020-01-06 11:15:27
问题 Is there any global configuration option to disable all logging? I don't just mean disabling the logging of errors. I mean actually disabling writing to the file when Log:: is called. 回答1: If you don't want to write to a log file you can simply comment out the following line in file start/global.php //Log::useFiles(storage_path().'/logs/laravel.log'); From this point on, your log file will never be updated. 来源: https://stackoverflow.com/questions/26321898/disable-logging-in-laravel

Disable logging in Laravel?

∥☆過路亽.° 提交于 2020-01-06 11:15:04
问题 Is there any global configuration option to disable all logging? I don't just mean disabling the logging of errors. I mean actually disabling writing to the file when Log:: is called. 回答1: If you don't want to write to a log file you can simply comment out the following line in file start/global.php //Log::useFiles(storage_path().'/logs/laravel.log'); From this point on, your log file will never be updated. 来源: https://stackoverflow.com/questions/26321898/disable-logging-in-laravel

Prevent Internal Server Error with Symfony 2 / Monolog on failed gelf connection

删除回忆录丶 提交于 2020-01-04 02:19:25
问题 I'm trying to stream logs from a symfony 2 app to a graylog 2 server using the gelf format. My monolog configuration looks as follows: monolog: handlers: # --- 8< --- # ... # --- >8 --- graylog: type: gelf publisher: hostname: my-graylog-server.com port: 12201 level: debug formatter: app.gelf_formatter When the graylog server is not available, I get (understandably) a connection refused error [2017-07-28 16:03:25] app.ERROR: Failed to write to socket: fwrite(): send of 153 bytes failed with

symfony 2.4 can't get the doctrine channel in prod environment

不羁的心 提交于 2020-01-02 07:22:13
问题 I can't manage to get a log of the doctrine channel in my prod environment. I'm using symfony/symfony v2.4.6 symfony/monolog-bundle v2.6.0 doctrine/common v2.4.2 Here is my monolog config in config_prod.yml : monolog: handlers: doctrine: bubble: false action_level: DEBUG type: stream path: "%kernel.logs_dir%/%kernel.environment%_doctrine.log" channels: doctrine security: bubble: false action_level: DEBUG type: stream path: "%kernel.logs_dir%/%kernel.environment%_security.log" channels:

Symfony2 Monolog Settings for email and file logging

回眸只為那壹抹淺笑 提交于 2019-12-31 23:02:06
问题 I want to setup Symfony2 to send me an email for critical errors, but just log error level errors. Will the following settings do that? monolog: handlers: main: type: fingers_crossed action_level: error handler: grouped grouped: type: group members: [filelog, mail] # log all errors to file filelog: type: fingers_crossed action_level: error handler: nested_stream nested_stream: type: stream path: "%kernel.logs_dir%/%kernel.environment%.log" level: debug # send me an email when we have a