{"action":"created","issue":{"url":"https://api.github.com/repos/javan/whenever/issues/564","labels_url":"https://api.github.com/repos/javan/whenever/issues/564/labels{/name}","comments_url":"https://api.github.com/repos/javan/whenever/issues/564/comments","events_url":"https://api.github.com/repos/javan/whenever/issues/564/events","html_url":"https://github.com/javan/whenever/issues/564","id":87305914,"number":564,"title":"Rails logger to stdout","user":{"login":"naps62","id":283819,"avatar_url":"https://avatars.githubusercontent.com/u/283819?v=3","gravatar_id":"","url":"https://api.github.com/users/naps62","html_url":"https://github.com/naps62","followers_url":"https://api.github.com/users/naps62/followers","following_url":"https://api.github.com/users/naps62/following{/other_user}","gists_url":"https://api.github.com/users/naps62/gists{/gist_id}","starred_url":"https://api.github.com/users/naps62/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naps62/subscriptions","organizations_url":"https://api.github.com/users/naps62/orgs","repos_url":"https://api.github.com/users/naps62/repos","events_url":"https://api.github.com/users/naps62/events{/privacy}","received_events_url":"https://api.github.com/users/naps62/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-11T11:10:26Z","updated_at":"2015-12-01T11:20:00Z","closed_at":null,"body":"I want my whenever jobs to also output Rails logger messages to log/whenever.log. I know by default, STDOUT is redirected, which allows me to use `puts \"message\"`. But what I really want is to be able to do `Rails.logger.info \"message\"\r\n\r\nWhat I'm doing right now is this:\r\n\r\n```ruby\r\n# config/schedule.rb\r\n\r\nenv 'WHENEVER', true\r\n```\r\n\r\n```ruby\r\n# config/initializers/0_logging.rb\r\n\r\nif ENV['WHENEVER']\r\n  Rails.logger = Logger.new(Rails.root.join('log', 'whenever.log'))\r\nend\r\n```\r\n\r\nNotice that I have to name the initializer `0_logging.rb` to make sure it is loaded first. This is because, in other initializers, I'm redirecting other loggers to the Rails logger (I'm using some other gems which also have their own loggers), so it has to already be set by then.\r\nSo I was wondering if there was a more sane way to do this?\r\n\r\nI would think this is a common requirement, but I couldn't find anything on this"},"comment":{"url":"https://api.github.com/repos/javan/whenever/issues/comments/160938738","html_url":"https://github.com/javan/whenever/issues/564#issuecomment-160938738","issue_url":"https://api.github.com/repos/javan/whenever/issues/564","id":160938738,"user":{"login":"rafaltrojanowski","id":1567767,"avatar_url":"https://avatars.githubusercontent.com/u/1567767?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaltrojanowski","html_url":"https://github.com/rafaltrojanowski","followers_url":"https://api.github.com/users/rafaltrojanowski/followers","following_url":"https://api.github.com/users/rafaltrojanowski/following{/other_user}","gists_url":"https://api.github.com/users/rafaltrojanowski/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaltrojanowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaltrojanowski/subscriptions","organizations_url":"https://api.github.com/users/rafaltrojanowski/orgs","repos_url":"https://api.github.com/users/rafaltrojanowski/repos","events_url":"https://api.github.com/users/rafaltrojanowski/events{/privacy}","received_events_url":"https://api.github.com/users/rafaltrojanowski/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T11:20:00Z","updated_at":"2015-12-01T11:20:00Z","body":"+1"}}