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 ih...@apache.org on 2011/01/15 11:56:24 UTC

svn commit: r1059292 [2/2] - in /logging/log4php/trunk/src/main/php: ./ appenders/ configurators/ filters/ helpers/ layouts/ renderers/

Modified: logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php (original)
+++ logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php Sat Jan 15 10:56:23 2011
@@ -34,21 +34,21 @@ class LoggerOptionConverter {
 	const DELIM_START_LEN = 2;
 	const DELIM_STOP_LEN = 1;
 
-   /**
-	* Read a predefined var.
-	*
-	* It returns a value referenced by <var>$key</var> using this search criteria:
-	* - if <var>$key</var> is a constant then return it. Else
-	* - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
-	* - return <var>$def</var>. 
-	*
-	* @param string $key The key to search for.
-	* @param string $def The default value to return.
-	* @return string	the string value of the system property, or the default
-	*					value if there is no property with that key.
-	*
-	* @static
-	*/
+	/**
+	 * Read a predefined var.
+	 *
+	 * It returns a value referenced by <var>$key</var> using this search criteria:
+	 * - if <var>$key</var> is a constant then return it. Else
+	 * - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
+	 * - return <var>$def</var>. 
+	 *
+	 * @param string $key The key to search for.
+	 * @param string $def The default value to return.
+	 * @return string	the string value of the system property, or the default
+	 *					value if there is no property with that key.
+	 *
+	 * @static
+	 */
 	public static function getSystemProperty($key, $def) {
 		if(defined($key)) {
 			return (string)constant($key);
@@ -76,20 +76,19 @@ class LoggerOptionConverter {
 	 * @static
 	 */
 	public static function toBoolean($value, $default=true) {
-	    if (is_null($value)) {
+		if (is_null($value)) {
 			return $default;
-	    } elseif (is_string($value)) {
-		$trimmedVal = strtolower(trim($value));
-	
-            if("1" == $trimmedVal or "true" == $trimmedVal or "yes" == $trimmedVal or "on" == $trimmedVal) {
-			return true;
-            } else if ("" == $trimmedVal or "0" == $trimmedVal or "false" == $trimmedVal or "no" == $trimmedVal or "off" == $trimmedVal) {
-			return false;
-		}
+		} elseif (is_string($value)) {
+			$trimmedVal = strtolower(trim($value));
+			if("1" == $trimmedVal or "true" == $trimmedVal or "yes" == $trimmedVal or "on" == $trimmedVal) {
+				return true;
+			} else if ("" == $trimmedVal or "0" == $trimmedVal or "false" == $trimmedVal or "no" == $trimmedVal or "off" == $trimmedVal) {
+				return false;
+			}
 		} elseif (is_bool($value)) {
-		    return $value;
+			return $value;
 		} elseif (is_int($value)) {
-		    return !($value == 0); // true is everything but 0 like in C 
+			return !($value == 0); // true is everything but 0 like in C 
 		}
 		
 		trigger_error("Could not convert ".var_export($value,1)." to boolean!", E_USER_WARNING);
@@ -217,26 +216,26 @@ class LoggerOptionConverter {
 	public static function findAndSubst($key, $props) {
 		$value = @$props[$key];
 
-        // If coming from the LoggerConfiguratorIni, some options were
-        // already mangled by parse_ini_file:
-        //
-        // not specified      => never reaches this code
-        // ""|off|false|null  => string(0) ""
-        // "1"|on|true        => string(1) "1"
-        // "true"             => string(4) "true"
-        // "false"            => string(5) "false"
-        // 
-        // As the integer 1 and the boolean true are therefore indistinguable
-        // it's up to the setter how to deal with it, they can not be cast
-        // into a boolean here. {@see toBoolean}
-        // Even an empty value has to be given to the setter as it has been
-        // explicitly set by the user and is different from an option which
-        // has not been specified and therefore keeps its default value.
-        //
+		// If coming from the LoggerConfiguratorIni, some options were
+		// already mangled by parse_ini_file:
+		//
+		// not specified      => never reaches this code
+		// ""|off|false|null  => string(0) ""
+		// "1"|on|true        => string(1) "1"
+		// "true"             => string(4) "true"
+		// "false"            => string(5) "false"
+		// 
+		// As the integer 1 and the boolean true are therefore indistinguable
+		// it's up to the setter how to deal with it, they can not be cast
+		// into a boolean here. {@see toBoolean}
+		// Even an empty value has to be given to the setter as it has been
+		// explicitly set by the user and is different from an option which
+		// has not been specified and therefore keeps its default value.
+		//
 		// if(!empty($value)) {
 			return LoggerOptionConverter::substVars($value, $props);
 		// }
-    }
+	}
 
 	/**
 	 * Perform variable substitution in string <var>$val</var> from the

Modified: logging/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php (original)
+++ logging/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php Sat Jan 15 10:56:23 2011
@@ -48,177 +48,178 @@
  */
 class LoggerLayoutHtml extends LoggerLayout {
 
-    /**
-     * The <b>LocationInfo</b> option takes a boolean value. By
-     * default, it is set to false which means there will be no location
-     * information output by this layout. If the the option is set to
-     * true, then the file name and line number of the statement
-     * at the origin of the log statement will be output.
-     *
-     * <p>If you are embedding this layout within a {@link LoggerAppenderMail}
-     * or a {@link LoggerAppenderMailEvent} then make sure to set the
-     * <b>LocationInfo</b> option of that appender as well.
-     * @var boolean
-     */
-    private $locationInfo = false;
-    
-    /**
-     * The <b>Title</b> option takes a String value. This option sets the
-     * document title of the generated HTML document.
-     * Defaults to 'Log4php Log Messages'.
-     * @var string
-     */
-    private $title = "Log4php Log Messages";
-    
-    /**
-     * Constructor
-     */
-    public function __construct() {
-    }
-    
-    /**
-     * The <b>LocationInfo</b> option takes a boolean value. By
-     * default, it is set to false which means there will be no location
-     * information output by this layout. If the the option is set to
-     * true, then the file name and line number of the statement
-     * at the origin of the log statement will be output.
-     *
-     * <p>If you are embedding this layout within a {@link LoggerAppenderMail}
-     * or a {@link LoggerAppenderMailEvent} then make sure to set the
-     * <b>LocationInfo</b> option of that appender as well.
-     */
-    public function setLocationInfo($flag) {
-        if (is_bool($flag)) {
-            $this->locationInfo = $flag;
-        } else {
-            $this->locationInfo = (bool)(strtolower($flag) == 'true');
-        }
-    }
-
-    /**
-     * Returns the current value of the <b>LocationInfo</b> option.
-     */
-    public function getLocationInfo() {
-        return $this->locationInfo;
-    }
-    
-    /**
-     * The <b>Title</b> option takes a String value. This option sets the
-     * document title of the generated HTML document.
-     * Defaults to 'Log4php Log Messages'.
-     */
-    public function setTitle($title) {
-        $this->title = $title;
-    }
-
-    /**
-     * @return string Returns the current value of the <b>Title</b> option.
-     */
-    public function getTitle() {
-        return $this->title;
-    }
-    
-    /**
-     * @return string Returns the content type output by this layout, i.e "text/html".
-     */
-    public function getContentType() {
-        return "text/html";
-    }
-    
-    /**
-     * @param LoggerLoggingEvent $event
-     * @return string
-     */
-    public function format(LoggerLoggingEvent $event) {
-        $sbuf = PHP_EOL . "<tr>" . PHP_EOL;
-    
-        $sbuf .= "<td>";
-        $sbuf .= $event->getTime();
-        $sbuf .= "</td>" . PHP_EOL;
-    
-        $sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">";
-        $sbuf .= $event->getThreadName();
-        $sbuf .= "</td>" . PHP_EOL;
-    
-        $sbuf .= "<td title=\"Level\">";
-        
-        $level = $event->getLevel();
-        
-        if ($level->equals(LoggerLevel::getLevelDebug())) {
-          $sbuf .= "<font color=\"#339933\">$level</font>";
-        } else if ($level->equals(LoggerLevel::getLevelWarn())) {
-          $sbuf .= "<font color=\"#993300\"><strong>$level</strong></font>";
-        } else {
-          $sbuf .= $level;
-        }
-        $sbuf .= "</td>" . PHP_EOL;
-    
-        $sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), ENT_QUOTES) . " category\">";
-        $sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES);
-        $sbuf .= "</td>" . PHP_EOL;
-    
-        if ($this->locationInfo) {
-            $locInfo = $event->getLocationInformation();
-            $sbuf .= "<td>";
-            $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES). ':' . $locInfo->getLineNumber();
-            $sbuf .= "</td>" . PHP_EOL;
-        }
-
-        $sbuf .= "<td title=\"Message\">";
-        $sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES);
-        $sbuf .= "</td>" . PHP_EOL;
-
-        $sbuf .= "</tr>" . PHP_EOL;
-        
-        if ($event->getNDC() != null) {
-            $sbuf .= "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">";
-            $sbuf .= "NDC: " . htmlentities($event->getNDC(), ENT_QUOTES);
-            $sbuf .= "</td></tr>" . PHP_EOL;
-        }
-        return $sbuf;
-    }
-
-    /**
-     * @return string Returns appropriate HTML headers.
-     */
-    public function getHeader() {
-        $sbuf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . PHP_EOL;
-        $sbuf .= "<html>" . PHP_EOL;
-        $sbuf .= "<head>" . PHP_EOL;
-        $sbuf .= "<title>" . $this->title . "</title>" . PHP_EOL;
-        $sbuf .= "<style type=\"text/css\">" . PHP_EOL;
-        $sbuf .= "<!--" . PHP_EOL;
-        $sbuf .= "body, table {font-family: arial,sans-serif; font-size: x-small;}" . PHP_EOL;
-        $sbuf .= "th {background: #336699; color: #FFFFFF; text-align: left;}" . PHP_EOL;
-        $sbuf .= "-->" . PHP_EOL;
-        $sbuf .= "</style>" . PHP_EOL;
-        $sbuf .= "</head>" . PHP_EOL;
-        $sbuf .= "<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">" . PHP_EOL;
-        $sbuf .= "<hr size=\"1\" noshade>" . PHP_EOL;
-        $sbuf .= "Log session start time " . strftime('%c', time()) . "<br>" . PHP_EOL;
-        $sbuf .= "<br>" . PHP_EOL;
-        $sbuf .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" bordercolor=\"#224466\" width=\"100%\">" . PHP_EOL;
-        $sbuf .= "<tr>" . PHP_EOL;
-        $sbuf .= "<th>Time</th>" . PHP_EOL;
-        $sbuf .= "<th>Thread</th>" . PHP_EOL;
-        $sbuf .= "<th>Level</th>" . PHP_EOL;
-        $sbuf .= "<th>Category</th>" . PHP_EOL;
-        if ($this->locationInfo)
-            $sbuf .= "<th>File:Line</th>" . PHP_EOL;
-        $sbuf .= "<th>Message</th>" . PHP_EOL;
-        $sbuf .= "</tr>" . PHP_EOL;
-
-        return $sbuf;
-    }
-
-    /**
-     * @return string Returns the appropriate HTML footers.
-     */
-    public function getFooter() {
-        $sbuf = "</table>" . PHP_EOL;
-        $sbuf .= "<br>" . PHP_EOL;
-        $sbuf .= "</body></html>";
+	/**
+	 * The <b>LocationInfo</b> option takes a boolean value. By
+	 * default, it is set to false which means there will be no location
+	 * information output by this layout. If the the option is set to
+	 * true, then the file name and line number of the statement
+	 * at the origin of the log statement will be output.
+	 *
+	 * <p>If you are embedding this layout within a {@link LoggerAppenderMail}
+	 * or a {@link LoggerAppenderMailEvent} then make sure to set the
+	 * <b>LocationInfo</b> option of that appender as well.
+	 * @var boolean
+	 */
+	private $locationInfo = false;
+	
+	/**
+	 * The <b>Title</b> option takes a String value. This option sets the
+	 * document title of the generated HTML document.
+	 * Defaults to 'Log4php Log Messages'.
+	 * @var string
+	 */
+	private $title = "Log4php Log Messages";
+	
+	/**
+	 * Constructor
+	 */
+	public function __construct() {
+	}
+	
+	/**
+	 * The <b>LocationInfo</b> option takes a boolean value. By
+	 * default, it is set to false which means there will be no location
+	 * information output by this layout. If the the option is set to
+	 * true, then the file name and line number of the statement
+	 * at the origin of the log statement will be output.
+	 *
+	 * <p>If you are embedding this layout within a {@link LoggerAppenderMail}
+	 * or a {@link LoggerAppenderMailEvent} then make sure to set the
+	 * <b>LocationInfo</b> option of that appender as well.
+	 */
+	public function setLocationInfo($flag) {
+		if (is_bool($flag)) {
+			$this->locationInfo = $flag;
+		} else {
+			$this->locationInfo = (bool)(strtolower($flag) == 'true');
+		}
+	}
+
+	/**
+	 * Returns the current value of the <b>LocationInfo</b> option.
+	 */
+	public function getLocationInfo() {
+		return $this->locationInfo;
+	}
+	
+	/**
+	 * The <b>Title</b> option takes a String value. This option sets the
+	 * document title of the generated HTML document.
+	 * Defaults to 'Log4php Log Messages'.
+	 */
+	public function setTitle($title) {
+		$this->title = $title;
+	}
+
+	/**
+	 * @return string Returns the current value of the <b>Title</b> option.
+	 */
+	public function getTitle() {
+		return $this->title;
+	}
+	
+	/**
+	 * @return string Returns the content type output by this layout, i.e "text/html".
+	 */
+	public function getContentType() {
+		return "text/html";
+	}
+	
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function format(LoggerLoggingEvent $event) {
+		$sbuf = PHP_EOL . "<tr>" . PHP_EOL;
+	
+		$sbuf .= "<td>";
+		$sbuf .= $event->getTime();
+		$sbuf .= "</td>" . PHP_EOL;
+	
+		$sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">";
+		$sbuf .= $event->getThreadName();
+		$sbuf .= "</td>" . PHP_EOL;
+	
+		$sbuf .= "<td title=\"Level\">";
+		
+		$level = $event->getLevel();
+		
+		if ($level->equals(LoggerLevel::getLevelDebug())) {
+			$sbuf .= "<font color=\"#339933\">$level</font>";
+		} else if ($level->equals(LoggerLevel::getLevelWarn())) {
+			$sbuf .= "<font color=\"#993300\"><strong>$level</strong></font>";
+		} else {
+			$sbuf .= $level;
+		}
+		$sbuf .= "</td>" . PHP_EOL;
+	
+		$sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), ENT_QUOTES) . " category\">";
+		$sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES);
+		$sbuf .= "</td>" . PHP_EOL;
+	
+		if ($this->locationInfo) {
+			$locInfo = $event->getLocationInformation();
+			$sbuf .= "<td>";
+			$sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES). ':' . $locInfo->getLineNumber();
+			$sbuf .= "</td>" . PHP_EOL;
+		}
+
+		$sbuf .= "<td title=\"Message\">";
+		$sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES);
+		$sbuf .= "</td>" . PHP_EOL;
+
+		$sbuf .= "</tr>" . PHP_EOL;
+		
+		if ($event->getNDC() != null) {
+			$sbuf .= "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">";
+			$sbuf .= "NDC: " . htmlentities($event->getNDC(), ENT_QUOTES);
+			$sbuf .= "</td></tr>" . PHP_EOL;
+		}
+		return $sbuf;
+	}
+
+	/**
+	 * @return string Returns appropriate HTML headers.
+	 */
+	public function getHeader() {
+		$sbuf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . PHP_EOL;
+		$sbuf .= "<html>" . PHP_EOL;
+		$sbuf .= "<head>" . PHP_EOL;
+		$sbuf .= "<title>" . $this->title . "</title>" . PHP_EOL;
+		$sbuf .= "<style type=\"text/css\">" . PHP_EOL;
+		$sbuf .= "<!--" . PHP_EOL;
+		$sbuf .= "body, table {font-family: arial,sans-serif; font-size: x-small;}" . PHP_EOL;
+		$sbuf .= "th {background: #336699; color: #FFFFFF; text-align: left;}" . PHP_EOL;
+		$sbuf .= "-->" . PHP_EOL;
+		$sbuf .= "</style>" . PHP_EOL;
+		$sbuf .= "</head>" . PHP_EOL;
+		$sbuf .= "<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">" . PHP_EOL;
+		$sbuf .= "<hr size=\"1\" noshade>" . PHP_EOL;
+		$sbuf .= "Log session start time " . strftime('%c', time()) . "<br>" . PHP_EOL;
+		$sbuf .= "<br>" . PHP_EOL;
+		$sbuf .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" bordercolor=\"#224466\" width=\"100%\">" . PHP_EOL;
+		$sbuf .= "<tr>" . PHP_EOL;
+		$sbuf .= "<th>Time</th>" . PHP_EOL;
+		$sbuf .= "<th>Thread</th>" . PHP_EOL;
+		$sbuf .= "<th>Level</th>" . PHP_EOL;
+		$sbuf .= "<th>Category</th>" . PHP_EOL;
+		if ($this->locationInfo) {
+			$sbuf .= "<th>File:Line</th>" . PHP_EOL;
+		}
+		$sbuf .= "<th>Message</th>" . PHP_EOL;
+		$sbuf .= "</tr>" . PHP_EOL;
+
+		return $sbuf;
+	}
+
+	/**
+	 * @return string Returns the appropriate HTML footers.
+	 */
+	public function getFooter() {
+		$sbuf = "</table>" . PHP_EOL;
+		$sbuf .= "<br>" . PHP_EOL;
+		$sbuf .= "</body></html>";
 
-        return $sbuf;
-    }
+		return $sbuf;
+	}
 }

