{"action":"created","issue":{"url":"https://api.github.com/repos/Seldaek/monolog/issues/500","labels_url":"https://api.github.com/repos/Seldaek/monolog/issues/500/labels{/name}","comments_url":"https://api.github.com/repos/Seldaek/monolog/issues/500/comments","events_url":"https://api.github.com/repos/Seldaek/monolog/issues/500/events","html_url":"https://github.com/Seldaek/monolog/issues/500","id":55811189,"number":500,"title":"Logging should be idempotent and not affect application state","user":{"login":"paracycle","id":224488,"avatar_url":"https://avatars.githubusercontent.com/u/224488?v=3","gravatar_id":"","url":"https://api.github.com/users/paracycle","html_url":"https://github.com/paracycle","followers_url":"https://api.github.com/users/paracycle/followers","following_url":"https://api.github.com/users/paracycle/following{/other_user}","gists_url":"https://api.github.com/users/paracycle/gists{/gist_id}","starred_url":"https://api.github.com/users/paracycle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paracycle/subscriptions","organizations_url":"https://api.github.com/users/paracycle/orgs","repos_url":"https://api.github.com/users/paracycle/repos","events_url":"https://api.github.com/users/paracycle/events{/privacy}","received_events_url":"https://api.github.com/users/paracycle/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-01-28T20:32:02Z","updated_at":"2015-01-29T22:17:27Z","closed_at":"2015-01-29T18:20:08Z","body":"I have just ran into a problem with Monolog and file permissions. While I realize that I do need to solve the file permission problem on its own; the behaviour of Monolog in this situation really surprised me.\r\n\r\nI would expect a logging library to work in an idempotent manner and not affect the state of the application as a whole. However, Monolog (`StreamHandler` more specifically) intentionally chooses to throw an `UnexpectedValueException` if the output stream can't be opened. This, I find, is not acceptable in a logging framework. If the stream is not writable then all I'd be willing to lose is a few logs, not my whole application state.\r\n\r\nSuch behaviour _could_ make sense in a debug setting where one would like to be alerted of such problems and raising an exception could be made into a global or per handler flags that could be turned **on** (ie OFF by default).\r\n\r\nIf the author(s) of this library agree with me, I'd be willing to send a PR to this effect."},"comment":{"url":"https://api.github.com/repos/Seldaek/monolog/issues/comments/72115743","html_url":"https://github.com/Seldaek/monolog/issues/500#issuecomment-72115743","issue_url":"https://api.github.com/repos/Seldaek/monolog/issues/500","id":72115743,"user":{"login":"paracycle","id":224488,"avatar_url":"https://avatars.githubusercontent.com/u/224488?v=3","gravatar_id":"","url":"https://api.github.com/users/paracycle","html_url":"https://github.com/paracycle","followers_url":"https://api.github.com/users/paracycle/followers","following_url":"https://api.github.com/users/paracycle/following{/other_user}","gists_url":"https://api.github.com/users/paracycle/gists{/gist_id}","starred_url":"https://api.github.com/users/paracycle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paracycle/subscriptions","organizations_url":"https://api.github.com/users/paracycle/orgs","repos_url":"https://api.github.com/users/paracycle/repos","events_url":"https://api.github.com/users/paracycle/events{/privacy}","received_events_url":"https://api.github.com/users/paracycle/received_events","type":"User","site_admin":false},"created_at":"2015-01-29T22:17:27Z","updated_at":"2015-01-29T22:17:27Z","body":"@Seldaek Thank you for the time you are spending on this. Your proposed solution sounds very good and would definitely solve my original problem. I actually like the idea of failing fast and the proposed exception at initialization would provide even faster failure. In my opinion, an application that fails to start due to a misconfiguration is much better than an application that thinks everything is hunky dory until it later finds out it has to stop because it can't log.\r\n\r\nFor people who have more critical logging requirements, we could still have an optional flag to raise errors at logging time as well, if that's something that is highly desirable.\r\n\r\nIn the very least, @chriseskow has a very good point about better documentation on the fact that, by default, Monolog handlers _might_ be throwing exceptions if misconfigured."}}