You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ih...@apache.org on 2013/11/28 17:04:03 UTC
[33/43] Fixed code formatting to conform to PSR-2
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/DateConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/DateConverter.php b/src/Pattern/DateConverter.php
index 5a1ad4a..d6ddc7e 100644
--- a/src/Pattern/DateConverter.php
+++ b/src/Pattern/DateConverter.php
@@ -30,60 +30,63 @@ use Apache\Log4php\LoggingEvent;
* 'ISO8601', 'ABSOLUTE' and 'DATE'.
* @since 2.3
*/
-class DateConverter extends AbstractConverter {
+class DateConverter extends AbstractConverter
+{
+ const DATE_FORMAT_ISO8601 = 'c';
- const DATE_FORMAT_ISO8601 = 'c';
+ const DATE_FORMAT_ABSOLUTE = 'H:i:s';
- const DATE_FORMAT_ABSOLUTE = 'H:i:s';
+ const DATE_FORMAT_DATE = 'd M Y H:i:s.u';
- const DATE_FORMAT_DATE = 'd M Y H:i:s.u';
+ private $format = self::DATE_FORMAT_ISO8601;
- private $format = self::DATE_FORMAT_ISO8601;
+ private $specials = array(
+ 'ISO8601' => self::DATE_FORMAT_ISO8601,
+ 'ABSOLUTE' => self::DATE_FORMAT_ABSOLUTE,
+ 'DATE' => self::DATE_FORMAT_DATE,
+ );
- private $specials = array(
- 'ISO8601' => self::DATE_FORMAT_ISO8601,
- 'ABSOLUTE' => self::DATE_FORMAT_ABSOLUTE,
- 'DATE' => self::DATE_FORMAT_DATE,
- );
+ private $useLocalDate = false;
- private $useLocalDate = false;
+ public function activateOptions()
+ {
+ // Parse the option (date format)
+ if (!empty($this->option)) {
+ if (isset($this->specials[$this->option])) {
+ $this->format = $this->specials[$this->option];
+ } else {
+ $this->format = $this->option;
+ }
+ }
- public function activateOptions() {
+ // Check whether the pattern contains milliseconds (u)
+ if (preg_match('/(?<!\\\\)u/', $this->format)) {
+ $this->useLocalDate = true;
+ }
+ }
- // Parse the option (date format)
- if (!empty($this->option)) {
- if(isset($this->specials[$this->option])) {
- $this->format = $this->specials[$this->option];
- } else {
- $this->format = $this->option;
- }
- }
+ public function convert(LoggingEvent $event)
+ {
+ if ($this->useLocalDate) {
+ return $this->date($this->format, $event->getTimeStamp());
+ }
- // Check whether the pattern contains milliseconds (u)
- if (preg_match('/(?<!\\\\)u/', $this->format)) {
- $this->useLocalDate = true;
- }
- }
+ return date($this->format, $event->getTimeStamp());
+ }
- public function convert(LoggingEvent $event) {
- if ($this->useLocalDate) {
- return $this->date($this->format, $event->getTimeStamp());
- }
- return date($this->format, $event->getTimeStamp());
- }
+ /**
+ * Currently, PHP date() function always returns zeros for milliseconds (u)
+ * on Windows. This is a replacement function for date() which correctly
+ * displays milliseconds on all platforms.
+ *
+ * It is slower than PHP date() so it should only be used if necessary.
+ */
+ private function date($format, $utimestamp)
+ {
+ $timestamp = floor($utimestamp);
+ $ms = floor(($utimestamp - $timestamp) * 1000);
+ $ms = str_pad($ms, 3, '0', STR_PAD_LEFT);
- /**
- * Currently, PHP date() function always returns zeros for milliseconds (u)
- * on Windows. This is a replacement function for date() which correctly
- * displays milliseconds on all platforms.
- *
- * It is slower than PHP date() so it should only be used if necessary.
- */
- private function date($format, $utimestamp) {
- $timestamp = floor($utimestamp);
- $ms = floor(($utimestamp - $timestamp) * 1000);
- $ms = str_pad($ms, 3, '0', STR_PAD_LEFT);
-
- return date(preg_replace('`(?<!\\\\)u`', $ms, $format), $timestamp);
- }
+ return date(preg_replace('`(?<!\\\\)u`', $ms, $format), $timestamp);
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/EnvironmentConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/EnvironmentConverter.php b/src/Pattern/EnvironmentConverter.php
index 7be0272..6d1afa7 100644
--- a/src/Pattern/EnvironmentConverter.php
+++ b/src/Pattern/EnvironmentConverter.php
@@ -28,6 +28,7 @@ namespace Apache\Log4php\Pattern;
*
* @since 2.3
*/
-class EnvironmentConverter extends SuperglobalConverter {
- protected $name = '_ENV';
+class EnvironmentConverter extends SuperglobalConverter
+{
+ protected $name = '_ENV';
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/FileConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/FileConverter.php b/src/Pattern/FileConverter.php
index 809192d..15ce1ba 100644
--- a/src/Pattern/FileConverter.php
+++ b/src/Pattern/FileConverter.php
@@ -24,9 +24,10 @@ use Apache\Log4php\LoggingEvent;
* Returns the name of the file from which the logging request was issued.
* @since 2.3
*/
-class FileConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return $event->getLocationInformation()->getFileName();
- }
+class FileConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return $event->getLocationInformation()->getFileName();
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/LevelConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/LevelConverter.php b/src/Pattern/LevelConverter.php
index 3b42fe0..dabd5c3 100644
--- a/src/Pattern/LevelConverter.php
+++ b/src/Pattern/LevelConverter.php
@@ -24,9 +24,10 @@ use Apache\Log4php\LoggingEvent;
* Returns the event's level.
* @since 2.3
*/
-class LevelConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return $event->getLevel()->toString();
- }
+class LevelConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return $event->getLevel()->toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/LineConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/LineConverter.php b/src/Pattern/LineConverter.php
index 659fa11..6a47e2e 100644
--- a/src/Pattern/LineConverter.php
+++ b/src/Pattern/LineConverter.php
@@ -25,9 +25,10 @@ use Apache\Log4php\LoggingEvent;
* issued.
* @since 2.3
*/
-class LineConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return $event->getLocationInformation()->getLineNumber();
- }
+class LineConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return $event->getLocationInformation()->getLineNumber();
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/LiteralConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/LiteralConverter.php b/src/Pattern/LiteralConverter.php
index 089fa7f..061aed5 100644
--- a/src/Pattern/LiteralConverter.php
+++ b/src/Pattern/LiteralConverter.php
@@ -24,15 +24,17 @@ use Apache\Log4php\LoggingEvent;
* Returns the literal value passed in the constructor, without modifications.
* @since 2.3
*/
-class LiteralConverter extends AbstractConverter {
+class LiteralConverter extends AbstractConverter
+{
+ private $literalValue;
- private $literalValue;
+ public function __construct($literalValue)
+ {
+ $this->literalValue = $literalValue;
+ }
- public function __construct($literalValue) {
- $this->literalValue = $literalValue;
- }
-
- public function convert(LoggingEvent $event) {
- return $this->literalValue;
- }
+ public function convert(LoggingEvent $event)
+ {
+ return $this->literalValue;
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/LocationConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/LocationConverter.php b/src/Pattern/LocationConverter.php
index 4334ec7..c100807 100644
--- a/src/Pattern/LocationConverter.php
+++ b/src/Pattern/LocationConverter.php
@@ -25,13 +25,14 @@ use Apache\Log4php\LoggingEvent;
* issued.
* @since 2.3
*/
-class LocationConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return
- $event->getLocationInformation()->getClassName() . '.' .
- $event->getLocationInformation()->getMethodName() . '(' .
- $event->getLocationInformation()->getFileName() . ':' .
- $event->getLocationInformation()->getLineNumber() . ')';
- }
+class LocationConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return
+ $event->getLocationInformation()->getClassName() . '.' .
+ $event->getLocationInformation()->getMethodName() . '(' .
+ $event->getLocationInformation()->getFileName() . ':' .
+ $event->getLocationInformation()->getLineNumber() . ')';
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/LoggerConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/LoggerConverter.php b/src/Pattern/LoggerConverter.php
index 0433659..7c419ac 100644
--- a/src/Pattern/LoggerConverter.php
+++ b/src/Pattern/LoggerConverter.php
@@ -28,37 +28,39 @@ use Apache\Log4php\LoggingEvent;
* name will be shortened to the given length, if possible.
* @since 2.3
*/
-class LoggerConverter extends AbstractConverter {
+class LoggerConverter extends AbstractConverter
+{
+ /** Length to which to shorten the name. */
+ private $length;
- /** Length to which to shorten the name. */
- private $length;
+ /** Holds processed logger names. */
+ private $cache = array();
- /** Holds processed logger names. */
- private $cache = array();
+ public function activateOptions()
+ {
+ // Parse the option (desired output length)
+ if (isset($this->option) && is_numeric($this->option) && $this->option >= 0) {
+ $this->length = (integer) $this->option;
+ }
+ }
- public function activateOptions() {
- // Parse the option (desired output length)
- if (isset($this->option) && is_numeric($this->option) && $this->option >= 0) {
- $this->length = (integer) $this->option;
- }
- }
+ public function convert(LoggingEvent $event)
+ {
+ $name = $event->getLoggerName();
- public function convert(LoggingEvent $event) {
- $name = $event->getLoggerName();
+ if (!isset($this->cache[$name])) {
- if (!isset($this->cache[$name])) {
+ // If length is set return shortened logger name
+ if (isset($this->length)) {
+ $this->cache[$name] = Utils::shortenClassName($name, $this->length);
+ }
- // If length is set return shortened logger name
- if (isset($this->length)) {
- $this->cache[$name] = Utils::shortenClassName($name, $this->length);
- }
+ // If no length is specified return full logger name
+ else {
+ $this->cache[$name] = $name;
+ }
+ }
- // If no length is specified return full logger name
- else {
- $this->cache[$name] = $name;
- }
- }
-
- return $this->cache[$name];
- }
+ return $this->cache[$name];
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/MdcConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/MdcConverter.php b/src/Pattern/MdcConverter.php
index cb50c8e..6739694 100644
--- a/src/Pattern/MdcConverter.php
+++ b/src/Pattern/MdcConverter.php
@@ -27,26 +27,29 @@ use Apache\Log4php\LoggingEvent;
* [0] the MDC key
* @since 2.3
*/
-class MdcConverter extends AbstractConverter {
+class MdcConverter extends AbstractConverter
+{
+ private $key;
- private $key;
+ public function activateOptions()
+ {
+ if (isset($this->option) && $this->option !== '') {
+ $this->key = $this->option;
+ }
+ }
- public function activateOptions() {
- if (isset($this->option) && $this->option !== '') {
- $this->key = $this->option;
- }
- }
+ public function convert(LoggingEvent $event)
+ {
+ if (isset($this->key)) {
+ return $event->getMDC($this->key);
+ } else {
+ $buff = array();
+ $map = $event->getMDCMap();
+ foreach ($map as $key => $value) {
+ $buff []= "$key=$value";
+ }
- public function convert(LoggingEvent $event) {
- if (isset($this->key)) {
- return $event->getMDC($this->key);
- } else {
- $buff = array();
- $map = $event->getMDCMap();
- foreach($map as $key => $value) {
- $buff []= "$key=$value";
- }
- return implode(', ', $buff);
- }
- }
+ return implode(', ', $buff);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/MessageConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/MessageConverter.php b/src/Pattern/MessageConverter.php
index acd53d8..de9004d 100644
--- a/src/Pattern/MessageConverter.php
+++ b/src/Pattern/MessageConverter.php
@@ -24,9 +24,10 @@ use Apache\Log4php\LoggingEvent;
* Returns the logged message.
* @since 2.3
*/
-class MessageConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return $event->getRenderedMessage();
- }
+class MessageConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return $event->getRenderedMessage();
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/MethodConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/MethodConverter.php b/src/Pattern/MethodConverter.php
index d0c29e8..523693b 100644
--- a/src/Pattern/MethodConverter.php
+++ b/src/Pattern/MethodConverter.php
@@ -25,9 +25,10 @@ use Apache\Log4php\LoggingEvent;
* was issued.
* @since 2.3
*/
-class MethodConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return $event->getLocationInformation()->getMethodName();
- }
+class MethodConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return $event->getLocationInformation()->getMethodName();
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/NdcConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/NdcConverter.php b/src/Pattern/NdcConverter.php
index fb0027e..12255a4 100644
--- a/src/Pattern/NdcConverter.php
+++ b/src/Pattern/NdcConverter.php
@@ -24,9 +24,10 @@ use Apache\Log4php\LoggingEvent;
* Returns the full Nested Diagnostic Context.
* @since 2.3
*/
-class NdcConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return $event->getNDC();
- }
+class NdcConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return $event->getNDC();
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/NewLineConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/NewLineConverter.php b/src/Pattern/NewLineConverter.php
index 2e3f7e6..8754952 100644
--- a/src/Pattern/NewLineConverter.php
+++ b/src/Pattern/NewLineConverter.php
@@ -24,9 +24,10 @@ use Apache\Log4php\LoggingEvent;
* Returns platform-specific newline character(s).
* @since 2.3
*/
-class NewLineConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return PHP_EOL;
- }
+class NewLineConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return PHP_EOL;
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/ProcessConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/ProcessConverter.php b/src/Pattern/ProcessConverter.php
index 4ba2151..e0d87f3 100644
--- a/src/Pattern/ProcessConverter.php
+++ b/src/Pattern/ProcessConverter.php
@@ -24,9 +24,10 @@ use Apache\Log4php\LoggingEvent;
* Returns the PID of the current process.
* @since 2.3
*/
-class ProcessConverter extends AbstractConverter {
-
- public function convert(LoggingEvent $event) {
- return getmypid();
- }
+class ProcessConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return getmypid();
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/RelativeConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/RelativeConverter.php b/src/Pattern/RelativeConverter.php
index d6e3111..02fe940 100644
--- a/src/Pattern/RelativeConverter.php
+++ b/src/Pattern/RelativeConverter.php
@@ -25,10 +25,12 @@ use Apache\Log4php\LoggingEvent;
* application until the creation of the logging event.
* @since 2.3
*/
-class RelativeConverter extends AbstractConverter {
+class RelativeConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ $ts = $event->getRelativeTime();
- public function convert(LoggingEvent $event) {
- $ts = $event->getRelativeTime();
- return number_format($ts, 4);
- }
+ return number_format($ts, 4);
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/RequestConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/RequestConverter.php b/src/Pattern/RequestConverter.php
index 5440e75..9c72c33 100644
--- a/src/Pattern/RequestConverter.php
+++ b/src/Pattern/RequestConverter.php
@@ -18,8 +18,6 @@
namespace Apache\Log4php\Pattern;
-use Apache\Log4php\LoggingEvent;
-
/**
* Returns a value from the $_REQUEST superglobal array corresponding to the
* given key.
@@ -30,6 +28,7 @@ use Apache\Log4php\LoggingEvent;
*
* @since 2.3
*/
-class RequestConverter extends SuperglobalConverter {
- protected $name = '_REQUEST';
-}
\ No newline at end of file
+class RequestConverter extends SuperglobalConverter
+{
+ protected $name = '_REQUEST';
+}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/ServerConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/ServerConverter.php b/src/Pattern/ServerConverter.php
index c6085ce..0ed7d5a 100644
--- a/src/Pattern/ServerConverter.php
+++ b/src/Pattern/ServerConverter.php
@@ -18,8 +18,6 @@
namespace Apache\Log4php\Pattern;
-use Apache\Log4php\LoggingEvent;
-
/**
* Returns a value from the $_SERVER superglobal array corresponding to the
* given key.
@@ -30,6 +28,7 @@ use Apache\Log4php\LoggingEvent;
*
* @since 2.3
*/
-class ServerConverter extends SuperglobalConverter {
- protected $name = '_SERVER';
+class ServerConverter extends SuperglobalConverter
+{
+ protected $name = '_SERVER';
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/SessionConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/SessionConverter.php b/src/Pattern/SessionConverter.php
index c5d812b..52343de 100644
--- a/src/Pattern/SessionConverter.php
+++ b/src/Pattern/SessionConverter.php
@@ -18,8 +18,6 @@
namespace Apache\Log4php\Pattern;
-use Apache\Log4php\LoggingEvent;
-
/**
* Returns a value from the $_SESSION superglobal array corresponding to the
* given key.
@@ -30,6 +28,7 @@ use Apache\Log4php\LoggingEvent;
*
* @since 2.3
*/
-class SessionConverter extends SuperglobalConverter {
- protected $name = '_SESSION';
+class SessionConverter extends SuperglobalConverter
+{
+ protected $name = '_SESSION';
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/SessionIdConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/SessionIdConverter.php b/src/Pattern/SessionIdConverter.php
index c5d622c..23324c4 100644
--- a/src/Pattern/SessionIdConverter.php
+++ b/src/Pattern/SessionIdConverter.php
@@ -24,8 +24,10 @@ use Apache\Log4php\LoggingEvent;
* Returns the active session ID, or an empty string if out of session.
* @since 2.3
*/
-class SessionIdConverter extends AbstractConverter {
- public function convert(LoggingEvent $event) {
- return session_id();
- }
+class SessionIdConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ return session_id();
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/SuperglobalConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/SuperglobalConverter.php b/src/Pattern/SuperglobalConverter.php
index c43d0c0..7befa67 100644
--- a/src/Pattern/SuperglobalConverter.php
+++ b/src/Pattern/SuperglobalConverter.php
@@ -34,67 +34,70 @@ use Apache\Log4php\LoggingEvent;
* @see http://www.php.net/manual/en/ini.core.php#ini.variables-order
* @since 2.3
*/
-abstract class SuperglobalConverter extends AbstractConverter {
+abstract class SuperglobalConverter extends AbstractConverter
+{
+ /**
+ * Name of the superglobal variable, to be defined by subclasses.
+ * For example: "_SERVER" or "_ENV".
+ */
+ protected $name;
- /**
- * Name of the superglobal variable, to be defined by subclasses.
- * For example: "_SERVER" or "_ENV".
- */
- protected $name;
+ protected $value = '';
- protected $value = '';
+ public function activateOptions()
+ {
+ // Read the key from options array
+ if (isset($this->option) && $this->option !== '') {
+ $key = $this->option;
+ }
- public function activateOptions() {
- // Read the key from options array
- if (isset($this->option) && $this->option !== '') {
- $key = $this->option;
- }
+ /*
+ * There is a bug in PHP which doesn't allow superglobals to be
+ * accessed when their name is stored in a variable, e.g.:
+ *
+ * $name = '_SERVER';
+ * $array = $$name;
+ *
+ * This code does not work when run from within a method (only when run
+ * in global scope). But the following code does work:
+ *
+ * $name = '_SERVER';
+ * global $$name;
+ * $array = $$name;
+ *
+ * That's why global is used here.
+ */
+ global ${$this->name};
- /*
- * There is a bug in PHP which doesn't allow superglobals to be
- * accessed when their name is stored in a variable, e.g.:
- *
- * $name = '_SERVER';
- * $array = $$name;
- *
- * This code does not work when run from within a method (only when run
- * in global scope). But the following code does work:
- *
- * $name = '_SERVER';
- * global $$name;
- * $array = $$name;
- *
- * That's why global is used here.
- */
- global ${$this->name};
+ // Check the given superglobal exists. It is possible that it is not initialized.
+ if (!isset(${$this->name})) {
+ $class = basename(get_class($this));
+ trigger_error("log4php: $class: Cannot find superglobal variable \${$this->name}.", E_USER_WARNING);
- // Check the given superglobal exists. It is possible that it is not initialized.
- if (!isset(${$this->name})) {
- $class = basename(get_class($this));
- trigger_error("log4php: $class: Cannot find superglobal variable \${$this->name}.", E_USER_WARNING);
- return;
- }
+ return;
+ }
- $source = ${$this->name};
+ $source = ${$this->name};
- // When the key is set, display the matching value
- if (isset($key)) {
- if (isset($source[$key])) {
- $this->value = $source[$key];
- }
- }
+ // When the key is set, display the matching value
+ if (isset($key)) {
+ if (isset($source[$key])) {
+ $this->value = $source[$key];
+ }
+ }
- // When the key is not set, display all values
- else {
- $values = array();
- foreach($source as $key => $value) {
- $values[] = "$key=$value";
- }
- $this->value = implode(', ', $values);
- }
- }
+ // When the key is not set, display all values
+ else {
+ $values = array();
+ foreach ($source as $key => $value) {
+ $values[] = "$key=$value";
+ }
+ $this->value = implode(', ', $values);
+ }
+ }
- public function convert(LoggingEvent $event) {
- return $this->value;
- }
+ public function convert(LoggingEvent $event)
+ {
+ return $this->value;
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/ThrowableConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/ThrowableConverter.php b/src/Pattern/ThrowableConverter.php
index f18e322..8f12a84 100644
--- a/src/Pattern/ThrowableConverter.php
+++ b/src/Pattern/ThrowableConverter.php
@@ -22,14 +22,17 @@ namespace Apache\Log4php\Pattern;
* Returns the throwable information linked to the logging event, if any.
* @since 2.3
*/
-class ThrowableConverter extends AbstractConverter {
+class ThrowableConverter extends AbstractConverter
+{
+ public function convert(LoggingEvent $event)
+ {
+ $info = $event->getThrowableInformation();
+ if (isset($info)) {
+ $ex = $info->getThrowable();
- public function convert(LoggingEvent $event) {
- $info = $event->getThrowableInformation();
- if (isset($info)) {
- $ex = $info->getThrowable();
- return (string) $ex . PHP_EOL;
- }
- return '';
- }
+ return (string) $ex . PHP_EOL;
+ }
+
+ return '';
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/ReflectionUtils.php
----------------------------------------------------------------------
diff --git a/src/ReflectionUtils.php b/src/ReflectionUtils.php
index cc39ec3..38793fd 100644
--- a/src/ReflectionUtils.php
+++ b/src/ReflectionUtils.php
@@ -21,131 +21,140 @@ namespace Apache\Log4php;
/**
* Provides methods for reflective use on php objects
*/
-class ReflectionUtils {
+class ReflectionUtils
+{
+ /** the target object */
+ private $obj;
- /** the target object */
- private $obj;
+ /**
+ * Create a new ReflectionUtils for the specified Object.
+ * This is done in prepartion for invoking {@link setProperty()}
+ * one or more times.
+ * @param object &$obj the object for which to set properties
+ */
+ public function __construct($obj)
+ {
+ $this->obj = $obj;
+ }
- /**
- * Create a new ReflectionUtils for the specified Object.
- * This is done in prepartion for invoking {@link setProperty()}
- * one or more times.
- * @param object &$obj the object for which to set properties
- */
- public function __construct($obj) {
- $this->obj = $obj;
- }
+ /**
+ * Set the properties of an object passed as a parameter in one
+ * go. The <code>properties</code> are parsed relative to a
+ * <code>prefix</code>.
+ *
+ * @param object $obj The object to configure.
+ * @param array $properties An array containing keys and values.
+ * @param string $prefix Only keys having the specified prefix will be set.
+ */
+ // TODO: check, if this is really useful
+ public static function setPropertiesByObject($obj, $properties, $prefix)
+ {
+ $pSetter = new ReflectionUtils($obj);
- /**
- * Set the properties of an object passed as a parameter in one
- * go. The <code>properties</code> are parsed relative to a
- * <code>prefix</code>.
- *
- * @param object $obj The object to configure.
- * @param array $properties An array containing keys and values.
- * @param string $prefix Only keys having the specified prefix will be set.
- */
- // TODO: check, if this is really useful
- public static function setPropertiesByObject($obj, $properties, $prefix) {
- $pSetter = new ReflectionUtils($obj);
- return $pSetter->setProperties($properties, $prefix);
- }
+ return $pSetter->setProperties($properties, $prefix);
+ }
- /**
- * Set the properites for the object that match the
- * <code>prefix</code> passed as parameter.
- *
- * Example:
- *
- * $arr['xxxname'] = 'Joe';
- * $arr['xxxmale'] = true;
- * and prefix xxx causes setName and setMale.
- *
- * @param array $properties An array containing keys and values.
- * @param string $prefix Only keys having the specified prefix will be set.
- */
- public function setProperties($properties, $prefix) {
- $len = strlen($prefix);
- reset($properties);
- while(list($key,) = each($properties)) {
- if(strpos($key, $prefix) === 0) {
- if(strpos($key, '.', ($len + 1)) > 0) {
- continue;
- }
- $value = $properties[$key];
- $key = substr($key, $len);
- if($key == 'layout' and ($this->obj instanceof Appender)) {
- continue;
- }
- $this->setProperty($key, $value);
- }
- }
- $this->activate();
- }
+ /**
+ * Set the properites for the object that match the
+ * <code>prefix</code> passed as parameter.
+ *
+ * Example:
+ *
+ * $arr['xxxname'] = 'Joe';
+ * $arr['xxxmale'] = true;
+ * and prefix xxx causes setName and setMale.
+ *
+ * @param array $properties An array containing keys and values.
+ * @param string $prefix Only keys having the specified prefix will be set.
+ */
+ public function setProperties($properties, $prefix)
+ {
+ $len = strlen($prefix);
+ reset($properties);
+ while (list($key,) = each($properties)) {
+ if (strpos($key, $prefix) === 0) {
+ if (strpos($key, '.', ($len + 1)) > 0) {
+ continue;
+ }
+ $value = $properties[$key];
+ $key = substr($key, $len);
+ if ($key == 'layout' and ($this->obj instanceof Appender)) {
+ continue;
+ }
+ $this->setProperty($key, $value);
+ }
+ }
+ $this->activate();
+ }
- /**
- * Set a property on this PropertySetter's Object. If successful, this
- * method will invoke a setter method on the underlying Object. The
- * setter is the one for the specified property name and the value is
- * determined partly from the setter argument type and partly from the
- * value specified in the call to this method.
- *
- * <p>If the setter expects a String no conversion is necessary.
- * If it expects an int, then an attempt is made to convert 'value'
- * to an int using new Integer(value). If the setter expects a boolean,
- * the conversion is by new Boolean(value).
- *
- * @param string $name name of the property
- * @param string $value String value of the property
- */
- public function setProperty($name, $value) {
- if($value === null) {
- return;
- }
+ /**
+ * Set a property on this PropertySetter's Object. If successful, this
+ * method will invoke a setter method on the underlying Object. The
+ * setter is the one for the specified property name and the value is
+ * determined partly from the setter argument type and partly from the
+ * value specified in the call to this method.
+ *
+ * <p>If the setter expects a String no conversion is necessary.
+ * If it expects an int, then an attempt is made to convert 'value'
+ * to an int using new Integer(value). If the setter expects a boolean,
+ * the conversion is by new Boolean(value).
+ *
+ * @param string $name name of the property
+ * @param string $value String value of the property
+ */
+ public function setProperty($name, $value)
+ {
+ if ($value === null) {
+ return;
+ }
- $method = "set" . ucfirst($name);
+ $method = "set" . ucfirst($name);
- if(!method_exists($this->obj, $method)) {
- throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
- } else {
- return call_user_func(array($this->obj, $method), $value);
- }
- }
+ if (!method_exists($this->obj, $method)) {
+ throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
+ } else {
+ return call_user_func(array($this->obj, $method), $value);
+ }
+ }
- public function activate() {
- if(method_exists($this->obj, 'activateoptions')) {
- return call_user_func(array($this->obj, 'activateoptions'));
- }
- }
+ public function activate()
+ {
+ if (method_exists($this->obj, 'activateoptions')) {
+ return call_user_func(array($this->obj, 'activateoptions'));
+ }
+ }
- /**
- * Creates an instances from the given class name.
- *
- * @param string $classname
- * @return an object from the class with the given classname
- */
- public static function createObject($class) {
- if(!empty($class)) {
- return new $class();
- }
- return null;
- }
+ /**
+ * Creates an instances from the given class name.
+ *
+ * @param string $classname
+ * @return an object from the class with the given classname
+ */
+ public static function createObject($class)
+ {
+ if (!empty($class)) {
+ return new $class();
+ }
- /**
- * @param object $object
- * @param string $name
- * @param mixed $value
- */
- public static function setter($object, $name, $value) {
- if (empty($name)) {
- return false;
- }
- $methodName = 'set'.ucfirst($name);
- if (method_exists($object, $methodName)) {
- return call_user_func(array($object, $methodName), $value);
- } else {
- return false;
- }
- }
+ return null;
+ }
+
+ /**
+ * @param object $object
+ * @param string $name
+ * @param mixed $value
+ */
+ public static function setter($object, $name, $value)
+ {
+ if (empty($name)) {
+ return false;
+ }
+ $methodName = 'set'.ucfirst($name);
+ if (method_exists($object, $methodName)) {
+ return call_user_func(array($object, $methodName), $value);
+ } else {
+ return false;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Renderers/DefaultRenderer.php
----------------------------------------------------------------------
diff --git a/src/Renderers/DefaultRenderer.php b/src/Renderers/DefaultRenderer.php
index 78b844c..6d1a2be 100644
--- a/src/Renderers/DefaultRenderer.php
+++ b/src/Renderers/DefaultRenderer.php
@@ -24,10 +24,11 @@ namespace Apache\Log4php\Renderers;
* Renders the input using <var>print_r</var>.
* @since 0.3
*/
-class DefaultRenderer implements RendererInterface {
-
- /** @inheritdoc */
- public function render($input) {
- return print_r($input, true);
- }
+class DefaultRenderer implements RendererInterface
+{
+ /** @inheritdoc */
+ public function render($input)
+ {
+ return print_r($input, true);
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Renderers/ExceptionRenderer.php
----------------------------------------------------------------------
diff --git a/src/Renderers/ExceptionRenderer.php b/src/Renderers/ExceptionRenderer.php
index d625ae8..ad9b09f 100644
--- a/src/Renderers/ExceptionRenderer.php
+++ b/src/Renderers/ExceptionRenderer.php
@@ -22,12 +22,12 @@ namespace Apache\Log4php\Renderers;
* Renderer used for Exceptions.
* @since 2.1
*/
-class ExceptionRenderer implements RendererInterface {
-
- public function render($input) {
-
- // Exception class has a very decent __toString method
- // so let's just use that instead of writing lots of code.
- return (string) $input;
- }
+class ExceptionRenderer implements RendererInterface
+{
+ public function render($input)
+ {
+ // Exception class has a very decent __toString method
+ // so let's just use that instead of writing lots of code.
+ return (string) $input;
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Renderers/RendererInterface.php
----------------------------------------------------------------------
diff --git a/src/Renderers/RendererInterface.php b/src/Renderers/RendererInterface.php
index 8bfda22..ad96b85 100644
--- a/src/Renderers/RendererInterface.php
+++ b/src/Renderers/RendererInterface.php
@@ -22,11 +22,12 @@ namespace Apache\Log4php\Renderers;
* Implement this interface in order to render objects to strings.
* @since 0.3
*/
-interface RendererInterface {
- /**
- * Renders the entity passed as <var>input</var> to a string.
- * @param mixed $input The entity to render.
- * @return string The rendered string.
- */
- public function render($input);
+interface RendererInterface
+{
+ /**
+ * Renders the entity passed as <var>input</var> to a string.
+ * @param mixed $input The entity to render.
+ * @return string The rendered string.
+ */
+ public function render($input);
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Renderers/RendererMap.php
----------------------------------------------------------------------
diff --git a/src/Renderers/RendererMap.php b/src/Renderers/RendererMap.php
index 1444d25..1165720 100644
--- a/src/Renderers/RendererMap.php
+++ b/src/Renderers/RendererMap.php
@@ -23,167 +23,180 @@ namespace Apache\Log4php\Renderers;
* input.
* @since 0.3
*/
-class RendererMap {
-
- /**
- * Maps class names to appropriate renderers.
- * @var array
- */
- private $map = array();
-
- /**
- * The default renderer to use if no specific renderer is found.
- * @var RendererInterface
- */
- private $defaultRenderer;
-
- public function __construct() {
-
- // Set default config
- $this->reset();
- }
-
- /**
- * Adds a renderer to the map.
- *
- * If a renderer already exists for the given <var>$renderedClass</var> it
- * will be overwritten without warning.
- *
- * @param string $renderedClass The name of the class which will be
- * rendered by the renderer.
- * @param string $renderingClass The name of the class which will
- * perform the rendering.
- */
- public function addRenderer($renderedClass, $renderingClass) {
-
- if (class_exists($renderingClass)) {
- $renderer = new $renderingClass();
- } else {
- // Try to find renderer in the default namespace
- $namespaced = "Apache\\Log4php\\Renderers\\$renderingClass";
- if (class_exists($namespaced)) {
- $renderer = new $namespaced();
- }
- }
-
- if (!isset($renderer)) {
- trigger_error("log4php: Failed adding renderer. Rendering class [$renderingClass] not found.");
- return;
- }
-
- // Check the class implements the right interface
- if (!($renderer instanceof RendererInterface)) {
- trigger_error("log4php: Failed adding renderer. Rendering class [$renderingClass] does not implement the RendererInterface interface.");
- return;
- }
-
- // Convert to lowercase since class names in PHP are not case sensitive
- $renderedClass = strtolower($renderedClass);
-
- $this->map[$renderedClass] = $renderer;
- }
-
- /**
- * Sets a custom default renderer class.
- *
- * TODO: there's code duplication here. This method is almost identical to
- * addRenderer(). However, it has custom error messages so let it sit for
- * now.
- *
- * @param string $renderingClass The name of the class which will
- * perform the rendering.
- */
- public function setDefaultRenderer($renderingClass) {
- // Check the class exists
- if (!class_exists($renderingClass)) {
- trigger_error("log4php: Failed setting default renderer. Rendering class [$renderingClass] not found.");
- return;
- }
-
- // Create the instance
- $renderer = new $renderingClass();
-
- // Check the class implements the right interface
- if (!($renderer instanceof RendererInterface)) {
- trigger_error("log4php: Failed setting default renderer. Rendering class [$renderingClass] does not implement the RendererInterface interface.");
- return;
- }
-
- $this->defaultRenderer = $renderer;
- }
-
- /**
- * Returns the default renderer.
- * @var RendererInterface
- */
- public function getDefaultRenderer() {
- return $this->defaultRenderer;
- }
-
- /**
- * Finds the appropriate renderer for the given <var>input</var>, and
- * renders it (i.e. converts it to a string).
- *
- * @param mixed $input Input to render.
- * @return string The rendered contents.
- */
- public function findAndRender($input) {
- if ($input === null) {
- return null;
- }
-
- // For objects, try to find a renderer in the map
- if(is_object($input)) {
- $renderer = $this->getByClassName(get_class($input));
- if (isset($renderer)) {
- return $renderer->render($input);
- }
- }
-
- // Fall back to the default renderer
- return $this->defaultRenderer->render($input);
- }
-
- /**
- * Returns the appropriate renderer for a given object.
- *
- * @param mixed $object
- * @return RendererInterface Or null if none found.
- */
- public function getByObject($object) {
- if (!is_object($object)) {
- return null;
- }
- return $this->getByClassName(get_class($object));
- }
-
- /**
- * Returns the appropriate renderer for a given class name.
- *
- * If no renderer could be found, returns NULL.
- *
- * @param string $class
- * @return LoggerRendererObject Or null if not found.
- */
- public function getByClassName($class) {
- for(; !empty($class); $class = get_parent_class($class)) {
- $class = strtolower($class);
- if(isset($this->map[$class])) {
- return $this->map[$class];
- }
- }
- return null;
- }
-
- /** Empties the renderer map. */
- public function clear() {
- $this->map = array();
- }
-
- /** Resets the renderer map to it's default configuration. */
- public function reset() {
- $this->defaultRenderer = new DefaultRenderer();
- $this->clear();
- $this->addRenderer('Exception', 'ExceptionRenderer');
- }
+class RendererMap
+{
+ /**
+ * Maps class names to appropriate renderers.
+ * @var array
+ */
+ private $map = array();
+
+ /**
+ * The default renderer to use if no specific renderer is found.
+ * @var RendererInterface
+ */
+ private $defaultRenderer;
+
+ public function __construct()
+ {
+ // Set default config
+ $this->reset();
+ }
+
+ /**
+ * Adds a renderer to the map.
+ *
+ * If a renderer already exists for the given <var>$renderedClass</var> it
+ * will be overwritten without warning.
+ *
+ * @param string $renderedClass The name of the class which will be
+ * rendered by the renderer.
+ * @param string $renderingClass The name of the class which will
+ * perform the rendering.
+ */
+ public function addRenderer($renderedClass, $renderingClass)
+ {
+ if (class_exists($renderingClass)) {
+ $renderer = new $renderingClass();
+ } else {
+ // Try to find renderer in the default namespace
+ $namespaced = "Apache\\Log4php\\Renderers\\$renderingClass";
+ if (class_exists($namespaced)) {
+ $renderer = new $namespaced();
+ }
+ }
+
+ if (!isset($renderer)) {
+ trigger_error("log4php: Failed adding renderer. Rendering class [$renderingClass] not found.");
+
+ return;
+ }
+
+ // Check the class implements the right interface
+ if (!($renderer instanceof RendererInterface)) {
+ trigger_error("log4php: Failed adding renderer. Rendering class [$renderingClass] does not implement the RendererInterface interface.");
+
+ return;
+ }
+
+ // Convert to lowercase since class names in PHP are not case sensitive
+ $renderedClass = strtolower($renderedClass);
+
+ $this->map[$renderedClass] = $renderer;
+ }
+
+ /**
+ * Sets a custom default renderer class.
+ *
+ * TODO: there's code duplication here. This method is almost identical to
+ * addRenderer(). However, it has custom error messages so let it sit for
+ * now.
+ *
+ * @param string $renderingClass The name of the class which will
+ * perform the rendering.
+ */
+ public function setDefaultRenderer($renderingClass)
+ {
+ // Check the class exists
+ if (!class_exists($renderingClass)) {
+ trigger_error("log4php: Failed setting default renderer. Rendering class [$renderingClass] not found.");
+
+ return;
+ }
+
+ // Create the instance
+ $renderer = new $renderingClass();
+
+ // Check the class implements the right interface
+ if (!($renderer instanceof RendererInterface)) {
+ trigger_error("log4php: Failed setting default renderer. Rendering class [$renderingClass] does not implement the RendererInterface interface.");
+
+ return;
+ }
+
+ $this->defaultRenderer = $renderer;
+ }
+
+ /**
+ * Returns the default renderer.
+ * @var RendererInterface
+ */
+ public function getDefaultRenderer()
+ {
+ return $this->defaultRenderer;
+ }
+
+ /**
+ * Finds the appropriate renderer for the given <var>input</var>, and
+ * renders it (i.e. converts it to a string).
+ *
+ * @param mixed $input Input to render.
+ * @return string The rendered contents.
+ */
+ public function findAndRender($input)
+ {
+ if ($input === null) {
+ return null;
+ }
+
+ // For objects, try to find a renderer in the map
+ if (is_object($input)) {
+ $renderer = $this->getByClassName(get_class($input));
+ if (isset($renderer)) {
+ return $renderer->render($input);
+ }
+ }
+
+ // Fall back to the default renderer
+ return $this->defaultRenderer->render($input);
+ }
+
+ /**
+ * Returns the appropriate renderer for a given object.
+ *
+ * @param mixed $object
+ * @return RendererInterface Or null if none found.
+ */
+ public function getByObject($object)
+ {
+ if (!is_object($object)) {
+ return null;
+ }
+
+ return $this->getByClassName(get_class($object));
+ }
+
+ /**
+ * Returns the appropriate renderer for a given class name.
+ *
+ * If no renderer could be found, returns NULL.
+ *
+ * @param string $class
+ * @return LoggerRendererObject Or null if not found.
+ */
+ public function getByClassName($class)
+ {
+ for (; !empty($class); $class = get_parent_class($class)) {
+ $class = strtolower($class);
+ if (isset($this->map[$class])) {
+ return $this->map[$class];
+ }
+ }
+
+ return null;
+ }
+
+ /** Empties the renderer map. */
+ public function clear()
+ {
+ $this->map = array();
+ }
+
+ /** Resets the renderer map to it's default configuration. */
+ public function reset()
+ {
+ $this->defaultRenderer = new DefaultRenderer();
+ $this->clear();
+ $this->addRenderer('Exception', 'ExceptionRenderer');
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/RootLogger.php
----------------------------------------------------------------------
diff --git a/src/RootLogger.php b/src/RootLogger.php
index ba7f5c3..bd9b089 100644
--- a/src/RootLogger.php
+++ b/src/RootLogger.php
@@ -24,46 +24,50 @@ namespace Apache\Log4php;
*/
class RootLogger extends Logger
{
- /**
- * Constructor
- *
- * @param integer $level initial log level
- */
- public function __construct(Level $level = null) {
- parent::__construct('root');
+ /**
+ * Constructor
+ *
+ * @param integer $level initial log level
+ */
+ public function __construct(Level $level = null)
+ {
+ parent::__construct('root');
- if($level == null) {
- $level = Level::getLevelAll();
- }
- $this->setLevel($level);
- }
+ if ($level == null) {
+ $level = Level::getLevelAll();
+ }
+ $this->setLevel($level);
+ }
- /**
- * @return Level the level
- */
- public function getEffectiveLevel() {
- return $this->getLevel();
- }
+ /**
+ * @return Level the level
+ */
+ public function getEffectiveLevel()
+ {
+ return $this->getLevel();
+ }
- /**
- * Override level setter to prevent setting the root logger's level to
- * null. Root logger must always have a level.
- *
- * @param Level $level
- */
- public function setLevel(Level $level = null) {
- if (isset($level)) {
- parent::setLevel($level);
- } else {
- trigger_error("log4php: Cannot set RootLogger level to null.", E_USER_WARNING);
- }
- }
+ /**
+ * Override level setter to prevent setting the root logger's level to
+ * null. Root logger must always have a level.
+ *
+ * @param Level $level
+ */
+ public function setLevel(Level $level = null)
+ {
+ if (isset($level)) {
+ parent::setLevel($level);
+ } else {
+ trigger_error("log4php: Cannot set RootLogger level to null.", E_USER_WARNING);
+ }
+ }
- /**
- * Override parent setter. Root logger cannot have a parent.
- * @param Logger $parent
- */
- public function setParent(Logger $parent) {
- trigger_error("log4php: RootLogger cannot have a parent.", E_USER_WARNING);
- }
+ /**
+ * Override parent setter. Root logger cannot have a parent.
+ * @param Logger $parent
+ */
+ public function setParent(Logger $parent)
+ {
+ trigger_error("log4php: RootLogger cannot have a parent.", E_USER_WARNING);
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/ThrowableInformation.php
----------------------------------------------------------------------
diff --git a/src/ThrowableInformation.php b/src/ThrowableInformation.php
index e2befeb..255c0b8 100644
--- a/src/ThrowableInformation.php
+++ b/src/ThrowableInformation.php
@@ -25,43 +25,46 @@ namespace Apache\Log4php;
*/
class ThrowableInformation
{
- /** @var Exception Throwable to log */
- private $throwable;
+ /** @var Exception Throwable to log */
+ private $throwable;
- /** @var array Array of throwable messages */
- private $throwableArray;
+ /** @var array Array of throwable messages */
+ private $throwableArray;
- /**
- * Create a new instance
- *
- * @param $throwable - a throwable as a exception
- * @param $logger - Logger reference
- */
- public function __construct(\Exception $throwable) {
- $this->throwable = $throwable;
- }
+ /**
+ * Create a new instance
+ *
+ * @param $throwable - a throwable as a exception
+ * @param $logger - Logger reference
+ */
+ public function __construct(\Exception $throwable)
+ {
+ $this->throwable = $throwable;
+ }
- /**
- * Return source exception
- *
- * @return Exception
- */
- public function getThrowable() {
- return $this->throwable;
- }
+ /**
+ * Return source exception
+ *
+ * @return Exception
+ */
+ public function getThrowable()
+ {
+ return $this->throwable;
+ }
- /**
- * @desc Returns string representation of throwable
- *
- * @return array
- */
- public function getStringRepresentation() {
- if (!is_array($this->throwableArray)) {
- $renderer = new Renderers\ExceptionRenderer();
+ /**
+ * @desc Returns string representation of throwable
+ *
+ * @return array
+ */
+ public function getStringRepresentation()
+ {
+ if (!is_array($this->throwableArray)) {
+ $renderer = new Renderers\ExceptionRenderer();
- $this->throwableArray = explode("\n", $renderer->render($this->throwable));
- }
+ $this->throwableArray = explode("\n", $renderer->render($this->throwable));
+ }
- return $this->throwableArray;
- }
+ return $this->throwableArray;
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/bootstrap.php
----------------------------------------------------------------------
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index b95c505..3d81583 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -30,7 +30,7 @@ date_default_timezone_set('Europe/London');
// Define a temp dir where tests may write to
$tmpDir = __DIR__ . '/../target/temp/phpunit';
if (!is_dir($tmpDir)) {
- mkdir($tmpDir, 0777, true);
+ mkdir($tmpDir, 0777, true);
}
define('PHPUNIT_TEMP_DIR', realpath($tmpDir));
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/php/config_empty.php
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/php/config_empty.php b/tests/resources/configs/adapters/php/config_empty.php
index 5ca9004..eaf556c 100644
--- a/tests/resources/configs/adapters/php/config_empty.php
+++ b/tests/resources/configs/adapters/php/config_empty.php
@@ -1,26 +1,24 @@
-<?php
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @category tests
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php
- */
-
-// Empty config
-
-?>
\ No newline at end of file
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category tests
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link http://logging.apache.org/log4php
+ */
+
+// Empty config
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/php/config_invalid_syntax.php
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/php/config_invalid_syntax.php b/tests/resources/configs/adapters/php/config_invalid_syntax.php
index 5019f68..49df5f4 100644
--- a/tests/resources/configs/adapters/php/config_invalid_syntax.php
+++ b/tests/resources/configs/adapters/php/config_invalid_syntax.php
@@ -1,40 +1,38 @@
-<?php
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @category tests
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php
- */
-
-return array(
- 'rootLogger' => array(
- 'level' => 'info',
- 'appenders' => array('default')
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'EchoAppender',
- 'layout' => array(
- 'class' => 'SimpleLayout'
- )
- )
- )
-
-// Invalid file - no closing brace.
-
-?>
\ No newline at end of file
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category tests
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link http://logging.apache.org/log4php
+ */
+
+return array(
+ 'rootLogger' => array(
+ 'level' => 'info',
+ 'appenders' => array('default')
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'EchoAppender',
+ 'layout' => array(
+ 'class' => 'SimpleLayout'
+ )
+ )
+ )
+
+// Invalid file - no closing brace.
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/php/config_not_an_array.php
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/php/config_not_an_array.php b/tests/resources/configs/adapters/php/config_not_an_array.php
index 030bb10..a4b3945 100644
--- a/tests/resources/configs/adapters/php/config_not_an_array.php
+++ b/tests/resources/configs/adapters/php/config_not_an_array.php
@@ -1,27 +1,25 @@
-<?php
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @category tests
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php
- */
-
-// Not an array
-return new Exception();
-
-?>
\ No newline at end of file
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category tests
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link http://logging.apache.org/log4php
+ */
+
+// Not an array
+return new Exception();
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/php/config_valid.php
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/php/config_valid.php b/tests/resources/configs/adapters/php/config_valid.php
index bfabfce..6485239 100644
--- a/tests/resources/configs/adapters/php/config_valid.php
+++ b/tests/resources/configs/adapters/php/config_valid.php
@@ -1,40 +1,38 @@
-<?php
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @category tests
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php
- */
-
-return array(
- 'rootLogger' => array(
- 'level' => 'info',
- 'appenders' => array('default')
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'EchoAppender',
- 'layout' => array(
- 'class' => 'SimpleLayout'
- )
- )
- )
-)
-;
-
-?>
\ No newline at end of file
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category tests
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link http://logging.apache.org/log4php
+ */
+
+return array(
+ 'rootLogger' => array(
+ 'level' => 'info',
+ 'appenders' => array('default')
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'EchoAppender',
+ 'layout' => array(
+ 'class' => 'SimpleLayout'
+ )
+ )
+ )
+)
+;
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/xml/config_duplicate_logger.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/xml/config_duplicate_logger.xml b/tests/resources/configs/adapters/xml/config_duplicate_logger.xml
index 978b9c7..db60593 100644
--- a/tests/resources/configs/adapters/xml/config_duplicate_logger.xml
+++ b/tests/resources/configs/adapters/xml/config_duplicate_logger.xml
@@ -1,39 +1,39 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
-
- <appender name="default" class="EchoAppender">
- <layout class="SimpleLayout"/>
- </appender>
-
- <!-- Duplicate logger -->
- <logger name="foo">
- <level value="info" />
- <appender_ref ref="default" />
- </logger>
-
- <logger name="foo">
- <level value="warn" />
- <appender_ref ref="default" />
- </logger>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+
+ <appender name="default" class="EchoAppender">
+ <layout class="SimpleLayout"/>
+ </appender>
+
+ <!-- Duplicate logger -->
+ <logger name="foo">
+ <level value="info" />
+ <appender_ref ref="default" />
+ </logger>
+
+ <logger name="foo">
+ <level value="warn" />
+ <appender_ref ref="default" />
+ </logger>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/xml/config_duplicate_renderer.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/xml/config_duplicate_renderer.xml b/tests/resources/configs/adapters/xml/config_duplicate_renderer.xml
index 4ac97bc..a79b0e0 100644
--- a/tests/resources/configs/adapters/xml/config_duplicate_renderer.xml
+++ b/tests/resources/configs/adapters/xml/config_duplicate_renderer.xml
@@ -1,30 +1,30 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<configuration>
- <!-- Duplicate renderer -->
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer1" />
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer2" />
- <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
- <appender name="default" class="EchoAppender">
- <layout class="SimpleLayout"/>
- </appender>
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration>
+ <!-- Duplicate renderer -->
+ <renderer renderedClass="Fruit" renderingClass="FruitRenderer1" />
+ <renderer renderedClass="Fruit" renderingClass="FruitRenderer2" />
+ <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
+ <appender name="default" class="EchoAppender">
+ <layout class="SimpleLayout"/>
+ </appender>
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/xml/config_invalid_syntax.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/xml/config_invalid_syntax.xml b/tests/resources/configs/adapters/xml/config_invalid_syntax.xml
index 6592fa5..1e2c3c1 100644
--- a/tests/resources/configs/adapters/xml/config_invalid_syntax.xml
+++ b/tests/resources/configs/adapters/xml/config_invalid_syntax.xml
@@ -1,39 +1,39 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <appender name="default" class="EchoAppender">
- <layout class="SimpleLayout"/>
- </appender>
-
- <!-- Duplicate logger -->
- <logger name="foo">
- <level value="info" />
- <appender_ref ref="default" />
- </logger>
-
- <logger name="foo">
- <level value="warn" />
- <appender_ref ref="default" />
- </logger>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-
- <!-- Invalid XML file for testing -->
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+ <appender name="default" class="EchoAppender">
+ <layout class="SimpleLayout"/>
+ </appender>
+
+ <!-- Duplicate logger -->
+ <logger name="foo">
+ <level value="info" />
+ <appender_ref ref="default" />
+ </logger>
+
+ <logger name="foo">
+ <level value="warn" />
+ <appender_ref ref="default" />
+ </logger>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+
+ <!-- Invalid XML file for testing -->
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/xml/config_valid.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/xml/config_valid.xml b/tests/resources/configs/adapters/xml/config_valid.xml
index 6553c44..bb326a6 100644
--- a/tests/resources/configs/adapters/xml/config_valid.xml
+++ b/tests/resources/configs/adapters/xml/config_valid.xml
@@ -1,54 +1,54 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer" />
- <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
- <appender name="default" class="EchoAppender">
- <layout class="LoggerLayoutTTCC"/>
- <filter class="LevelRangeFilter">
- <param name="levelMin" value="ERROR" />
- <param name="levelMax" value="FATAL" />
- <param name="acceptOnMatch" value="false" />
- </filter>
- <filter class="DenyAllFilter" />
- </appender>
- <appender name="file" class="DailyFileAppender" threshold="warn">
- <param name="datePattern" value="Ymd" />
- <param name="file" value="target/examples/daily_%s.log" />
- <layout class="PatternLayout">
- <param name="conversionPattern" value= "%d{ISO8601} [%p] %c: %m (at %F line %L)%n" />
- </layout>
- </appender>
- <logger name="foo.bar.baz" additivity="false">
- <level value="trace" />
- <appender_ref ref="default" />
- </logger>
- <logger name="foo.bar" additivity="true">
- <level value="debug" />
- <appender_ref ref="file" />
- </logger>
- <logger name="foo">
- <level value="warn" />
- <appender_ref ref="default" />
- <appender_ref ref="file" />
- </logger>
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+ <renderer renderedClass="Fruit" renderingClass="FruitRenderer" />
+ <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
+ <appender name="default" class="EchoAppender">
+ <layout class="LoggerLayoutTTCC"/>
+ <filter class="LevelRangeFilter">
+ <param name="levelMin" value="ERROR" />
+ <param name="levelMax" value="FATAL" />
+ <param name="acceptOnMatch" value="false" />
+ </filter>
+ <filter class="DenyAllFilter" />
+ </appender>
+ <appender name="file" class="DailyFileAppender" threshold="warn">
+ <param name="datePattern" value="Ymd" />
+ <param name="file" value="target/examples/daily_%s.log" />
+ <layout class="PatternLayout">
+ <param name="conversionPattern" value= "%d{ISO8601} [%p] %c: %m (at %F line %L)%n" />
+ </layout>
+ </appender>
+ <logger name="foo.bar.baz" additivity="false">
+ <level value="trace" />
+ <appender_ref ref="default" />
+ </logger>
+ <logger name="foo.bar" additivity="true">
+ <level value="debug" />
+ <appender_ref ref="file" />
+ </logger>
+ <logger name="foo">
+ <level value="warn" />
+ <appender_ref ref="default" />
+ <appender_ref ref="file" />
+ </logger>
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/adapters/xml/config_valid_underscore.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/adapters/xml/config_valid_underscore.xml b/tests/resources/configs/adapters/xml/config_valid_underscore.xml
index 4ff6e21..179629e 100644
--- a/tests/resources/configs/adapters/xml/config_valid_underscore.xml
+++ b/tests/resources/configs/adapters/xml/config_valid_underscore.xml
@@ -1,57 +1,57 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- Same as config_valid.xml but uses appender-ref instead of appender_ref -->
-
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer" />
- <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
- <appender name="default" class="EchoAppender">
- <layout class="LoggerLayoutTTCC"/>
- <filter class="LevelRangeFilter">
- <param name="levelMin" value="ERROR" />
- <param name="levelMax" value="FATAL" />
- <param name="acceptOnMatch" value="false" />
- </filter>
- <filter class="DenyAllFilter" />
- </appender>
- <appender name="file" class="DailyFileAppender" threshold="warn">
- <param name="datePattern" value="Ymd" />
- <param name="file" value="target/examples/daily_%s.log" />
- <layout class="PatternLayout">
- <param name="conversionPattern" value= "%d{ISO8601} [%p] %c: %m (at %F line %L)%n" />
- </layout>
- </appender>
- <logger name="foo.bar.baz" additivity="false">
- <level value="trace" />
- <appender-ref ref="default" />
- </logger>
- <logger name="foo.bar" additivity="true">
- <level value="debug" />
- <appender-ref ref="file" />
- </logger>
- <logger name="foo">
- <level value="warn" />
- <appender-ref ref="default" />
- <appender-ref ref="file" />
- </logger>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="default" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Same as config_valid.xml but uses appender-ref instead of appender_ref -->
+
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+ <renderer renderedClass="Fruit" renderingClass="FruitRenderer" />
+ <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
+ <appender name="default" class="EchoAppender">
+ <layout class="LoggerLayoutTTCC"/>
+ <filter class="LevelRangeFilter">
+ <param name="levelMin" value="ERROR" />
+ <param name="levelMax" value="FATAL" />
+ <param name="acceptOnMatch" value="false" />
+ </filter>
+ <filter class="DenyAllFilter" />
+ </appender>
+ <appender name="file" class="DailyFileAppender" threshold="warn">
+ <param name="datePattern" value="Ymd" />
+ <param name="file" value="target/examples/daily_%s.log" />
+ <layout class="PatternLayout">
+ <param name="conversionPattern" value= "%d{ISO8601} [%p] %c: %m (at %F line %L)%n" />
+ </layout>
+ </appender>
+ <logger name="foo.bar.baz" additivity="false">
+ <level value="trace" />
+ <appender-ref ref="default" />
+ </logger>
+ <logger name="foo.bar" additivity="true">
+ <level value="debug" />
+ <appender-ref ref="file" />
+ </logger>
+ <logger name="foo">
+ <level value="warn" />
+ <appender-ref ref="default" />
+ <appender-ref ref="file" />
+ </logger>
+ <root>
+ <level value="DEBUG" />
+ <appender-ref ref="default" />
+ </root>
+</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/resources/configs/appenders/config_invalid_appender_class.xml
----------------------------------------------------------------------
diff --git a/tests/resources/configs/appenders/config_invalid_appender_class.xml b/tests/resources/configs/appenders/config_invalid_appender_class.xml
index db3ccf0..0f72552 100644
--- a/tests/resources/configs/appenders/config_invalid_appender_class.xml
+++ b/tests/resources/configs/appenders/config_invalid_appender_class.xml
@@ -1,25 +1,25 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <appender name="foo" class="stdClass"/>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
+ <appender name="foo" class="stdClass"/>
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="default" />
+ </root>
+</configuration>