[email protected]
[Top] [All Lists]

Re: logging directory...

Subject: Re: logging directory...
From: Knut Urdalen
Date: Sat, 05 Jan 2008 02:04:43 +0100
bruce wrote:
basically, i'm trying to find a sample, that uses an ini file (not xml) to
be able to quickly configure the app, so i can do a test php chunk of script
to log some test messages...
Here's the most basic examples where you control both the name of the log4php configuration file, the path to the log-file and the format of each logging event.
file.php:
<?php
define('LOG4PHP_DIR', '/path/to/log4php');
define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/file.properties');
require_once LOG4PHP_DIR.'/LoggerManager.php';
$logger = LoggerManager::getRootLogger();
$logger->debug("Hello World!");
?>

file.properties:
log4php.appender.default = LoggerAppenderFile
log4php.appender.default.file = tmp/file.log
log4php.appender.default.layout = LoggerPatternLayout
log4php.appender.default.layout.conversionPattern="%d{Y-m-d H:i:s} %-5p %c: %m in %F at %L%n"
log4php.rootLogger = DEBUG, default

Regards,
Knut

<Prev in Thread] Current Thread [Next in Thread>