{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/hhvm/issues/3558","labels_url":"https://api.github.com/repos/facebook/hhvm/issues/3558/labels{/name}","comments_url":"https://api.github.com/repos/facebook/hhvm/issues/3558/comments","events_url":"https://api.github.com/repos/facebook/hhvm/issues/3558/events","html_url":"https://github.com/facebook/hhvm/issues/3558","id":40930041,"number":3558,"title":"ini_set error_log not working","user":{"login":"kristapsk","id":4500994,"avatar_url":"https://avatars.githubusercontent.com/u/4500994?v=3","gravatar_id":"","url":"https://api.github.com/users/kristapsk","html_url":"https://github.com/kristapsk","followers_url":"https://api.github.com/users/kristapsk/followers","following_url":"https://api.github.com/users/kristapsk/following{/other_user}","gists_url":"https://api.github.com/users/kristapsk/gists{/gist_id}","starred_url":"https://api.github.com/users/kristapsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristapsk/subscriptions","organizations_url":"https://api.github.com/users/kristapsk/orgs","repos_url":"https://api.github.com/users/kristapsk/repos","events_url":"https://api.github.com/users/kristapsk/events{/privacy}","received_events_url":"https://api.github.com/users/kristapsk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/hhvm/labels/hi-pri","name":"hi-pri","color":"f7c6c7"},{"url":"https://api.github.com/repos/facebook/hhvm/labels/ini","name":"ini","color":"bfd4f2"},{"url":"https://api.github.com/repos/facebook/hhvm/labels/php5%20incompatibility","name":"php5 incompatibility","color":"837ced"}],"state":"open","locked":false,"assignee":{"login":"JoelMarcey","id":3757713,"avatar_url":"https://avatars.githubusercontent.com/u/3757713?v=3","gravatar_id":"","url":"https://api.github.com/users/JoelMarcey","html_url":"https://github.com/JoelMarcey","followers_url":"https://api.github.com/users/JoelMarcey/followers","following_url":"https://api.github.com/users/JoelMarcey/following{/other_user}","gists_url":"https://api.github.com/users/JoelMarcey/gists{/gist_id}","starred_url":"https://api.github.com/users/JoelMarcey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoelMarcey/subscriptions","organizations_url":"https://api.github.com/users/JoelMarcey/orgs","repos_url":"https://api.github.com/users/JoelMarcey/repos","events_url":"https://api.github.com/users/JoelMarcey/events{/privacy}","received_events_url":"https://api.github.com/users/JoelMarcey/received_events","type":"User","site_admin":false},"milestone":null,"comments":8,"created_at":"2014-08-22T17:23:07Z","updated_at":"2015-04-18T11:17:42Z","closed_at":null,"body":"Test script:\r\n```PHP\r\n<?php\r\nini_set('error_log', '/tmp/test1.log');\r\nerror_log('Message #1');\r\nini_set('error_log', '/tmp/test2.log');\r\nerror_log('Message #2');\r\n```\r\nPHP:\r\n```\r\n$ php test.php\r\n$ cat /tmp/test*.log\r\n[22-Aug-2014 16:49:56 UTC] Message #1\r\n[22-Aug-2014 16:49:56 UTC] Message #2\r\n```\r\nHHVM:\r\n```\r\n$ hhvm test.php\r\nMessage #1\r\nMessage #2\r\n$ cat /tmp/test*.log\r\ncat: /tmp/test*.log: No such file or directory\r\n```\r\nIt's with a few hours old HHVM master."},"comment":{"url":"https://api.github.com/repos/facebook/hhvm/issues/comments/94156757","html_url":"https://github.com/facebook/hhvm/issues/3558#issuecomment-94156757","issue_url":"https://api.github.com/repos/facebook/hhvm/issues/3558","id":94156757,"user":{"login":"digitalronin","id":2338,"avatar_url":"https://avatars.githubusercontent.com/u/2338?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalronin","html_url":"https://github.com/digitalronin","followers_url":"https://api.github.com/users/digitalronin/followers","following_url":"https://api.github.com/users/digitalronin/following{/other_user}","gists_url":"https://api.github.com/users/digitalronin/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalronin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalronin/subscriptions","organizations_url":"https://api.github.com/users/digitalronin/orgs","repos_url":"https://api.github.com/users/digitalronin/repos","events_url":"https://api.github.com/users/digitalronin/events{/privacy}","received_events_url":"https://api.github.com/users/digitalronin/received_events","type":"User","site_admin":false},"created_at":"2015-04-18T11:17:42Z","updated_at":"2015-04-18T11:17:42Z","body":"The ini_set call is doing *something* - just not what it's supposed to do.\r\n\r\nThe only way I could get errors to log to a file was to have these;\r\n\r\n    log_errors = On\r\n    error_log = /var/log/hhvm_errors.log\r\n\r\n...in the INI file *and* a call to ini_set error_log in my code;\r\n\r\n    ini_set('error_log', 'this value is irrelevant');\r\n\r\nPutting the log_errors part into another ini_set call didn't work.\r\n\r\n    // This, without the INI file settings, didn't work\r\n    ini_set('log_errors', 'On');\r\n    ini_set('error_log', '/var/log/hhvm_errors.log');\r\n\r\n\r\nHere is a minimal setup to demonstrate this;\r\n\r\n\r\nhhvm.ini\r\n\r\n    ; This setting is only here so that, when the test\r\n    ; script runs, we can tell that this INI file is\r\n    ; having *some* effect.\r\n    date.timezone = 'Asia/Tokyo'\r\n\r\n    ; These two lines have to be here, but are not\r\n    ; sufficient\r\n    log_errors = On\r\n    error_log = /var/log/hhvm_errors.log\r\n\r\n    ; These settings seem to have no effect\r\n    ; hhvm.log.use_log_file = true\r\n    ; hhvm.log.file = /var/log/hhvm_errors.log\r\n\r\n\r\ntest.hh\r\n\r\n    <?hh\r\n\r\n    // Without this line *and* log_errors and error_log defined\r\n    // in the INI file, errors are not written to the file\r\n\r\n    ini_set('error_log', 'you can put anything at all here');\r\n\r\n\r\n    // Output the date with timezone, so we know that the ini file \r\n    // is being used\r\n\r\n    echo date('r');\r\n\r\n    // write something to the error log file (hopefully)\r\n\r\n    error_log(\"something\");\r\n\r\n    // raise an error (which should be logged in the file)\r\n\r\n    no_such_method();\r\n\r\n\r\nExecute like this;\r\n\r\n    hhvm -c ./hhvm.ini test.hh\r\n\r\nThis is my hhvm version\r\n\r\n    # hhvm --version\r\n    HipHop VM 3.6.1 (rel)\r\n    Compiler: tags/HHVM-3.6.1-0-gc051feff88ba8050f33f10f7b1fb07f8d3415f9e\r\n    Repo schema: 42f49251b5c27daf4e13cb6bcd0c7ef4824b55a3\r\n\r\n"}}