php - Log4PHP only logging last method call -
i'm relatively new php programmer, background in java. question involves attempting log function call entry , exits using log4php. following loose mvc pattern have php pages render view, php scripts act controller , php classes representing model.
this happening: have form submits php controller, instantiates php class. newly created object insert mysql, returning new auto-increment id. control passes controller, forwards different php view, using header->location. finally, new php view select on newly created id.
the problem during execution process, lookup being logged log4php; insert not. here snippets:
<appender name="myconsoleappender" class="loggerappenderconsole" /> <appender name="myloggerappenderdailyfile" class="loggerappenderdailyfile"> <layout class="loggerlayoutpattern"> <param name="conversionpattern" value="%d{y-m-d h:i:s} [%p] %c: %m (at %f line %l)%n" /> </layout> <param name="file" value="file-%s.log" /> <param name="datepattern" value="y-m-d" /> </appender> <logger name="merchant"> <appender_ref ref="myloggerappenderdailyfile" /> </logger> <root> <level value="debug" /> <appender_ref ref="myconsoleappender" /> </root> </configuration>
the constructor:
public function __construct() { . . logger::configure('config.xml'); $this->log = logger::getlogger(__class__); }
the 2 methods:
public function insertmerchant() { $this->log->debug("inserting new merchant"); . . $this->log->debug("merchant inserted; id = $merchantid"); } public function findmerchantbyuserid($userid) { $this->log->debug("finding merchant userid = $userid"); . . $this->log->debug("merchant found userid = $userid"); }
as mentioned, last call findmerchantbyuserid($userid) being logged file. insert never logged,
thanks in advance help.
Comments
Post a Comment