Apache log4php integration

Component ID

1555346

Component name

Apache log4php integration

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1663

Component created

Component changed

Component body

NOTE: If you'd like to log via Redis, check out my custom version of log4php on Github.

Overview

This module is designed to centralize the logging functionality of Drupal into a single module replacement for watchdog, reducing the overall burden of maintaining Drupal modules simply to support multiple watchdog backends. Apache log4php is a common-purpose library that allows messages to be logged to a wide variety of backends and provides much more granular control than Drupal's built-in capabilities.

Apache log4phpâ„¢ is a versatile logging framework for PHP.

Feature highlights:

  • Configuration through XML, properties or PHP files
  • Various logging destinations, including:
    • Console (stdout, stderr)
    • Files (including daily and rolling files)
    • Email
    • Databases
    • Sockets
    • Syslog
  • Several built-in log message formats, including:
    • HTML
    • XML
    • User defined pattern

Features

This module provides simple integration with the Apache log4php library.

Requirements

This module requires the log4php library. This can be installed in one of two ways -

  • The preferred installation method is via PEAR -
    pear channel-discover pear.apache.org/log4php
    pear install log4php/Apache_log4php
  • Alternatively the main code files can be installed via the Libraries module. Move the src/main/php directory to sites/all/libraries/log4php.

Installation

After creating an XML configuration file, include it in your settings.php file -

  $conf['log4php_config'] = 'sites/all/modules/log4php/log4php.xml';

The default log4php.xml file is a basic configuration to test functionality. This configuration only writes log entries to a file located in the temp directory (will only work on Linux/Unix/Mac for now).

Recommended modules