Log4php

Log4j ported to php

News | Introduction | Features | Comparison Table | Requirements | Download | Documentation | Usage | Contacts | Contributors

News

DateDescription
20 Apr 2005

Log4php has a new HOME! The development of Log4php has been moved to logging.apache.org (Log4php project). There, users and developers can find:

This site has been frozen as is with the last version 0.9 (published under LGPL license).
New releases will be published under Apache License 2.0.
For comments and/or bugs report send an email to marco@apache.org.

10 Dec 2003

A new release is out (0.9).
Fixes and changes to make log4php PHP5b2 compatible.
Corrections in LoggerDOMConfigurator and LoggerLevel.
Go to Download page to download it.
See Release Notes for the list of changes. ChangeLog is avaliable here.
For comments and/or bugs report send an email to vxr@vxr.it

28 Oct 2003

A new release is out (0.8).
Fixed a couple of bugs in LoggerDOMConfigurator and LoggerAppenderSkeleton (thanks to Sergio Strampelli).
Corrections in LoggerAppenderMail and LoggerAppenderSocket.
Go to Download page to download it.
See Release Notes for the list of changes. ChangeLog is avaliable here.
For comments and/or bugs report send an email to vxr@vxr.it

24 Sep 2003

A new release is out (0.7).
With this release log4php has reached the "features-freeze" state.
Go to Download page to download it.
See Release Notes for the list of changes. ChangeLog is avaliable here.
For comments and/or bug report send an email to vxr@vxr.it

15 Sep 2003

A new release is out (0.6)!
Go to Download page to download it.
See Release Notes for the list of changes. ChangeLog is avaliable here.
For comments and/or bug report send an email to vxr@vxr.it

10 Sep 2003

A new release is out (0.5)! See ChangeLog for the list of changes. Go to Download page to download it. For comments and/or bug reports send an email to vxr@vxr.it

10 Sep 2003

Alejandro Sarco has discovered a problem when LoggerDOMConfigurator tries to set level to to non-root loggers. Here is a patch for log4php-0.4.
Replace LoggerLevel.php with this LoggerLevel.php.

02 Sep 2003

A new release is out (0.4)! See ChangeLog for the list of changes. Go to Download page to download it. For comments and/or bug reports send an email to vxr@vxr.it

27 Aug 2003

A new release is out (0.3)! Go to Download page. For comments and/or bug reports send an email to vxr@vxr.it

20 Aug 2003

Integrated thresholds on appenders (Thanks to Sergio Strampelli)

01 Aug 2003

Added LoggerAppenderDailyFile (Thanks to Abel Gonzalez)

15 May 2003

Added LoggerAppenderMailEvent (Thanks to Domenico Lordi)

20 Feb 2003

First release (0.2)! Go to Download page.

[up]

Introduction

Log4php is a php port of Log4j, the most popular Java logging framework (see http://jakarta.apache.org/log4j/ for details).

[up]

Features

  • Supports configuration through xml and properties file (same structure as log4j).
  • Supports File, RollingFile, DailyFile, Echo, Console, Mail, PEAR::Db, PHP error, Syslog or NT events and Socket appenders.
  • Supports Simple, TTCC, Pattern, Html and Xml Layouts.
  • Supports Nested (NDC) and Mapped (MDC) Diagnostic Contexts.
  • Switchable internal debug.

It can be used inside a class (see below) or inside a main/sub function.

[up]

Log4j and log4php comparison table

This table compares log4j and log4php differences.
Features/Framework log4j (1.2.8) log4php (0.7),(0.8) log4php (0.9)
Configuration
Xml Y (DOMConfigurator) Y (LoggerDOMConfigurator) Y (LoggerDOMConfigurator)
Properties Y (PropertyConfigurator) Y (LoggerPropertyConfigurator) Y (LoggerPropertyConfigurator)
Basic Y (BasicConfigurator) Y (LoggerBasicConfigurator) Y (LoggerBasicConfigurator)
Variable Substitution Y Y Y
Features/Framework log4j (1.2.8) log4php (0.7)(0.8) log4php (0.9)
Core
Logger Hierarchy Y Y Y
Repository Selector Y N N
Additivity Y Y Y
Error Handling Y N N
Reloading Properties Y N N
Microseconds Date Formatting Y Y Y
Report Fully Qualified ClassName Y Partially Partially
Report Caller Object Y Y (PHP >= 3.2.0) Y (PHP >= 3.2.0)
Report Caller Method Y Y (PHP >= 3.2.0) Y (PHP >= 3.2.0)
MDC (Mapped Diagnostic Contexts) Y Y Y
NDC (Nested Diagnostic Contexts) Y Y Y
Nested Appenders Y N N
Custom Levels (by subclassing) Y Y Y
Custom Loggers (by subclassing) Y Y Y
Logger Factory Y Y Y
Features/Framework log4j (1.2.8) log4php (0.7)(0.8) log4php (0.9)
Appenders
Console Y Y Y
Daily File Y (Daily Rolling with no roll) Y Y
Daily Rolling File Y N N
File Y Y Y
Rolling File Y Y Y
Syslog Y Y Y
Database Y (JDBC) Y (PEAR::Db) Y (PEAR::Db)
Socket Y Y (serialize, xml) Y (serialize, xml)
Telnet Y N N
NT Event Y Y (via syslog appender) Y (via syslog appender)
LF5 Y N N
Externally Rolled File Y N N
Null Y Y Y
PHP Error N Y Y
SMTP Y Y (Mail, MailEvent) Y (Mail, MailEvent)
Echo Y Y Y
Features/Framework log4j (1.2.8) log4php (0.7)(0.8) log4php (0.9)
Layouts
HTML Y Y Y
Pattern Y Y Y
Simple Y Y Y
TTCC Y Y Y
XML Y Y Y
Features/Framework log4j (1.2.8) log4php (0.7)(0.8) log4php (0.9)
Filters
Deny All Y Y Y
Level Match Y Y Y
Level Range Y Y Y
String Match Y Y Y
Features/Framework log4j (1.2.8) log4php (0.7)(0.8) log4php (0.9)
Renderers
Object Renderer Support Y Y Y
Others
PHP5 Support N N Y (beta2)

[up]

Requirements

  • PHP >= 4.1.x (to log caller location information PHP >= 3.2.0 is needed)
  • PEAR XML_Parser class (located in PEAR/XML/Parser.php by default) only for log4php version <= 0.3.

[up]

Documentation

First read the original log4j documentation.
Then, read the log4php quick setup guide.
Finally, for further informations, browse the online api documentation.

[up]

Usage

Here is an example on how to use in your php code (usage.php).
For more examples see tests/ directory in the log4php distribution.
Take also a look at original log4j documentation.

[up]

Contacts

  • Log4php author and code maintainer

    email: vxr@vxr.it

[up]

Contributors

Here is a list (in alphabetical order) of the developers that (directly or indirectly) contributed (and still contribute) to enhance the project.
Thank You all!

  • Abel Gonzalez

    Abel is the author of the LoggerAppenderDailyFile appender.

  • Domenico Lordi

    Developer of the LoggerAppenderMailEvent appender.

  • Sergio Strampelli

    An endless source of ideas, contribs and bug hunting. Thank You guy!

  • VxR

    The founder of the project and source code maintainer.

[up]



Author: VxR, $Revision: 1.24 $