Manual - PHP

Introduction

Dbglog PHP extension provides interface for accessing logging library dbglog.

Requirements, installation

For dbglog utilization is needed to have PHP5 with corresponding Zend API version installed. After installation is needed add to php.ini this line:
extension=dbglog.so

Runtime configuration

Dbglog understands environment variables and configuration directives in php.ini file.

Environment variables:

LOG_FILE name of file for logging
LOG_MASK logging mask
LOG_STDERR indicates, if dbglog shout log to stderr too
LOG_OWNER uid:gid of logfile owner
LOG_BUFSIZE size of log bufferu

Configuration directives:

dbglog.file overrides LOG_FILE value
dbglog.mask overrides LOG_MASK value
dbglog.stderr overrides LOG_STDERR value
All directives should be used anywhere (master php.ini etc.).

Application interface Constants

void dbglog(int level, string format [, mixed args])

Log formatted string using arguments with level . As values can be used these constants:
INFO1, INFO2, INFO3, INFO4,
WARN1, WARN2, WARN3, WARN4,
ERR1, ERR2, ERR3, ERR4,
FATAL1, FATAL2, FATAL3, FATAL4,
DBG1, DBG2, DBG3, DBG4
Other numbers used as can cause nonsense levels in logfile.

boolean dbglog_file(string filename)

Changes logfile to filename. If file cannot be open, logging stops and returns FALSE.

void dbglog_stderr(boolean flag)

Turns logging to stderr on/off.

void dbglog_mask(string mask)

Changes log mask.

void dbglog_app_name(string name)

Changes name of application, which is written to log.

void dbglog_buf_size(int size)

Sets size of internal logging buffer to given value. Default is 1024 bytes.

void dbglog_time_prec(int precision)

Sets precission of log time. The only allowed value is 0, which means log only seconds and 6, which means log seconds.microseconds. Other values are considered as 0.

boolean dbglog_file_owner(int uid, int gid)

boolean dbglog_file_owner(string user, string group)

Changes owner of log file to given id or name. If change fails, returns FALSE, otherwise TRUE.

< back