[email protected]
[Top] [All Lists]

Re: Re: Re: Re: Illogical logging by rootLogger

Subject: Re: Re: Re: Re: Illogical logging by rootLogger
From: Christian Grobmeier
Date: Thu, 4 Mar 2010 09:28:30 +0100
Florian, i have found the solution. Its a bit weird. However, please
configure the appender FIRST, and then the Loggers.
I think this is worth a fix.

Let me know if that helps you
Christian

On Wed, Mar 3, 2010 at 3:01 PM, Florian Platzer <[email protected]> wrote:
> Yes, it should be so, but I'm afraid it isn't
> If I switch the ldap-appender from "ldap" to "echo", then I get the same
> result - nothing.
>
> Xml in general is absolutely no problem, but due to the documentation php
> config was easier to understand/work with it.
>
>
>
> Von:
> Christian Grobmeier <[email protected]>
> An:
> Log4PHP User <[email protected]>
> Datum:
> 03.03.2010 14:55
> Betreff:
> Re: Re: Re: Illogical logging by rootLogger
>
>
>
> Ok - so with your current setup you should see the 'Testlog" on echo
> the dailyfile might be created when configuration of log4php happens -
> would need a look into code to verify :-)
> So besides you MailEvent Issue - is this now working better for you? Is it
> a problem to use XML cnfiguration instead of ph configuration at the
> moment?
>
>
> On Wed, Mar 3, 2010 at 2:50 PM, Florian Platzer <[email protected]>
> wrote:
> Hi,
>
> the logger is instantiated this way:
>
> $_logger = Logger::getLogger('ldap');
> $_logger->debug('Testlog');
>
> thanks, threshold-attr has been removed
>
> But I noticed, that the dailyfile.log will be created (without content),
> so in any way the config seems to work ;)
>
> Florian
>
>
>
> Von:
> Christian Grobmeier <[email protected]>
> An:
> Log4PHP User <[email protected]>
> Datum:
> 03.03.2010 14:42
> Betreff:
> Re: Re: Illogical logging by rootLogger
>
>
>
> Hi,
> how do you instantiate your logger object?
>
> I mean code like:
> $logger = Logger::getLogger("b");
>
> for the ldap
>
> And I think you need to remove threshold="ALL" in the first tag, because
> it will filter out everything
>
> Christian
>
> On Wed, Mar 3, 2010 at 2:35 PM, Florian Platzer <[email protected]>
> wrote:
> Hi,
>
> thanks for your response!
> I've now tried to use a xml configuration file and had a look in the
> xml/log4php.dtd
>
> Thats the result:
>
> <log4php:configuration xmlns:log4php="http://logging.apache.org/log4php/";
> threshold="ALL">
> Â Â Â<root>
> Â Â Â<level value="FATAL" />
> Â Â Â<appender_ref ref="echo" />
> Â</root>
>
> Â Â Â<logger name="ldap">
> Â Â Â Â Â Â Â<level value="DEBUG" />
> Â Â Â Â Â Â Â<appender_ref ref="echo" />
> Â Â Â</logger>
>
> Â Â Â<logger name="mssql">
> Â Â Â Â Â Â Â<level value="DEBUG" />
> Â Â Â Â Â Â Â<appender_ref ref="dailyfile" />
> Â Â Â</logger>
>
> Â Â Â<logger name="mysql">
> Â Â Â Â Â Â Â<level value="DEBUG" />
> Â Â Â Â Â Â Â<appender_ref ref="dailyfile" />
> Â Â Â</logger>
>
> Â<appender name="dailyfile" class="LoggerAppenderDailyFile">
> Â Â Â Â Â Â Â<param name="append" value="true" />
> Â Â Â Â Â Â Â<param name="datePattern" value="Ymd" />
> Â Â Â Â Â Â Â<param name="file" value="xyz.log" />
> Â Â Â<layout class="LoggerLayoutPattern">
> Â Â Â Â Â Â Â Â Â Â Â<param name="conversionPattern" value="%d{H:i:s}
> %-5p %c %X{username}: %m in %F at %L%n" />
> Â Â Â Â Â Â Â</layout>
> Â</appender>
>
> Â Â Â<appender name="echo" class="LoggerAppenderEcho">
> Â Â Â<layout class="LoggerLayoutPattern">
> Â Â Â Â Â Â Â Â Â Â Â<param name="conversionPattern" value="%d{Y-m-d
> H:i:s} %-5p %c %X{username}: %m in %F at %L%n" />
> Â Â Â Â Â Â Â</layout>
> Â</appender>
>
> Â Â Â<appender name="email" class="LoggerAppenderMailEvent">
> Â Â Â Â Â Â Â<param name="from" value="[email protected]" />
> Â Â Â Â Â Â Â<param name="to" value="[email protected]" />
> Â Â Â Â Â Â Â<param name="subject" value="Error" />
> Â Â Â Â Â Â Â<param name="smtpHost" value="0.0.0.0" />
> Â Â Â<layout class="LoggerLayoutPattern">
> Â Â Â Â Â Â Â Â Â Â Â<param name="conversionPattern" value="%d{Y-m-d
> H:i:s} %-5p %c %X{username}: %m in %F at %L%n" />
> Â Â Â Â Â Â Â</layout>
> Â</appender>
>
> </log4php:configuration>
>
>
> But now there is nothing logged any more, so I think that any tags are not
> configured properly...
> Could you please check this?
>
> Florian
>
>
>
> Von:
> Christian Grobmeier <[email protected]>
> An:
> Log4PHP User <[email protected]>
> Datum:
> 03.03.2010 13:51
> Betreff:
> Re: Illogical logging by rootLogger
>
>
>
> Hi,
>
> at first glance, I would think the same. I will need to try it out.
> However - please have in mind that the php configuration is still
> experimental. Maybe you are running into a bug here. Did you try the old
> fashioned way with xml or property file?
>
> Christian
>
> On Wed, Mar 3, 2010 at 1:44 PM, Florian Platzer <[email protected]>
> wrote:
> I created the following log4php configuration file and wondered, why a
>
> $logger->debug('xyz')
>
> on ldap-logger created an formatted log4php-output on the webpage:
>
> return array(
> Â Â Â Â Â Â Â Â Â Â 'rootLogger' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'level' => 'FATAL',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'appenders' => array('echo'),
> Â Â Â Â Â Â Â Â Â Â ),
> Â Â Â Â Â Â Â Â Â Â 'loggers' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'ldap' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'level' => 'DEBUG',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'appenders' => array('email'),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â ),
> Â Â Â Â Â Â Â Â Â Â ),
> Â Â Â Â Â Â Â Â Â Â 'appenders' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'echo' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'class' => 'LoggerAppenderEcho',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'layout' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'class' =>
> 'LoggerLayoutPattern',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'conversionPattern' =>
> "%d{Y-m-d H:i:s} %-5p %c %X{username}: %m in %F at %L%n",
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â ),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'email' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'class' =>
> 'LoggerAppenderMailEvent',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'layout' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'class' =>
> 'LoggerLayoutPattern',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'conversionPattern' =>
> "%d{Y-m-d H:i:s} %-5p %c %X{username}: %m in %F at %L%n",
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'from' => '[email protected]',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'to' => '[email protected]',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'subject' => 'Error',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'smtpHost' => '0.0.0.0',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â ),
> Â Â Â Â Â Â Â Â Â Â ),
> Â Â Â Â Â Â );
>
>
> In my understanding, the rootLogger only should log in case of FATAL
> errors!?
>
> Florian
>
>
>
>
>
>
>
>
<Prev in Thread] Current Thread [Next in Thread>