Modified: logging/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php (original)
+++ logging/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php Sat Jan 15 10:56:23 2011
@@ -192,28 +192,28 @@ class LoggerLayoutPattern extends Logger
 		return $sbuf;
 	}
 	
-    /**
-     * Returns an array with the formatted elements.
-     * 
-     * This method is mainly used for the prepared statements of {@see LoggerAppenderPDO}.
-     * 
-     * It requires {@link $this->pattern} to be a comma separated string of patterns like
-     * e.g. <code>%d,%c,%p,%m,%t,%F,%L</code>.
-     * 
-     * @return array(string)   An array of the converted elements i.e. timestamp, message, filename etc.
-     */
-    public function formatToArray(LoggerLoggingEvent $event) {
-        $results = array();
-        $c = $this->head;
-        while ($c !== null) {
-            if ( ! $c instanceOf LoggerLiteralPatternConverter) {
-                $sbuf = null;
-                $c->format($sbuf, $event);
-                $results[] = $sbuf;
-            }
-            $c = $c->next;
-        }
-        return $results;
-    }      
+	/**
+	 * Returns an array with the formatted elements.
+	 * 
+	 * This method is mainly used for the prepared statements of {@see LoggerAppenderPDO}.
+	 * 
+	 * It requires {@link $this->pattern} to be a comma separated string of patterns like
+	 * e.g. <code>%d,%c,%p,%m,%t,%F,%L</code>.
+	 * 
+	 * @return array(string)   An array of the converted elements i.e. timestamp, message, filename etc.
+	 */
+	public function formatToArray(LoggerLoggingEvent $event) {
+		$results = array();
+		$c = $this->head;
+		while ($c !== null) {
+			if ( ! $c instanceOf LoggerLiteralPatternConverter) {
+				$sbuf = null;
+				$c->format($sbuf, $event);
+				$results[] = $sbuf;
+			}
+			$c = $c->next;
+		}
+		return $results;
+	}
 	
 }
