[email protected]
[Top] [All Lists]

Re: Problem with %d in log4php.properties

Subject: Re: Problem with %d in log4php.properties
From: "Marco V."
Date: Mon, 5 Jun 2006 18:23:45 +0200
> I want to use the %d in log4php.properties but nothing is returned :
>
> log4php.appender.fichier.layout.ConversionPattern=%d - %-5p [%F:%L] - %m%n
>
> or
>
> 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] - %m%n"

this change should address your issue.

Regards,
-Marco

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