If it works anything like Log4j (and it probably will, since it's based
of it). The rootLogger is always executed, which would explain why you
see the testing123 you are writing to the dbLogger appear in the root
logger as well.
The only way around this is to create an empty rootlogger and have two
additive loggers. This is the way I do it with log4j and it works perfectly.
Mark
mike simmons wrote:
I am trying to accomplish a simple task: Log 2 messages to 2 different
files.
It seems like the additivity control is not working. From what I
gather on log4j forums this should work...but not 4 me.
config.properties:
log4php.debug = "true"
log4php.rootLogger = DEBUG, A1
log4php.appender.A1=LoggerAppenderDailyFile
log4php.appender.A1.File="/home/hsphere/local/home/onmars/physiographs.com/logs/pg.log"
log4php.appender.A1.layout=LoggerLayoutTTCC
log4php.logger.dbLogger = DEBUG, A2
log4php.additivity.dbLogger=false
log4php.appender.A2=LoggerAppenderDailyFile
log4php.appender.A2.File="/home/hsphere/local/home/onmars/physiographs.com/logs/db.log"
log4php.appender.A2.layout=LoggerLayoutTTCC
test.php:
...
$logger =& LoggerManager::getLogger('pg');
$mylogger= & LoggerManager::getLogger('dbLogger');
$logger->debug("tesing123");
$mylogger->debug("tesing123");
db.log
Fri Apr 7 17:09:50 2006,949 [49448] DEBUG dbLogger - tesing123
pg.log
Fri Apr 7 17:09:50 2006,948 [49448] DEBUG pg - tesing123
Fri Apr 7 17:09:50 2006,949 [49448] DEBUG dbLogger - tesing123
If you can see anything wrong in my config or how I'm calling the
loggers please let me know.
TIA.
Mike