nginxphphhvmhiphop

How to get date / time of error into HHVM error log


I'm running HHVM 3.1.0 and nginx. I'm set to send errors in HHVM to it's own log file, not return them through nginx. One thing I noticed is the errors lack any type of timestamp or date /time listed, just the string of the error, here's some examples:

\nWarning: Invalid argument: function: not a valid callback array in /srv/http/nx/app/model/Session.php on line 57
\nFatal error: Failed to initialize storage module: user (path: ) in /srv/http/nx/app/model/Session.php on line 57 
\nWarning: Invalid argument: function: not a valid callback array

Is there a way to better format these error log entries to be more usable? At a minimum to have the date and time show up? Is there a way to pass errors back through nginx to log them in the way that php-fpm would? Here's an example of using php-fpm and getting errors in my /var/log/nginx/error.log (notice the nice format):

  [04-Aug-2014 13:53:55 UTC] PHP Warning:  Invalid argument supplied for foreach() in /srv/http/nx/app/controller/website/SEOFinds.php on line 164

For reference, here's my HHVM config file in /etc/hhvm/php.ini

; php options

pid = /var/run/hhvm/pid
date.timezone="America/New_York"
; hhvm specific

hhvm.server.file_socket=/var/run/hhvm/hhvm.sock
;hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
hhvm.mysql.typed_results = false

hhvm.eval.jit_warmup_requests = 0

Below is my nginx location block:

    location ~ \.php$ {
                 fastcgi_buffer_size 128k;
                 fastcgi_buffers 128 16k;
                 fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
                 fastcgi_index   index.php;
                 fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                 include         fastcgi_params;
         }

Solution

  • The time stamp is controlled by the hhvm.log.header INI setting. If you set it to true you'll get time stamps in your logs.