You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by gr...@apache.org on 2010/06/18 08:54:05 UTC
svn commit: r955855 - in /logging/log4php/trunk/src: changes/changes.xml
main/php/configurators/LoggerConfiguratorPhp.php
Author: grobmeier
Date: Fri Jun 18 06:54:04 2010
New Revision: 955855
URL: http://svn.apache.org/viewvc?rev=955855&view=rev
Log:
LOG4PHP-36: applied patch by Moritz Schmidt. Set appender properties, not only class and layout
Modified:
logging/log4php/trunk/src/changes/changes.xml
logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php
Modified: logging/log4php/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/changes/changes.xml?rev=955855&r1=955854&r2=955855&view=diff
==============================================================================
--- logging/log4php/trunk/src/changes/changes.xml (original)
+++ logging/log4php/trunk/src/changes/changes.xml Fri Jun 18 06:54:04 2010
@@ -24,6 +24,7 @@
</properties>
<body>
<release version="2.1" description="Stabilizing">
+ <action type="update" issue="LOG4PHP-36" by="Moritz Schmidt">PHP Configurator: set remaining properties to appenders</action>
<action type="update" issue="LOG4PHP-110" by="Vladimir Gorej">MongoDB: improved exception handling</action>
<action type="fix" issue="LOG4PHP-112" by="darja, Christian Grobmeier">Logging ClassName doesn't work</action>
<action type="update" issue="LOG4PHP-109" by="Vladimir Gorej">patch for Throwable information associated with logging event</action>
Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php?rev=955855&r1=955854&r2=955855&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php Fri Jun 18 06:54:04 2010
@@ -62,6 +62,9 @@ class LoggerConfiguratorPhp implements L
$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderProperties['class']);
+ // unset so that the property wont be drawn up again
+ unset($appenderProperties['class']);
+
if($appender->requiresLayout()) {
if(isset($appenderProperties['layout'])) {
@@ -83,12 +86,19 @@ class LoggerConfiguratorPhp implements L
$appender->setLayout($layout);
+ // unset so that the property wont be drawn up again
+ unset($appenderProperties['layout']);
} else {
// TODO: throw exception?
}
}
-
+ // set remaining properties and activate appender
+ $setter = new LoggerReflectionUtils($appender);
+ foreach ($appenderProperties as $key => $val) {
+ $setter->setProperty($key, $val);
+ }
+ $setter->activate();
}
}