{"action":"created","issue":{"url":"https://api.github.com/repos/magento/magento2/issues/12349","repository_url":"https://api.github.com/repos/magento/magento2","labels_url":"https://api.github.com/repos/magento/magento2/issues/12349/labels{/name}","comments_url":"https://api.github.com/repos/magento/magento2/issues/12349/comments","events_url":"https://api.github.com/repos/magento/magento2/issues/12349/events","html_url":"https://github.com/magento/magento2/pull/12349","id":275187023,"node_id":"MDExOlB1bGxSZXF1ZXN0MTUzNTEyNTY4","number":12349,"title":"Add configurable Monolog configuration","user":{"login":"elzekool","id":2158053,"node_id":"MDQ6VXNlcjIxNTgwNTM=","avatar_url":"https://avatars1.githubusercontent.com/u/2158053?v=4","gravatar_id":"","url":"https://api.github.com/users/elzekool","html_url":"https://github.com/elzekool","followers_url":"https://api.github.com/users/elzekool/followers","following_url":"https://api.github.com/users/elzekool/following{/other_user}","gists_url":"https://api.github.com/users/elzekool/gists{/gist_id}","starred_url":"https://api.github.com/users/elzekool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elzekool/subscriptions","organizations_url":"https://api.github.com/users/elzekool/orgs","repos_url":"https://api.github.com/users/elzekool/repos","events_url":"https://api.github.com/users/elzekool/events{/privacy}","received_events_url":"https://api.github.com/users/elzekool/received_events","type":"User","site_admin":false},"labels":[{"id":703232382,"node_id":"MDU6TGFiZWw3MDMyMzIzODI=","url":"https://api.github.com/repos/magento/magento2/labels/Release%20Line:%202.2","name":"Release Line: 2.2","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"sivaschenko","id":2028541,"node_id":"MDQ6VXNlcjIwMjg1NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/2028541?v=4","gravatar_id":"","url":"https://api.github.com/users/sivaschenko","html_url":"https://github.com/sivaschenko","followers_url":"https://api.github.com/users/sivaschenko/followers","following_url":"https://api.github.com/users/sivaschenko/following{/other_user}","gists_url":"https://api.github.com/users/sivaschenko/gists{/gist_id}","starred_url":"https://api.github.com/users/sivaschenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivaschenko/subscriptions","organizations_url":"https://api.github.com/users/sivaschenko/orgs","repos_url":"https://api.github.com/users/sivaschenko/repos","events_url":"https://api.github.com/users/sivaschenko/events{/privacy}","received_events_url":"https://api.github.com/users/sivaschenko/received_events","type":"User","site_admin":false},"assignees":[{"login":"sivaschenko","id":2028541,"node_id":"MDQ6VXNlcjIwMjg1NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/2028541?v=4","gravatar_id":"","url":"https://api.github.com/users/sivaschenko","html_url":"https://github.com/sivaschenko","followers_url":"https://api.github.com/users/sivaschenko/followers","following_url":"https://api.github.com/users/sivaschenko/following{/other_user}","gists_url":"https://api.github.com/users/sivaschenko/gists{/gist_id}","starred_url":"https://api.github.com/users/sivaschenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivaschenko/subscriptions","organizations_url":"https://api.github.com/users/sivaschenko/orgs","repos_url":"https://api.github.com/users/sivaschenko/repos","events_url":"https://api.github.com/users/sivaschenko/events{/privacy}","received_events_url":"https://api.github.com/users/sivaschenko/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2017-11-19T19:58:52Z","updated_at":"2018-11-05T17:52:57Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/magento/magento2/pulls/12349","html_url":"https://github.com/magento/magento2/pull/12349","diff_url":"https://github.com/magento/magento2/pull/12349.diff","patch_url":"https://github.com/magento/magento2/pull/12349.patch"},"body":"The Magento Log setup is made so that it is similar to Magento 1. In the cases where you want to extend this functionality or change the way logging is configured you have to write a custom module.\r\n\r\nThis change makes it possible to add custom log channels and configuration in env.php without adding an extra module.\r\n\r\n### Description\r\nFor multiple clients we implement custom logging, we do this now using a custom module as it requires changing preferences in the DI configuration.\r\n\r\nThis pull request introduces the possibility of configuring your log from `env.php`. It also implements the concept of log channels but in this initial version there is only one channel \"main\" as there was before.\r\n\r\nThe configuration of logging is done in the `logging` array key in `env.php`. The format is very close to a popular package called Monolog Cascade. Here is an example configuration:\r\n\r\n```\r\n'logging' => array(\r\n    'formatters' => array(\r\n        'only_extra' => array(\r\n            'class' => '\\Monolog\\Formatter\\LineFormatter',\r\n            'format' => \"[%datetime%] %channel%.%level_name%: %extra%\\n\"\r\n        )\r\n    ),    \r\n    'handlers' => array(\r\n        'system_group' => array(\r\n            'class' => '\\Monolog\\Handler\\GroupHandler',\r\n            'handlers' => array('system', 'screen'),\r\n            'formatter' => 'only_extra',\r\n            'processors' => array('introspect')\r\n        ),\r\n        'system' => array(\r\n            'class' => '\\Magento\\Framework\\Logger\\Handler\\System'\r\n        ),\r\n        'screen' => array(\r\n            'class' => '\\Monolog\\Handler\\StreamHandler',\r\n            'stream' => 'php://stderr',\r\n            'level' => \\Monolog\\Logger::DEBUG\r\n        ),\r\n        'debug' => array(\r\n            'class' => '\\Magento\\Framework\\Logger\\Handler\\Debug'\r\n        )\r\n    ),\r\n    'processors' => array(\r\n        'uid' => '\\Monolog\\Processor\\UidProcessor',\r\n        'introspect' => array(\r\n            'class' => '\\Monolog\\Processor\\IntrospectionProcessor',\r\n            'level' => \\Monolog\\Logger::DEBUG\r\n        )\r\n    ),\r\n    'channels' => array(\r\n        'main' => array(\r\n            'handlers' => array('system_group', 'debug'),\r\n            'processors' => array('uid')\r\n        )\r\n    )\r\n),\r\n```\r\n**formatters**, **handlers** and **processors** are all configuration items for there respectable types. The array keys of each item are also they keys/identifiers they can be mapped with. Every item in those type arrays can either be an string which is then interpreted as a class name (example: `'uid' => '\\Monolog\\Processor\\UidProcessor'` and loaded from DI or an array.\r\n\r\nThis array has one required key and that is `class`. This is the class name that should be instantiated. This instantiation is done trough the ObjectManager so preferences are correctly used. The rest of the values are as-is passed to the constructor. With the exception of the following keys:\r\n\r\n* `class`: Contains the class name.\r\n* `handlers` (only for handlers): Every item in the array is looked up from the list of defined handlers by there key name. \r\n* `handler` (only for handlers): The corresponding handler is resolved by the given key name\r\n* `processors` (only for handlers): The corresponding processor is loaded by the given key name. Processors are added after instantiation to the handler with `pushProcessor`.\r\n* `formatter` (only for handlers): The corresponding formatter is resolved by the given key name.\r\n* Every key that starts with `@` is seen as a class instantiation. The allowed values are a string with a class name or an array that contains the `class` key with optional other constructor arguments. When given as a constructor argument the `@` character is stripped of.\r\n\r\n**channels** contain the different channel configurations. The default channel is called `main`. A channel can contain a list of handlers and processors. \r\n\r\nWith code generation it is automatically possible to load a LoggerInterface for a specific channel. An example of this is `Magento\\Framework\\Logger\\MainLogchannel` that gives a logger for the `main` channel or `Magento\\Framework\\Logger\\DatabaseLogchannel` that will give a logger for the `database` channel. \r\n\r\nWhen a channel is requested that is not available in the channel configuration will give an instance of `\\Magento\\Framework\\Logger\\Monolog` for backwards compatibility. \r\n\r\n### Manual testing scenarios\r\n1. Clear all generated files, etc. On `cache:flush` it should trigger some log lines as it clears some keys. \r\n2. Add the given configuration above to `env.php` and again clear all generated files. On `cache:flush` it not only should still write to the original files but also show some log lines on the screen containing a random `uid` (from the `UidProcessor`) and without any message due to the format in the configured `LineFormatter`.\r\n\r\n### Contribution checklist\r\n - [x] Pull request has a meaningful description of its purpose\r\n - [x] All commits are accompanied by meaningful commit messages\r\n - [ ] All new or changed code is covered with unit/integration tests (if applicable)\r\n - [ ] All automated tests passed successfully (all builds on Travis CI are green)\r\n"},"comment":{"url":"https://api.github.com/repos/magento/magento2/issues/comments/435970020","html_url":"https://github.com/magento/magento2/pull/12349#issuecomment-435970020","issue_url":"https://api.github.com/repos/magento/magento2/issues/12349","id":435970020,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTk3MDAyMA==","user":{"login":"sivaschenko","id":2028541,"node_id":"MDQ6VXNlcjIwMjg1NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/2028541?v=4","gravatar_id":"","url":"https://api.github.com/users/sivaschenko","html_url":"https://github.com/sivaschenko","followers_url":"https://api.github.com/users/sivaschenko/followers","following_url":"https://api.github.com/users/sivaschenko/following{/other_user}","gists_url":"https://api.github.com/users/sivaschenko/gists{/gist_id}","starred_url":"https://api.github.com/users/sivaschenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivaschenko/subscriptions","organizations_url":"https://api.github.com/users/sivaschenko/orgs","repos_url":"https://api.github.com/users/sivaschenko/repos","events_url":"https://api.github.com/users/sivaschenko/events{/privacy}","received_events_url":"https://api.github.com/users/sivaschenko/received_events","type":"User","site_admin":false},"created_at":"2018-11-05T17:52:57Z","updated_at":"2018-11-05T17:52:57Z","author_association":"CONTRIBUTOR","body":"Hi @elzekool, thanks for your contribution and sorry for slow processing!\r\n\r\nGive us another chance :), can you please port the pull request to 2.3-develop branch (see the [porting](https://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#rules) section of the contributor guide for more details) as 2.2-develop does not accept features anymore"}}
{"actor":{"display_login":"sivaschenko"}}