\ No newline at end of file

Modified: logging/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php (original)
+++ logging/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php Sat Jan 15 10:56:23 2011
@@ -39,24 +39,24 @@
  * @subpackage layouts
  */  
 class LoggerLayoutSimple extends LoggerLayout {
-    /**
-     * Constructor
-     */
-    public function __construct() {
-    }
+	/**
+	 * Constructor
+	 */
+	public function __construct() {
+	}
 
-    /**
-     * Returns the log statement in a format consisting of the
-     * <b>level</b>, followed by " - " and then the
-     * <b>message</b>. For example, 
-     * <samp> INFO - "A message" </samp>
-     *
-     * @param LoggerLoggingEvent $event
-     * @return string
-     */
-    public function format(LoggerLoggingEvent $event) {
-        $level = $event->getLevel();
-        $message = $event->getRenderedMessage();
-        return "$level - $message" . PHP_EOL;
-    }
+	/**
+	 * Returns the log statement in a format consisting of the
+	 * <b>level</b>, followed by " - " and then the
+	 * <b>message</b>. For example, 
+	 * <samp> INFO - "A message" </samp>
+	 *
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function format(LoggerLoggingEvent $event) {
+		$level = $event->getLevel();
+		$message = $event->getRenderedMessage();
+		return "$level - $message" . PHP_EOL;
+	}
 }

Modified: logging/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php (original)
+++ logging/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php Sat Jan 15 10:56:23 2011
@@ -64,152 +64,152 @@ class LoggerLayoutTTCC extends LoggerLay
 	 // TODO: not used?
 	const LOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT = 'RELATIVE';
 	
-    // Internal representation of options
-    protected $threadPrinting    = true;
-    protected $categoryPrefixing = true;
-    protected $contextPrinting   = true;
-    protected $microSecondsPrinting = true;
-    
-    /**
-     * @var string date format. See {@link PHP_MANUAL#strftime} for details
-     */
-    protected $dateFormat = '%c';
-
-    /**
-     * Constructor
-     *
-     * @param string date format
-     * @see dateFormat
-     */
-    public function __construct($dateFormat = '') {
-        if (!empty($dateFormat)) {
-            $this->dateFormat = $dateFormat;
-        }
-        return;
-    }
-
-    /**
-     * The <b>ThreadPrinting</b> option specifies whether the name of the
-     * current thread is part of log output or not. This is true by default.
-     */
-    public function setThreadPrinting($threadPrinting) {
-        $this->threadPrinting = is_bool($threadPrinting) ? 
-            $threadPrinting : 
-            (bool)(strtolower($threadPrinting) == 'true'); 
-    }
-
-    /**
-     * @return boolean Returns value of the <b>ThreadPrinting</b> option.
-     */
-    public function getThreadPrinting() {
-        return $this->threadPrinting;
-    }
-
-    /**
-     * The <b>CategoryPrefixing</b> option specifies whether {@link Category}
-     * name is part of log output or not. This is true by default.
-     */
-    public function setCategoryPrefixing($categoryPrefixing) {
-        $this->categoryPrefixing = LoggerOptionConverter::toBoolean($categoryPrefixing);
-    }
-
-    /**
-     * @return boolean Returns value of the <b>CategoryPrefixing</b> option.
-     */
-    public function getCategoryPrefixing() {
-        return $this->categoryPrefixing;
-    }
-
-    /**
-     * The <b>ContextPrinting</b> option specifies log output will include
-     * the nested context information belonging to the current thread.
-     * This is true by default.
-     */
-    public function setContextPrinting($contextPrinting) {
-        $this->contextPrinting = LoggerOptionConverter::toBoolean($contextPrinting); 
-    }
-
-    /**
-     * @return boolean Returns value of the <b>ContextPrinting</b> option.
-     */
-    public function getContextPrinting() {
-        return $this->contextPrinting;
-    }
-    
-    /**
-     * The <b>MicroSecondsPrinting</b> option specifies if microseconds infos
-     * should be printed at the end of timestamp.
-     * This is true by default.
-     */
-    public function setMicroSecondsPrinting($microSecondsPrinting) {
-        $this->microSecondsPrinting = is_bool($microSecondsPrinting) ? 
-            $microSecondsPrinting : 
-            (bool)(strtolower($microSecondsPrinting) == 'true'); 
-    }
-
-    /**
-     * @return boolean Returns value of the <b>MicroSecondsPrinting</b> option.
-     */
-    public function getMicroSecondsPrinting() {
-        return $this->microSecondsPrinting;
-    }
-    
-    
-    public function setDateFormat($dateFormat) {
-        $this->dateFormat = $dateFormat;
-    }
-    
-    /**
-     * @return string
-     */
-    public function getDateFormat() {
-        return $this->dateFormat;
-    }
-
-    /**
-     * In addition to the level of the statement and message, the
-     * returned string includes time, thread, category.
-     * <p>Time, thread, category are printed depending on options.
-     *
-     * @param LoggerLoggingEvent $event
-     * @return string
-     */
-    public function format(LoggerLoggingEvent $event) {
-        $timeStamp = (float)$event->getTimeStamp();
-        $format = strftime($this->dateFormat, (int)$timeStamp);
-        
-        if ($this->microSecondsPrinting) {
-            $usecs = floor(($timeStamp - (int)$timeStamp) * 1000);
-            $format .= sprintf(',%03d', $usecs);
-        }
-            
-        $format .= ' ';
-        
-        if ($this->threadPrinting) {
-            $format .= '['.getmypid().'] ';
-        }
-        
-        $level = $event->getLevel();
-        $format .= $level.' ';
-        
-        if($this->categoryPrefixing) {
-            $format .= $event->getLoggerName().' ';
-        }
-       
-        if($this->contextPrinting) {
-            $ndc = $event->getNDC();
-            if($ndc != null) {
-                $format .= $ndc.' ';
-            }
-        }
-        
-        $format .= '- '.$event->getRenderedMessage();
-        $format .= PHP_EOL;
-        
-        return $format;
-    }
-
-    public function ignoresThrowable() {
-        return true;
-    }
+	// Internal representation of options
+	protected $threadPrinting    = true;
+	protected $categoryPrefixing = true;
+	protected $contextPrinting   = true;
+	protected $microSecondsPrinting = true;
+	
+	/**
+	 * @var string date format. See {@link PHP_MANUAL#strftime} for details
+	 */
+	protected $dateFormat = '%c';
+
+	/**
+	 * Constructor
+	 *
+	 * @param string date format
+	 * @see dateFormat
+	 */
+	public function __construct($dateFormat = '') {
+		if (!empty($dateFormat)) {
+			$this->dateFormat = $dateFormat;
+		}
+		return;
+	}
+
+	/**
+	 * The <b>ThreadPrinting</b> option specifies whether the name of the
+	 * current thread is part of log output or not. This is true by default.
+	 */
+	public function setThreadPrinting($threadPrinting) {
+		$this->threadPrinting = is_bool($threadPrinting) ? 
+			$threadPrinting : 
+			(bool)(strtolower($threadPrinting) == 'true'); 
+	}
+
+	/**
+	 * @return boolean Returns value of the <b>ThreadPrinting</b> option.
+	 */
+	public function getThreadPrinting() {
+		return $this->threadPrinting;
+	}
+
+	/**
+	 * The <b>CategoryPrefixing</b> option specifies whether {@link Category}
+	 * name is part of log output or not. This is true by default.
+	 */
+	public function setCategoryPrefixing($categoryPrefixing) {
+		$this->categoryPrefixing = LoggerOptionConverter::toBoolean($categoryPrefixing);
+	}
+
+	/**
+	 * @return boolean Returns value of the <b>CategoryPrefixing</b> option.
+	 */
+	public function getCategoryPrefixing() {
+		return $this->categoryPrefixing;
+	}
+
+	/**
+	 * The <b>ContextPrinting</b> option specifies log output will include
+	 * the nested context information belonging to the current thread.
+	 * This is true by default.
+	 */
+	public function setContextPrinting($contextPrinting) {
+		$this->contextPrinting = LoggerOptionConverter::toBoolean($contextPrinting); 
+	}
+
+	/**
+	 * @return boolean Returns value of the <b>ContextPrinting</b> option.
+	 */
+	public function getContextPrinting() {
+		return $this->contextPrinting;
+	}
+	
+	/**
+	 * The <b>MicroSecondsPrinting</b> option specifies if microseconds infos
+	 * should be printed at the end of timestamp.
+	 * This is true by default.
+	 */
+	public function setMicroSecondsPrinting($microSecondsPrinting) {
+		$this->microSecondsPrinting = is_bool($microSecondsPrinting) ? 
+			$microSecondsPrinting : 
+			(bool)(strtolower($microSecondsPrinting) == 'true'); 
+	}
+
+	/**
+	 * @return boolean Returns value of the <b>MicroSecondsPrinting</b> option.
+	 */
+	public function getMicroSecondsPrinting() {
+		return $this->microSecondsPrinting;
+	}
+	
+	
+	public function setDateFormat($dateFormat) {
+		$this->dateFormat = $dateFormat;
+	}
+	
+	/**
+	 * @return string
+	 */
+	public function getDateFormat() {
+		return $this->dateFormat;
+	}
+
+	/**
+	 * In addition to the level of the statement and message, the
+	 * returned string includes time, thread, category.
+	 * <p>Time, thread, category are printed depending on options.
+	 *
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function format(LoggerLoggingEvent $event) {
+		$timeStamp = (float)$event->getTimeStamp();
+		$format = strftime($this->dateFormat, (int)$timeStamp);
+		
+		if ($this->microSecondsPrinting) {
+			$usecs = floor(($timeStamp - (int)$timeStamp) * 1000);
+			$format .= sprintf(',%03d', $usecs);
+		}
+			
+		$format .= ' ';
+		
+		if ($this->threadPrinting) {
+			$format .= '['.getmypid().'] ';
+		}
+		
+		$level = $event->getLevel();
+		$format .= $level.' ';
+		
+		if($this->categoryPrefixing) {
+			$format .= $event->getLoggerName().' ';
+		}
+	   
+		if($this->contextPrinting) {
+			$ndc = $event->getNDC();
+			if($ndc != null) {
+				$format .= $ndc.' ';
+			}
+		}
+		
+		$format .= '- '.$event->getRenderedMessage();
+		$format .= PHP_EOL;
+		
+		return $format;
+	}
+
+	public function ignoresThrowable() {
+		return true;
+	}
 }

Modified: logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php (original)
+++ logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php Sat Jan 15 10:56:23 2011
@@ -36,12 +36,12 @@
  * The above would print:
  * 
  * <pre>
- *   <log4php:eventSet xmlns:log4php="http://logging.apache.org/log4php/" version="0.3" includesLocationInfo="true">
- *     <log4php:event logger="root" level="INFO" thread="13802" timestamp="1252456226491">
- *       <log4php:message><![CDATA[Hello World!]]></log4php:message>
- *       <log4php:locationInfo class="main" file="examples/php/layout_xml.php" line="6" method="main" />
- *     </log4php:event>
- *   </log4php:eventSet>
+ * <log4php:eventSet xmlns:log4php="http://logging.apache.org/log4php/" version="0.3" includesLocationInfo="true">
+ * 	<log4php:event logger="root" level="INFO" thread="13802" timestamp="1252456226491">
+ * 		<log4php:message><![CDATA[Hello World!]]></log4php:message>
+ * 		<log4php:locationInfo class="main" file="examples/php/layout_xml.php" line="6" method="main" />
+ * 	</log4php:event>
+ * </log4php:eventSet>
  * </pre>
  *
  * @version $Revision$
@@ -61,124 +61,124 @@ class LoggerLayoutXml extends LoggerLayo
 
 	const CDATA_EMBEDDED_END = ']]>]]&gt;<![CDATA[';
 
-    /**
-     * If set to true then the file name and line number of the origin of the
-     * log statement will be output.
-     * 
-     * @var boolean
-     */
-    private $locationInfo = true;
+	/**
+	 * If set to true then the file name and line number of the origin of the
+	 * log statement will be output.
+	 * 
+	 * @var boolean
+	 */
+	private $locationInfo = true;
   
-    /**
-     * @var boolean set the elements namespace
-     */
-    private $log4jNamespace = false;
-    
-    
-    /**
-     * @var string namespace
-     * @private
-     */
-    private $_namespace = self::LOG4PHP_NS;
-    
-    /**
-     * @var string namespace prefix
-     * @private
-     */
-    private $_namespacePrefix = self::LOG4PHP_NS_PREFIX;
-     
-    /** 
-     * No options to activate. 
-     */
-    public function activateOptions() {
-        if ($this->getLog4jNamespace()) {
-            $this->_namespace        = self::LOG4J_NS;
-            $this->_namespacePrefix  = self::LOG4J_NS_PREFIX;
-        } else {
-            $this->_namespace        = self::LOG4PHP_NS;
-            $this->_namespacePrefix  = self::LOG4PHP_NS_PREFIX;
-        }     
-    }
-    
-    /**
-     * @return string
-     */
-    public function getHeader() {
-        return "<{$this->_namespacePrefix}:eventSet ".
-                    "xmlns:{$this->_namespacePrefix}=\"{$this->_namespace}\" ".
-                    "version=\"0.3\" ".
-                    "includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"".
-               ">\r\n";
-    }
-
-    /**
-     * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd.
-     *
-     * @param LoggerLoggingEvent $event
-     * @return string
-     */
-    public function format(LoggerLoggingEvent $event) {
-    	$loggerName = $event->getLoggerName();
-        $timeStamp  = number_format((float)($event->getTimeStamp() * 1000), 0, '', '');
-        $thread     = $event->getThreadName();
-        $level      = $event->getLevel();
-        $levelStr   = $level->toString();
-
-        $buf = "<{$this->_namespacePrefix}:event logger=\"{$loggerName}\" level=\"{$levelStr}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">".PHP_EOL;
-        $buf .= "<{$this->_namespacePrefix}:message><![CDATA["; 
-        $this->appendEscapingCDATA($buf, $event->getRenderedMessage()); 
-        $buf .= "]]></{$this->_namespacePrefix}:message>".PHP_EOL;        
-
-        $ndc = $event->getNDC();
-        if($ndc != null) {
-            $buf .= "<{$this->_namespacePrefix}:NDC><![CDATA[";
-            $this->appendEscapingCDATA($buf, $ndc);
-            $buf .= "]]></{$this->_namespacePrefix}:NDC>".PHP_EOL;       
-        }
-
-        if ($this->getLocationInfo()) {
-            $locationInfo = $event->getLocationInformation();
-            $buf .= "<{$this->_namespacePrefix}:locationInfo ". 
-                    "class=\"" . $locationInfo->getClassName() . "\" ".
-                    "file=\"" .  htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" ".
-                    "line=\"" .  $locationInfo->getLineNumber() . "\" ".
-                    "method=\"" . $locationInfo->getMethodName() . "\" ";
-            $buf .= "/>".PHP_EOL;
-
-        }
-
-        $buf .= "</{$this->_namespacePrefix}:event>".PHP_EOL.PHP_EOL;
-        
-        return $buf;
-
-    }
-    
-    /**
-     * @return string
-     */
-    public function getFooter() {
-        return "</{$this->_namespacePrefix}:eventSet>\r\n";
-    }
-    
-    
-    /** Whether or not file name and line number will be included in the output.
-     * 
-     * @return boolean
-     */
-    public function getLocationInfo() {
-        return $this->locationInfo;
-    }
+	/**
+	 * @var boolean set the elements namespace
+	 */
+	private $log4jNamespace = false;
+	
+	
+	/**
+	 * @var string namespace
+	 * @private
+	 */
+	private $_namespace = self::LOG4PHP_NS;
+	
+	/**
+	 * @var string namespace prefix
+	 * @private
+	 */
+	private $_namespacePrefix = self::LOG4PHP_NS_PREFIX;
+	 
+	/** 
+	 * No options to activate. 
+	 */
+	public function activateOptions() {
+		if ($this->getLog4jNamespace()) {
+			$this->_namespace        = self::LOG4J_NS;
+			$this->_namespacePrefix  = self::LOG4J_NS_PREFIX;
+		} else {
+			$this->_namespace        = self::LOG4PHP_NS;
+			$this->_namespacePrefix  = self::LOG4PHP_NS_PREFIX;
+		}
+	}
+	
+	/**
+	 * @return string
+	 */
+	public function getHeader() {
+		return "<{$this->_namespacePrefix}:eventSet ".
+					"xmlns:{$this->_namespacePrefix}=\"{$this->_namespace}\" ".
+					"version=\"0.3\" ".
+					"includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"".
+					">\r\n";
+	}
+
+	/**
+	 * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd.
+	 *
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function format(LoggerLoggingEvent $event) {
+		$loggerName = $event->getLoggerName();
+		$timeStamp  = number_format((float)($event->getTimeStamp() * 1000), 0, '', '');
+		$thread     = $event->getThreadName();
+		$level      = $event->getLevel();
+		$levelStr   = $level->toString();
+
+		$buf = "<{$this->_namespacePrefix}:event logger=\"{$loggerName}\" level=\"{$levelStr}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">".PHP_EOL;
+		$buf .= "<{$this->_namespacePrefix}:message><![CDATA["; 
+		$this->appendEscapingCDATA($buf, $event->getRenderedMessage()); 
+		$buf .= "]]></{$this->_namespacePrefix}:message>".PHP_EOL;
+
+		$ndc = $event->getNDC();
+		if($ndc != null) {
+			$buf .= "<{$this->_namespacePrefix}:NDC><![CDATA[";
+			$this->appendEscapingCDATA($buf, $ndc);
+			$buf .= "]]></{$this->_namespacePrefix}:NDC>".PHP_EOL;
+		}
+
+		if ($this->getLocationInfo()) {
+			$locationInfo = $event->getLocationInformation();
+			$buf .= "<{$this->_namespacePrefix}:locationInfo ". 
+					"class=\"" . $locationInfo->getClassName() . "\" ".
+					"file=\"" .  htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" ".
+					"line=\"" .  $locationInfo->getLineNumber() . "\" ".
+					"method=\"" . $locationInfo->getMethodName() . "\" ";
+			$buf .= "/>".PHP_EOL;
+
+		}
+
+		$buf .= "</{$this->_namespacePrefix}:event>".PHP_EOL.PHP_EOL;
+		
+		return $buf;
+
+	}
+	
+	/**
+	 * @return string
+	 */
+	public function getFooter() {
+		return "</{$this->_namespacePrefix}:eventSet>\r\n";
+	}
+	
+	
+	/** Whether or not file name and line number will be included in the output.
+	 * 
+	 * @return boolean
+	 */
+	public function getLocationInfo() {
+		return $this->locationInfo;
+	}
   
-    /**
-     * The {@link $locationInfo} option takes a boolean value. By default,
-     * it is set to false which means there will be no location
-     * information output by this layout. If the the option is set to
-     * true, then the file name and line number of the statement at the
-     * origin of the log statement will be output.
-     */
-    public function setLocationInfo($flag) {
-        $this->locationInfo = LoggerOptionConverter::toBoolean($flag, true);
-    }
+	/**
+	 * The {@link $locationInfo} option takes a boolean value. By default,
+	 * it is set to false which means there will be no location
+	 * information output by this layout. If the the option is set to
+	 * true, then the file name and line number of the statement at the
+	 * origin of the log statement will be output.
+	 */
+	public function setLocationInfo($flag) {
+		$this->locationInfo = LoggerOptionConverter::toBoolean($flag, true);
+	}
   
 	/**
 	 * @return boolean
@@ -187,14 +187,14 @@ class LoggerLayoutXml extends LoggerLayo
 	 	return $this->log4jNamespace;
 	 }
 
-    /**
-     * @param boolean
-     */
-    public function setLog4jNamespace($flag) {
-        $this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, true);
-    }
-    
-    /**
+	/**
+	 * @param boolean
+	 */
+	public function setLog4jNamespace($flag) {
+		$this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, true);
+	}
+	
+	/**
 	 * Ensures that embeded CDEnd strings (]]&gt;) are handled properly
 	 * within message, NDC and throwable tag text.
 	 *

Modified: logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php (original)
+++ logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php Sat Jan 15 10:56:23 2011
@@ -32,7 +32,7 @@ class LoggerRendererException implements
 		$strRep .= PHP_EOL.$o->getTraceAsString();
 		
 		if (method_exists($o, 'getPrevious') && $o->getPrevious() !== null) {
-			$strRep .= PHP_EOL.'Caused by: '.$this->render($o->getPrevious());			
+			$strRep .= PHP_EOL.'Caused by: '.$this->render($o->getPrevious());
 		}
 		
 		return $strRep;