I gave you only the part of the code I thought was important.  I'll check
it again.

_____________________________
Sent from my Droid Mini.  Hopefully I don't break this one too.
On Oct 27, 2013 3:49 AM, "Ivan Habunek" <ivan.habu...@gmail.com> wrote:

> Hi Jamie,
>
> You're not feeding your config file to log4php. You need:
> Logger::configure("config.xml");
>
> Add that after require_once. Just tested on my machine and it works.
>
> Actually, I'm not sure how you manage to get anything in your default
> log file. :-) The default config just writes to stdout. Can you check
> your code once again?
>
> Regards,
> Ivan
>
>
> On 25 October 2013 22:21, James Pittman <jpittm...@gmail.com> wrote:
> > I have a default appender set up, which is working fine.
> > But when I try to add another appender for a specific purpose, it doesn't
> > seem to be working.
> >
> > XML:
> > <configuration xmlns="http://logging.apache.org/log4php/";>
> >     <!--
> >     ! Default appender.  Logs INFO and above to logs/cs2Log.log and
> >     ! does not append.
> >     !-->
> >     <appender name="default" class="LoggerAppenderFile">
> >         <layout class="LoggerLayoutPattern">
> >             <param name="conversionPattern" value="%date{Y-m-d H:i:s.u}
> > %C.%M(%L) %p %msg%n"/>
> >         </layout>
> >         <param name="file" value="/path/to/logs/cs2Log.log"/>
> >         <param name="append" value="false"/>
> >     </appender>
> >
> >     <!--
> >     ! Appender to monitor tool activity  Logs INFO and above to
> >     ! logs/activity/activity.log, appending to the files.
> >     !-->
> >     <appender name="ActivityAppender" class="LoggerAppenderRollingFile">
> >         <layout class="LoggerLayoutPattern">
> >             <param name="conversionPattern" value="%date{Y-m-d H:i:s.u}
> > %C.%M(%L) %p %msg%n"/>
> >         </layout>
> >         <param name="file" value="/path/to/logs/activity/activity.log"/>
> >         <param name="append" value="true"/>
> >         <param name="maxFileSize" value="1024KB"/>
> >         <param name="maxBackupIndex" value="10"/>
> >     </appender>
> >
> >     <!--
> >     ! Default logger.  Logs all classes using the default and console
> >     ! appenders.
> >     !-->
> >     <root>
> >         <appender_ref ref="default"/>
> >     </root>
> >
> >     <logger name="activity">
> >         <appender_ref ref="ActivityAppender"/>
> >         <level value="info"/>
> >     </logger>
> > </configuration>
> >
> > PHP:
> > <?php
> > require_once("log4php/Logger.php");
> > $logger = Logger::getLogger("main");
> > $activityLogger = Logger::getLogger("activity");
> >
> > $activityLogger->info("Client IP: " . $_SERVER['REMOTE_ADDR']);
> > $activityLogger->info("Script URL: " . $_SERVER['SCRIPT_URL']);
> >
> > $logger->warn("Yo.");
> > ?>
> >
> > I see all three log lines in my cs2Log.log file (the default)
> > but nothing in my activity.log.
> > The directory and file both exist, and permissions are not the issue.
> >
> > Help?
> >
> > Thanks,
> > Jamie
> > --
> >
> ____________________________________________________________________________________
> > Taste and see the fullness of His peace, and hold on to what's being held
> > out.
> > ~ from "The Healing Hand of God" by Jeremy Camp
>

Reply via email to