You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-user@logging.apache.org by Eric BOYER <Er...@insa-toulouse.fr> on 2006/06/02 12:24:35 UTC
Problem with %d in log4php.properties
Hello
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 ?
Thanks
Eric
Re: Problem with %d in log4php.properties
Posted by Eric BOYER <Er...@insa-toulouse.fr>.
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
>>
>>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.
>
>
not better :-(
>Regards,
>-Marco
>
>
>
>
Re: Problem with %d in log4php.properties
Posted by Eric BOYER <Er...@insa-toulouse.fr>.
Without " , it works on easyPHP
I am under linux with apache an dit doesn't work :-(
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
>>
>>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
>
>
>
>
Re: Problem with %d in log4php.properties
Posted by "Marco V." <ma...@apache.org>.
> 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