Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

php-loggor

Intercepts errors and encodes them using JSON. Can be configured to send out errors over UDP. Can intercept and handle fatal errors and parse errors, unlike set_error_handler(). Also overloads the error_log function such that the message is also run through the encoder.

Requirements

Jansson - JSON library

Installation

apt-get install git-core php5-dev
git clone git://github.com/akheron/jansson.git
cd jansson
autoreconf -i
./configure
make
make install
git clone git://github.com/jbboehr/php-loggor.git
cd php-loggor
phpize
./configure
make
make install

Configuring

loggor.enabled = 1          ; 0 to disable all functionality
loggor.error_reporting = -1 ; -1 uses error_reporting, otherwise overrides handling
                            ; does not currently work for PHP logging
loggor.php.enabled = 1      ; 0 to disable logging to PHP default error handler
loggor.silence = 1          ; 1 to ignore internal PHP error handlers
loggor.type_format = 3      ; Changes format of error type, one of LOGGOR_TYPE_INT, 
                            ; LOGGOR_TYPE_CONST, LOGGOR_TYPE_SIMPLE, LOGGOR_TYPE_STRING
loggor.udp.enabled = 0      ; 1 to enable logging to UDP
loggor.udp.host =           ; UDP host to which to send data
loggor.udp.port =           ; UDP port to which to send data

Usage

Example:

<?php
trigger_error("Some error", E_USER_NOTICE);

Produces:

{"file": "some-file.php", "hostname": "some-hostname", "line": 1337, "message": "Some error", "time": 1350097238.695085, "type": "Notice"}

Todo

  • Resolve segfaults when default error handler is not called so a silence option can be added
  • Add getrusage() support and other analytics?
  • Figure out why errors aren't being logged even when error_reporting is overridden
Something went wrong with that request. Please try again.