[email protected]
[Top] [All Lists]

Re: Problem with %d in log4php.properties

Subject: Re: Problem with %d in log4php.properties
From: Eric BOYER
Date: Tue, 06 Jun 2006 08:39:16 +0200
Marco V. a écrit :

I want to use the %d in log4php.properties but nothing is returned :

log4php.appender.fichier.layout.ConversionPattern=%d - %-5p [%F:%L] - %m%n


log4php.appender.fichier.layout.ConversionPattern=%d{Y-m-d H:i:s} - %-5p
[%F:%L] - %m%n

nether return a date in my log !

I have for exemple :

- DEBUG [/home/boyere/public_html/testLog4Php/index2.php:11] - Hello
again 2!

In my PHP code I have :
$logger =& LoggerManager::getLogger('index.php');
$logger->debug('Hello again!');

what could be my problem please ?
Hi Eric,

log4php.properties is parsed using parse_ini_file function.
According to php documentation:"If a value in the ini file contains any 
non-alphanumeric characters it needs to be enclosed in
double-quotes (")."
So, try to put the ConversionPattern string between double quotes like this:

log4php.appender.fichier.layout.ConversionPattern="%d - %-5p [%F:%L] - %m%n"
log4php.appender.fichier.layout.ConversionPattern="%d{Y-m-d H:i:s} - %-5p [%F:%L] - 

this change should address your issue.
not better :-(


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