[pLog-svn] r4173 - plog/branches/lifetype-1.1.2/class/logger
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Mon Oct 23 11:11:18 GMT 2006
Author: oscar
Date: 2006-10-23 11:11:17 +0000 (Mon, 23 Oct 2006)
New Revision: 4173
Modified:
plog/branches/lifetype-1.1.2/class/logger/loggermanager.class.php
Log:
modified the behaviour of LoggerManager::getLogger() to return a logger that logs data to stdout (the browser) instead of silently returning NULL. This should help prevent a few strange crashes reported in the forums (because people did not update their config/logging.properties.php) but won't fix whatever reason was causing the classes to report errors via the logging mechanism.
Modified: plog/branches/lifetype-1.1.2/class/logger/loggermanager.class.php
===================================================================
--- plog/branches/lifetype-1.1.2/class/logger/loggermanager.class.php 2006-10-23 11:09:36 UTC (rev 4172)
+++ plog/branches/lifetype-1.1.2/class/logger/loggermanager.class.php 2006-10-23 11:11:17 UTC (rev 4173)
@@ -197,10 +197,21 @@
$instance =& LoggerManager::getInstance();
if (isset($instance->loggers[$name])) {
- return $instance->loggers[$name];
+ $logger = $instance->loggers[$name];
}
+ else {
+ // return a dummy logger that will output things to screen, in case the logger that
+ // was requested does not exist... This should be a better option than
+ // silently returning NULL or a null logger
+ $properties = Array( "prio" => "info" );
+ $layout = new PatternLayout( "%t%n%d %N - [%f:%l (%c:%F)] %m%n" );
+ $appenderObject = LoggerManager::createAppenderInstance( "stdout", $layout, $properties );
+ // create the logger, set the appender and it to the list
+ $logger = new Logger( $properties );
+ $logger->addAppender( $appenderObject );
+ }
- return NULL;
- }
+ return( $logger );
+ }
}
?>
More information about the pLog-svn
mailing list