[email protected]
[Top] [All Lists]

RE: logging directory... -upfate!

Subject: RE: logging directory... -upfate!
From: "bruce"
Date: Fri, 4 Jan 2008 21:37:46 -0800
hi knut.. again!

i seem to have gotten the test to run, generating msgs for different levels
of status/function...

later on, i'll figure out how to do the err/stat msgs based on the function
that the msg is coming from, and the line of the code.

for now, thanks!!!



hi knut!

ok, got the basic test running.. a simple typo was the err.

i've seen examples/chunks of code that allow different msgs based on the
status (error, info, warn, etc...) any pointers as to how i can extend this
to be able to do that as well??

thanks



hi knut...

i tried the following and was unable to generate any output in the test
output file. there is no file in the /var/log dir...


/foo/logtest.php:
#!/usr/bin/php
<?php
define('LOG4PHP_DIR', '/opt/log4php');
define('LOG4PHP_CONFIGURATION', '/opt/log4php/file.properties');
require_once (LOG4PHP_DIR.'/LoggerManager.php');
$logger = LoggerManager::getRootLogger();
$logger->debug("test!!!");
?>


/opt/log4php/file.properties:
log4php.appender.default = LoggerAppenderFile
log4php.appender.default.file = /var/log/log4php.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

/foo/logtest.php 'x' execute for everybody
/opt/log4php/file.properties '666' rw for everybody


any thoughts as to what i've screwed up on?

thanks



-----Original Message-----
From: Knut Urdalen [mailto:[email protected]]
Sent: Friday, January 04, 2008 5:05 PM
To: Log4PHP User
Subject: Re: logging directory...


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>