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 ku...@apache.org on 2009/05/04 09:12:24 UTC

svn commit: r771217 - /incubator/log4php/trunk/src/main/php/appenders/

Author: kurdalen
Date: Mon May  4 07:12:23 2009
New Revision: 771217

URL: http://svn.apache.org/viewvc?rev=771217&view=rev
Log:
fixed coding style of all appenders (puh, these should be the last files)

Modified:
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderEcho.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php
    incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -26,7 +26,7 @@
  * <p>Optional parameter is {@link $target}. The default target is Stdout.</p>
  * <p><b>Note</b>: Use this Appender with command-line php scripts. 
  * On web scripts this appender has no effects.</p>
- * <p>This appender requires a layout.</p>  
+ * <p>This appender requires a layout.</p>	
  *
  * @version $Revision$
  * @package log4php
@@ -34,68 +34,68 @@
  */
 class LoggerAppenderConsole extends LoggerAppenderSkeleton {
 
-    const STDOUT = 'php://stdout';
-    const STDERR = 'php://stderr';
+	const STDOUT = 'php://stdout';
+	const STDERR = 'php://stderr';
 
-    /**
-     * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). 
-     * Default is STDOUT
-     * @var string    
-     */
-    protected $target = self::STDOUT;
-    
-    /**
-     * @var boolean
-     * @access private     
-     */
-    protected $requiresLayout = true;
-
-    /**
-     * @var mixed the resource used to open stdout/stderr
-     * @access private     
-     */
-    protected $fp = false;
-
-    /**
-     * Set console target.
-     * @param mixed $value a constant or a string
-     */
-    public function setTarget($value) {
-        $v = trim($value);
-        if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
-            $this->target = self::STDOUT;
-        } elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
-            $this->target = self::STDERR;
-        } 
-    }
-
-    public function getTarget() {
-        return $this->target;
-    }
-
-    public function activateOptions() {
-        $this->fp = fopen($this->getTarget(), 'w');
-        if($this->fp !== false && $this->layout !== null) {
-            fwrite($this->fp, $this->layout->getHeader());
-        }
-        $this->closed = (bool)($this->fp === false);
-    }
-    
-    /**
-     * @see LoggerAppender::close()
-     */
-    public function close() {
-        if ($this->fp && $this->layout !== null) {
-            fwrite($this->fp, $this->layout->getFooter());
-                        fclose($this->fp);
-        }        
-        $this->closed = true;
-    }
-
-    protected function append($event) {
-        if ($this->fp && $this->layout !== null) {
-            fwrite($this->fp, $this->layout->format($event));
-        } 
-    }
+	/**
+	 * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). 
+	 * Default is STDOUT
+	 * @var string	  
+	 */
+	protected $target = self::STDOUT;
+	
+	/**
+	 * @var boolean
+	 * @access private	   
+	 */
+	protected $requiresLayout = true;
+
+	/**
+	 * @var mixed the resource used to open stdout/stderr
+	 * @access private	   
+	 */
+	protected $fp = false;
+
+	/**
+	 * Set console target.
+	 * @param mixed $value a constant or a string
+	 */
+	public function setTarget($value) {
+		$v = trim($value);
+		if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
+			$this->target = self::STDOUT;
+		} elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
+			$this->target = self::STDERR;
+		} 
+	}
+
+	public function getTarget() {
+		return $this->target;
+	}
+
+	public function activateOptions() {
+		$this->fp = fopen($this->getTarget(), 'w');
+		if($this->fp !== false && $this->layout !== null) {
+			fwrite($this->fp, $this->layout->getHeader());
+		}
+		$this->closed = (bool)($this->fp === false);
+	}
+	
+	/**
+	 * @see LoggerAppender::close()
+	 */
+	public function close() {
+		if ($this->fp && $this->layout !== null) {
+			fwrite($this->fp, $this->layout->getFooter());
+						fclose($this->fp);
+		}		 
+		$this->closed = true;
+	}
+
+	protected function append($event) {
+		if ($this->fp && $this->layout !== null) {
+			fwrite($this->fp, $this->layout->format($event));
+		} 
+	}
 }
 

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -32,47 +32,46 @@
  * @version $Revision$
  * @package log4php
  * @subpackage appenders
- */                      
+ */
 class LoggerAppenderDailyFile extends LoggerAppenderFile {
 
-    /**
-     * Format date. 
-     * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>.
-     * @var string
-     */
-    public $datePattern = "Ymd";
-    
-    /**
-    * Sets date format for the file name.
-    * @param string $format a regular date() string format
-    */
-    public function setDatePattern($format) {
-        $this->datePattern = $format;
-    }
-    
-    /**
-    * @return string returns date format for the filename
-    */
-    public function getDatePattern() {
-        return $this->datePattern;
-    }
-    
-    /**
-    * The File property takes a string value which should be the name of the file to append to.
-    * Sets and opens the file where the log output will go.
-    *
-    * @see LoggerAppenderFile::setFile()
-    */
-    public function setFile() {
-        $numargs = func_num_args();
-        $args    = func_get_args();
-        
-        if ($numargs == 1 and is_string($args[0])) {
-            parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())) );
-        } elseif ($numargs == 2 and is_string($args[0]) and is_bool($args[1])) {
-            parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())), $args[1] );
-        }
-    } 
+	/**
+	 * Format date. 
+	 * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>.
+	 * @var string
+	 */
+	public $datePattern = "Ymd";
+	
+	/**
+	* Sets date format for the file name.
+	* @param string $format a regular date() string format
+	*/
+	public function setDatePattern($format) {
+		$this->datePattern = $format;
+	}
+	
+	/**
+	* @return string returns date format for the filename
+	*/
+	public function getDatePattern() {
+		return $this->datePattern;
+	}
+	
+	/**
+	* The File property takes a string value which should be the name of the file to append to.
+	* Sets and opens the file where the log output will go.
+	*
+	* @see LoggerAppenderFile::setFile()
+	*/
+	public function setFile() {
+		$numargs = func_num_args();
+		$args = func_get_args();
+		
+		if($numargs == 1 and is_string($args[0])) {
+			parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())) );
+		} else if ($numargs == 2 and is_string($args[0]) and is_bool($args[1])) {
+			parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())), $args[1] );
+		}
+	} 
 
 }
-

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderEcho.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderEcho.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderEcho.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderEcho.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -23,7 +23,7 @@
 /**
  * LoggerAppenderEcho uses {@link PHP_MANUAL#echo echo} function to output events. 
  * 
- * <p>This appender requires a layout.</p>  
+ * <p>This appender requires a layout.</p>	
  *
  * @version $Revision$
  * @package log4php
@@ -31,38 +31,37 @@
  */
 class LoggerAppenderEcho extends LoggerAppenderSkeleton {
 
-    /**
-     * @access private 
-     */
-    var $requiresLayout = true;
+	/**
+	 * @access private 
+	 */
+	var $requiresLayout = true;
 
-    /**
-     * @var boolean used internally to mark first append 
-     * @access private 
-     */
-    var $firstAppend    = true;
-    
-    function activateOptions()
-    {
-        $this->closed = false;
-        return;
-    }
-    
-    function close()
-    {
-        if (!$this->firstAppend)
-            echo $this->layout->getFooter();
-        $this->closed = true;    
-    }
+	/**
+	 * @var boolean used internally to mark first append 
+	 * @access private 
+	 */
+	var $firstAppend	= true;
+	
+	function activateOptions() {
+		$this->closed = false;
+		return;
+	}
+	
+	function close() {
+		if(!$this->firstAppend) {
+			echo $this->layout->getFooter();
+		}
+		$this->closed = true;	 
+	}
 
-    function append($event) {
-        if ($this->layout !== null) {
-            if ($this->firstAppend) {
-                echo $this->layout->getHeader();
-                $this->firstAppend = false;
-            }
-            echo $this->layout->format($event);
-        } 
-    }
+	function append($event) {
+		if($this->layout !== null) {
+			if($this->firstAppend) {
+				echo $this->layout->getHeader();
+				$this->firstAppend = false;
+			}
+			echo $this->layout->format($event);
+		} 
+	}
 }
 

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -32,26 +32,26 @@
  */
 class LoggerAppenderFile extends LoggerAppenderSkeleton {
 
-    /**
-     * @var boolean if {@link $file} exists, appends events.
-     */
-    private $append = true;
-    /**
-     * @var string the file name used to append events
-     */
+	/**
+	 * @var boolean if {@link $file} exists, appends events.
+	 */
+	private $append = true;
+	/**
+	 * @var string the file name used to append events
+	 */
 	protected $fileName;
-    /**
-     * @var mixed file resource
-     */
+	/**
+	 * @var mixed file resource
+	 */
 	protected $fp = false;
-    
+	
 	public function __construct($name) {
 		parent::__construct($name);
 		$this->requiresLayout = true;
 	}
 
-    public function activateOptions() {
-        $fileName = $this->getFile();
+	public function activateOptions() {
+		$fileName = $this->getFile();
 
 		if(!is_file($fileName)) {
 			$dir = dirname($fileName);
@@ -60,99 +60,101 @@
 			}
 		}
 
-        $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w'));
-        if ($this->fp) {
+		$this->fp = fopen($fileName, ($this->getAppend()? 'a':'w'));
+		if($this->fp) {
 			if(flock($this->fp, LOCK_EX)) {
-				if ($this->getAppend())
-	                fseek($this->fp, 0, SEEK_END);
-	            fwrite($this->fp, $this->layout->getHeader());
-	            $this->closed = false;
+				if($this->getAppend()) {
+					fseek($this->fp, 0, SEEK_END);
+				}
+				fwrite($this->fp, $this->layout->getHeader());
+				$this->closed = false;
 			} else { // race condition, unable to lock file
 				// TODO: should we take some action in this case?
 				$this->closed = true;
-			}        
-        } else {
-            $this->closed = true;
-        }
-    }
-    
-    public function close() {
-        if($this->fp and $this->layout !== null) {
-                        fwrite($this->fp, $this->layout->getFooter());
-                }
-            
-        $this->closeFile();
-        $this->closed = true;
-    }
-
-    /**
-     * Closes the previously opened file.
-     */
-    public function closeFile() {
-        if ($this->fp)
-            fclose($this->fp);
-    }
-    
-    /**
-     * @return boolean
-     */
-    public function getAppend() {
-        return $this->append;
-    }
-
-    /**
-     * @return string
-     */
-    public function getFile() {
-        return $this->getFileName();
-    }
-    
-    /**
-     * @return string
-     */
-    public function getFileName() {
-        return $this->fileName;
-    } 
+			}		 
+		} else {
+			$this->closed = true;
+		}
+	}
+	
+	public function close() {
+		if($this->fp and $this->layout !== null) {
+			fwrite($this->fp, $this->layout->getFooter());
+		}
+			
+		$this->closeFile();
+		$this->closed = true;
+	}
+
+	/**
+	 * Closes the previously opened file.
+	 */
+	public function closeFile() {
+		if($this->fp) {
+			fclose($this->fp);
+		}
+	}
+	
+	/**
+	 * @return boolean
+	 */
+	public function getAppend() {
+		return $this->append;
+	}
+
+	/**
+	 * @return string
+	 */
+	public function getFile() {
+		return $this->getFileName();
+	}
+	
+	/**
+	 * @return string
+	 */
+	public function getFileName() {
+		return $this->fileName;
+	} 
  
-    /**
-     * Close any previously opened file and call the parent's reset.
-     */
-    public function reset() {
-        $this->closeFile();
-        $this->fileName = null;
-        parent::reset();
-    }
-
-    public function setAppend($flag) {
-        $this->append = LoggerOptionConverter::toBoolean($flag, true);        
-    } 
+	/**
+	 * Close any previously opened file and call the parent's reset.
+	 */
+	public function reset() {
+		$this->closeFile();
+		$this->fileName = null;
+		parent::reset();
+	}
+
+	public function setAppend($flag) {
+		$this->append = LoggerOptionConverter::toBoolean($flag, true);		  
+	} 
   
-    /**
-     * Sets and opens the file where the log output will go.
-     *
-     * This is an overloaded method. It can be called with:
-     * - setFile(string $fileName) to set filename.
-     * - setFile(string $fileName, boolean $append) to set filename and append.
-     */
-    public function setFile() {
-        $numargs = func_num_args();
-        $args    = func_get_args();
-
-        if ($numargs == 1 and is_string($args[0])) {
-            $this->setFileName($args[0]);
-        } elseif ($numargs >=2 and is_string($args[0]) and is_bool($args[1])) {
-            $this->setFile($args[0]);
-            $this->setAppend($args[1]);
-        }
-    }
-    
-    public function setFileName($fileName) {
-        $this->fileName = $fileName;
-    }
-
-    public function append($event) {
-        if ($this->fp and $this->layout !== null) {
-            fwrite($this->fp, $this->layout->format($event));
-        } 
-    }
+	/**
+	 * Sets and opens the file where the log output will go.
+	 *
+	 * This is an overloaded method. It can be called with:
+	 * - setFile(string $fileName) to set filename.
+	 * - setFile(string $fileName, boolean $append) to set filename and append.
+	 */
+	public function setFile() {
+		$numargs = func_num_args();
+		$args	 = func_get_args();
+
+		if($numargs == 1 and is_string($args[0])) {
+			$this->setFileName($args[0]);
+		} else if ($numargs >=2 and is_string($args[0]) and is_bool($args[1])) {
+			$this->setFile($args[0]);
+			$this->setAppend($args[1]);
+		}
+	}
+	
+	public function setFileName($fileName) {
+		$this->fileName = $fileName;
+	}
+
+	public function append($event) {
+		if($this->fp and $this->layout !== null) {
+			fwrite($this->fp, $this->layout->format($event));
+		} 
+	}
 }

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -32,98 +32,92 @@
  */
 class LoggerAppenderMail extends LoggerAppenderSkeleton {
 
-    /**
-     * @var string 'from' field
-     */
-    var $from = null;
-
-    /**
-     * @var string 'subject' field
-     */
-    var $subject = 'Log4php Report';
-    
-    /**
-     * @var string 'to' field
-     */
-    var $to = null;
-
-    /**
-     * @var string used to create mail body
-     * @access private
-     */
-    var $body = '';
-    
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    public function __construct($name) {
-        parent::__construct($name);
-                $this->requiresLayout = true;
-    }
-
-    public function activateOptions() {
-        $this->closed = false;
-    }
-    
-    public function close() {
-        $from = $this->from;
-        $to = $this->to;
-
-        if (!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) {
-                        $subject = $this->subject;
-            mail(
-                $to, $subject, 
-                $this->layout->getHeader() . $this->body . $this->layout->getFooter(),
-                "From: {$from}\r\n"
-            );
-        }
-        $this->closed = true;
-    }
-    
-    /**
-     * @return string
-     */
-    function getFrom()
-    {
-        return $this->from;
-    }
-    
-    /**
-     * @return string
-     */
-    function getSubject()
-    {
-        return $this->subject;
-    }
-
-    /**
-     * @return string
-     */
-    function getTo()
-    {
-        return $this->to;
-    }
-    
-    function setSubject($subject)
-    {
-        $this->subject = $subject;
-    }
-    
-    function setTo($to)
-    {
-        $this->to = $to;
-    }
-
-    function setFrom($from)
-    {
-        $this->from = $from;
-    }  
-
-    function append($event)
-    {
-        if ($this->layout !== null)
-            $this->body .= $this->layout->format($event);
-    }
+	/**
+	 * @var string 'from' field
+	 */
+	var $from = null;
+
+	/**
+	 * @var string 'subject' field
+	 */
+	var $subject = 'Log4php Report';
+	
+	/**
+	 * @var string 'to' field
+	 */
+	var $to = null;
+
+	/**
+	 * @var string used to create mail body
+	 * @access private
+	 */
+	var $body = '';
+	
+	/**
+	 * Constructor.
+	 *
+	 * @param string $name appender name
+	 */
+	public function __construct($name) {
+		parent::__construct($name);
+				$this->requiresLayout = true;
+	}
+
+	public function activateOptions() {
+		$this->closed = false;
+	}
+	
+	public function close() {
+		$from = $this->from;
+		$to = $this->to;
+
+		if(!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) {
+						$subject = $this->subject;
+			mail(
+				$to, $subject, 
+				$this->layout->getHeader() . $this->body . $this->layout->getFooter(),
+				"From: {$from}\r\n"
+			);
+		}
+		$this->closed = true;
+	}
+	
+	/**
+	 * @return string
+	 */
+	function getFrom() {
+		return $this->from;
+	}
+	
+	/**
+	 * @return string
+	 */
+	function getSubject() {
+		return $this->subject;
+	}
+
+	/**
+	 * @return string
+	 */
+	function getTo() {
+		return $this->to;
+	}
+	
+	function setSubject($subject) {
+		$this->subject = $subject;
+	}
+	
+	function setTo($to) {
+		$this->to = $to;
+	}
+
+	function setFrom($from) {
+		$this->from = $from;
+	}  
+
+	function append($event) {
+		if($this->layout !== null) {
+			$this->body .= $this->layout->format($event);
+		}
+	}
 }

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -37,116 +37,137 @@
  */
 class LoggerAppenderMailEvent extends LoggerAppenderSkeleton {
 
-    /**
-     * @var string 'from' field
-     */
-    var $from           = null;
-
-    /**
-     * @var integer 'from' field
-     */
-    var $port           = 25;
-
-    /**
-     * @var string hostname. 
-     */
-    var $smtpHost       = null;
-
-    /**
-     * @var string 'subject' field
-     */
-    var $subject        = '';
-
-    /**
-     * @var string 'to' field
-     */
-    var $to             = null;
-    
-    /**
-     * @access private
-     */
-    var $requiresLayout = true;
-
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderMailEvent($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
-
-    function activateOptions()
-    { 
-        $this->closed = false;
-    }
-    
-    function close()
-    {
-        $this->closed = true;
-    }
-
-    /**
-     * @return string
-     */
-    function getFrom()      { return $this->from; }
-    
-    /**
-     * @return integer
-     */
-    function getPort()      { return $this->port; }
-    
-    /**
-     * @return string
-     */
-    function getSmtpHost()  { return $this->smtpHost; }
-    
-    /**
-     * @return string
-     */
-    function getSubject()   { return $this->subject; }
-
-    /**
-     * @return string
-     */
-    function getTo()        { return $this->to; }
-
-    function setFrom($from)             { $this->from = $from; }
-    function setPort($port)             { $this->port = (int)$port; }
-    function setSmtpHost($smtpHost)     { $this->smtpHost = $smtpHost; }
-    function setSubject($subject)       { $this->subject = $subject; }
-    function setTo($to)                 { $this->to = $to; }
-
-    function append($event)
-    {
-        $from = $this->getFrom();
-        $to   = $this->getTo();
-        if (empty($from) or empty($to))
-            return;
-    
-        $smtpHost = $this->getSmtpHost();
-        $prevSmtpHost = ini_get('SMTP');
-        if (!empty($smtpHost)) {
-            ini_set('SMTP', $smtpHost);
-        } else {
-            $smtpHost = $prevSmtpHost;
-        } 
-
-        $smtpPort = $this->getPort();
-        $prevSmtpPort= ini_get('smtp_port');        
-        if ($smtpPort > 0 and $smtpPort < 65535) {
-            ini_set('smtp_port', $smtpPort);
-        } else {
-            $smtpPort = $prevSmtpPort;
-        } 
-        
-        @mail( $to, $this->getSubject(), 
-            $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), 
-            "From: {$from}\r\n");
-            
-        ini_set('SMTP',         $prevSmtpHost);
-        ini_set('smtp_port',    $prevSmtpPort);
-    }
+	/**
+	 * @var string 'from' field
+	 */
+	var $from = null;
+
+	/**
+	 * @var integer 'from' field
+	 */
+	var $port = 25;
+
+	/**
+	 * @var string hostname. 
+	 */
+	var $smtpHost = null;
+
+	/**
+	 * @var string 'subject' field
+	 */
+	var $subject = '';
+
+	/**
+	 * @var string 'to' field
+	 */
+	var $to = null;
+	
+	/**
+	 * @access private
+	 */
+	var $requiresLayout = true;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param string $name appender name
+	 */
+	function LoggerAppenderMailEvent($name) {
+		$this->LoggerAppenderSkeleton($name);
+	}
+
+	function activateOptions() {
+		$this->closed = false;
+	}
+	
+	function close() {
+		$this->closed = true;
+	}
+
+	/**
+	 * @return string
+	 */
+	function getFrom() {
+		return $this->from;
+	}
+	
+	/**
+	 * @return integer
+	 */
+	function getPort() {
+		return $this->port;
+	}
+	
+	/**
+	 * @return string
+	 */
+	function getSmtpHost() {
+		return $this->smtpHost;
+	}
+	
+	/**
+	 * @return string
+	 */
+	function getSubject() {
+		return $this->subject;
+	}
+
+	/**
+	 * @return string
+	 */
+	function getTo() {
+		return $this->to;
+	}
+
+	function setFrom($from) {
+		$this->from = $from;
+	}
+	
+	function setPort($port) {
+		$this->port = (int)$port;
+	}
+	
+	function setSmtpHost($smtpHost) {
+		$this->smtpHost = $smtpHost;
+	}
+	
+	function setSubject($subject) {
+		$this->subject = $subject;
+	}
+	
+	function setTo($to) {
+		$this->to = $to;
+	}
+
+	function append($event) {
+		$from = $this->getFrom();
+		$to = $this->getTo();
+		if(empty($from) or empty($to)) {
+			return;
+		}
+	
+		$smtpHost = $this->getSmtpHost();
+		$prevSmtpHost = ini_get('SMTP');
+		if(!empty($smtpHost)) {
+			ini_set('SMTP', $smtpHost);
+		} else {
+			$smtpHost = $prevSmtpHost;
+		} 
+
+		$smtpPort = $this->getPort();
+		$prevSmtpPort= ini_get('smtp_port');		
+		if($smtpPort > 0 and $smtpPort < 65535) {
+			ini_set('smtp_port', $smtpPort);
+		} else {
+			$smtpPort = $prevSmtpPort;
+		} 
+		
+		@mail($to, $this->getSubject(), 
+			$this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), 
+			"From: {$from}\r\n");
+			
+		ini_set('SMTP', $prevSmtpHost);
+		ini_set('smtp_port', $prevSmtpPort);
+	}
 }
 

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -21,7 +21,7 @@
  */
 
 /**
- * A NullAppender merely exists, it never outputs a message to any device.  
+ * A NullAppender merely exists, it never outputs a message to any device.	
  *
  * @version $Revision$
  * @package log4php
@@ -29,28 +29,23 @@
  */
 class LoggerAppenderNull extends LoggerAppenderSkeleton {
 
-    /**
-     * @access private
-     */
-    protected $requiresLayout = false;
-    
-    public function activateOptions()
-    { 
-        $this->closed = false;
-    }
-    
-    public function close()
-    {
-        $this->closed = true;
-    }
-    
-    /**
-     * Do nothing. 
-     * How I Love it !! :)
-     * 
-     * @param LoggerLoggingEvent $event
-     */
-    protected function append($event) {
-    }
+	protected $requiresLayout = false;
+	
+	public function activateOptions() {
+		$this->closed = false;
+	}
+	
+	public function close() {
+		$this->closed = true;
+	}
+	
+	/**
+	 * Do nothing. 
+	 * How I Love it !! :)
+	 * 
+	 * @param LoggerLoggingEvent $event
+	 */
+	protected function append($event) {
+	}
 }
 

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -38,25 +38,25 @@
 		parent::__construct($name);
 		$this->requiresLayout = true;
 	}
-    
-    public function activateOptions() {
-        $this->closed = false;
-    }
+	
+	public function activateOptions() {
+		$this->closed = false;
+	}
 
-    public function close() {
-        $this->closed = true;
-    }
+	public function close() {
+		$this->closed = true;
+	}
 
-    public function append($event) {
-        if ($this->layout !== null) {
-            $level = $event->getLevel();
-            if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
-                trigger_error($this->layout->format($event), E_USER_ERROR);
-            } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
-                trigger_error($this->layout->format($event), E_USER_WARNING);
-            } else {
-                trigger_error($this->layout->format($event), E_USER_NOTICE);
-            }
-        }
-    }
+	public function append($event) {
+		if($this->layout !== null) {
+			$level = $event->getLevel();
+			if($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
+				trigger_error($this->layout->format($event), E_USER_ERROR);
+			} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
+				trigger_error($this->layout->format($event), E_USER_WARNING);
+			} else {
+				trigger_error($this->layout->format($event), E_USER_NOTICE);
+			}
+		}
+	}
 }

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -34,197 +34,193 @@
  */
 class LoggerAppenderRollingFile extends LoggerAppenderFile {
 
-    /**
-     * Set the maximum size that the output file is allowed to reach
-     * before being rolled over to backup files.
-     *
-     * <p>In configuration files, the <var>MaxFileSize</var> option takes a
-     * long integer in the range 0 - 2^63. You can specify the value
-     * with the suffixes "KB", "MB" or "GB" so that the integer is
-     * interpreted being expressed respectively in kilobytes, megabytes
-     * or gigabytes. For example, the value "10KB" will be interpreted
-     * as 10240.</p>
-     * <p>The default maximum file size is 10MB.</p>
-     *
-     * <p>Note that MaxFileSize cannot exceed <b>2 GB</b>.</p>
-     *
-     * @var integer
-     */
-    var $maxFileSize = 10485760;
-    
-    /**
-     * Set the maximum number of backup files to keep around.
-     * 
-     * <p>The <var>MaxBackupIndex</var> option determines how many backup
-     * files are kept before the oldest is erased. This option takes
-     * a positive integer value. If set to zero, then there will be no
-     * backup files and the log file will be truncated when it reaches
-     * MaxFileSize.</p>
-     * <p>There is one backup file by default.</p>
-     *
-     * @var integer 
-     */
-    var $maxBackupIndex  = 1;
-    
-    /**
-     * @var string the filename expanded
-     * @access private
-     */
-    var $expandedFileName = null;
-
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    public function __construct($name) {
-        parent::__construct($name);
-    }
-    
-    /**
-     * Returns the value of the MaxBackupIndex option.
-     * @return integer 
-     */
-    function getExpandedFileName() {
-        return $this->expandedFileName;
-    }
-
-    /**
-     * Returns the value of the MaxBackupIndex option.
-     * @return integer 
-     */
-    function getMaxBackupIndex() {
-        return $this->maxBackupIndex;
-    }
-
-    /**
-     * Get the maximum size that the output file is allowed to reach
-     * before being rolled over to backup files.
-     * @return integer
-     */
-    function getMaximumFileSize() {
-        return $this->maxFileSize;
-    }
-
-    /**
-     * Implements the usual roll over behaviour.
-     *
-     * <p>If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex. 
-     * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.
-     * 
-     * <p>If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
-     */
-    function rollOver()
-    {
-        // If maxBackups <= 0, then there is no file renaming to be done.
-        if($this->maxBackupIndex > 0) {
-            $fileName = $this->getExpandedFileName();
-            // Delete the oldest file, to keep Windows happy.
-            $file = $fileName . '.' . $this->maxBackupIndex;
-            if (is_writable($file))
-                unlink($file);
-            // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
-            for ($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
-                $file = $fileName . "." . $i;
-                if (is_readable($file)) {
-                    $target = $fileName . '.' . ($i + 1);
-                    rename($file, $target);
-                }
-            }
-    
-            // Rename fileName to fileName.1
-            $target = $fileName . ".1";
-    
-            $this->closeFile(); // keep windows happy.
-    
-            $file = $fileName;
-            rename($file, $target);
-        }
-        
-        unset($this->fp);
-        $this->activateOptions();
-        $this->setFile($fileName, false);
-    }
-    
-    function setFileName($fileName)
-    {
-        $this->fileName = $fileName;
-        $this->expandedFileName = realpath($fileName);
-    }
-
-
-    /**
-     * Set the maximum number of backup files to keep around.
-     * 
-     * <p>The <b>MaxBackupIndex</b> option determines how many backup
-     * files are kept before the oldest is erased. This option takes
-     * a positive integer value. If set to zero, then there will be no
-     * backup files and the log file will be truncated when it reaches
-     * MaxFileSize.
-     *
-     * @param mixed $maxBackups
-     */
-    function setMaxBackupIndex($maxBackups)
-    {
-        if (is_numeric($maxBackups))
-            $this->maxBackupIndex = abs((int)$maxBackups);
-    }
-
-    /**
-     * Set the maximum size that the output file is allowed to reach
-     * before being rolled over to backup files.
-     *
-     * @param mixed $maxFileSize
-     * @see setMaxFileSize()
-     */
-    function setMaximumFileSize($maxFileSize)
-    {
-        $this->setMaxFileSize($maxFileSize);
-    }
-
-    /**
-     * Set the maximum size that the output file is allowed to reach
-     * before being rolled over to backup files.
-     * <p>In configuration files, the <b>MaxFileSize</b> option takes an
-     * long integer in the range 0 - 2^63. You can specify the value
-     * with the suffixes "KB", "MB" or "GB" so that the integer is
-     * interpreted being expressed respectively in kilobytes, megabytes
-     * or gigabytes. For example, the value "10KB" will be interpreted
-     * as 10240.
-     *
-     * @param mixed $value
-     */
-    function setMaxFileSize($value)
-    {
-        $maxFileSize = null;
-        $numpart = substr($value,0, strlen($value) -2);
-        $suffix  = strtoupper(substr($value, -2));
-
-        switch ($suffix) {
-            case 'KB': $maxFileSize = (int)((int)$numpart * 1024); break;
-            case 'MB': $maxFileSize = (int)((int)$numpart * 1024 * 1024); break;
-            case 'GB': $maxFileSize = (int)((int)$numpart * 1024 * 1024 * 1024); break;
-            default:
-                if (is_numeric($value)) {
-                    $maxFileSize = (int)$value;
-                }
-        }
-        
-        if ($maxFileSize === null) {
-        } else {
-            $this->maxFileSize = abs($maxFileSize);
-        }
-    }
-
-    /**
-     * @param LoggerLoggingEvent $event
-     */
-    function append($event)
-    {
-        if ($this->fp) {
-            parent::append($event);
-            if (ftell($this->fp) > $this->getMaximumFileSize())    
-                $this->rollOver();
-        }
-    }
+	/**
+	 * Set the maximum size that the output file is allowed to reach
+	 * before being rolled over to backup files.
+	 *
+	 * <p>In configuration files, the <var>MaxFileSize</var> option takes a
+	 * long integer in the range 0 - 2^63. You can specify the value
+	 * with the suffixes "KB", "MB" or "GB" so that the integer is
+	 * interpreted being expressed respectively in kilobytes, megabytes
+	 * or gigabytes. For example, the value "10KB" will be interpreted
+	 * as 10240.</p>
+	 * <p>The default maximum file size is 10MB.</p>
+	 *
+	 * <p>Note that MaxFileSize cannot exceed <b>2 GB</b>.</p>
+	 *
+	 * @var integer
+	 */
+	var $maxFileSize = 10485760;
+	
+	/**
+	 * Set the maximum number of backup files to keep around.
+	 * 
+	 * <p>The <var>MaxBackupIndex</var> option determines how many backup
+	 * files are kept before the oldest is erased. This option takes
+	 * a positive integer value. If set to zero, then there will be no
+	 * backup files and the log file will be truncated when it reaches
+	 * MaxFileSize.</p>
+	 * <p>There is one backup file by default.</p>
+	 *
+	 * @var integer 
+	 */
+	var $maxBackupIndex	 = 1;
+	
+	/**
+	 * @var string the filename expanded
+	 * @access private
+	 */
+	var $expandedFileName = null;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param string $name appender name
+	 */
+	public function __construct($name) {
+		parent::__construct($name);
+	}
+	
+	/**
+	 * Returns the value of the MaxBackupIndex option.
+	 * @return integer 
+	 */
+	function getExpandedFileName() {
+		return $this->expandedFileName;
+	}
+
+	/**
+	 * Returns the value of the MaxBackupIndex option.
+	 * @return integer 
+	 */
+	function getMaxBackupIndex() {
+		return $this->maxBackupIndex;
+	}
+
+	/**
+	 * Get the maximum size that the output file is allowed to reach
+	 * before being rolled over to backup files.
+	 * @return integer
+	 */
+	function getMaximumFileSize() {
+		return $this->maxFileSize;
+	}
+
+	/**
+	 * Implements the usual roll over behaviour.
+	 *
+	 * <p>If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex. 
+	 * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.
+	 * 
+	 * <p>If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
+	 */
+	function rollOver() {
+		// If maxBackups <= 0, then there is no file renaming to be done.
+		if($this->maxBackupIndex > 0) {
+			$fileName = $this->getExpandedFileName();
+			// Delete the oldest file, to keep Windows happy.
+			$file = $fileName . '.' . $this->maxBackupIndex;
+			if(is_writable($file))
+				unlink($file);
+			// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
+			for($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
+				$file = $fileName . "." . $i;
+				if(is_readable($file)) {
+					$target = $fileName . '.' . ($i + 1);
+					rename($file, $target);
+				}
+			}
+	
+			// Rename fileName to fileName.1
+			$target = $fileName . ".1";
+	
+			$this->closeFile(); // keep windows happy.
+	
+			$file = $fileName;
+			rename($file, $target);
+		}
+		
+		unset($this->fp);
+		$this->activateOptions();
+		$this->setFile($fileName, false);
+	}
+	
+	function setFileName($fileName) {
+		$this->fileName = $fileName;
+		$this->expandedFileName = realpath($fileName);
+	}
+
+
+	/**
+	 * Set the maximum number of backup files to keep around.
+	 * 
+	 * <p>The <b>MaxBackupIndex</b> option determines how many backup
+	 * files are kept before the oldest is erased. This option takes
+	 * a positive integer value. If set to zero, then there will be no
+	 * backup files and the log file will be truncated when it reaches
+	 * MaxFileSize.
+	 *
+	 * @param mixed $maxBackups
+	 */
+	function setMaxBackupIndex($maxBackups) {
+		if(is_numeric($maxBackups)) {
+			$this->maxBackupIndex = abs((int)$maxBackups);
+		}
+	}
+
+	/**
+	 * Set the maximum size that the output file is allowed to reach
+	 * before being rolled over to backup files.
+	 *
+	 * @param mixed $maxFileSize
+	 * @see setMaxFileSize()
+	 */
+	function setMaximumFileSize($maxFileSize) {
+		$this->setMaxFileSize($maxFileSize);
+	}
+
+	/**
+	 * Set the maximum size that the output file is allowed to reach
+	 * before being rolled over to backup files.
+	 * <p>In configuration files, the <b>MaxFileSize</b> option takes an
+	 * long integer in the range 0 - 2^63. You can specify the value
+	 * with the suffixes "KB", "MB" or "GB" so that the integer is
+	 * interpreted being expressed respectively in kilobytes, megabytes
+	 * or gigabytes. For example, the value "10KB" will be interpreted
+	 * as 10240.
+	 *
+	 * @param mixed $value
+	 */
+	function setMaxFileSize($value) {
+		$maxFileSize = null;
+		$numpart = substr($value,0, strlen($value) -2);
+		$suffix = strtoupper(substr($value, -2));
+
+		switch($suffix) {
+			case 'KB': $maxFileSize = (int)((int)$numpart * 1024); break;
+			case 'MB': $maxFileSize = (int)((int)$numpart * 1024 * 1024); break;
+			case 'GB': $maxFileSize = (int)((int)$numpart * 1024 * 1024 * 1024); break;
+			default:
+				if(is_numeric($value)) {
+					$maxFileSize = (int)$value;
+				}
+		}
+		
+		if($maxFileSize === null) {
+		} else {
+			$this->maxFileSize = abs($maxFileSize);
+		}
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 */
+	function append($event) {
+		if($this->fp) {
+			parent::append($event);
+			if(ftell($this->fp) > $this->getMaximumFileSize()) {
+				$this->rollOver();
+			}
+		}
+	}
 }

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -32,193 +32,194 @@
  */ 
 class LoggerAppenderSocket extends LoggerAppenderSkeleton {
 
-    /**
-     * @var mixed socket connection resource
-     * @access private
-     */
-    var $sp = false;
-    
-    /**
-     * Target host. On how to define remote hostaname see 
-     * {@link PHP_MANUAL#fsockopen}
-     * @var string 
-     */
-    var $remoteHost     = '';
-    
-    /**
-     * @var integer the network port.
-     */
-    var $port = 4446;
-    
-    /**
-     * @var boolean get event's location info.
-     */
-    var $locationInfo   = false;
-    
-    /**
-     * @var integer connection timeout
-     */
-    var $timeout = 30;
-    
-    /**
-     * @var boolean output events via {@link LoggerXmlLayout}
-     */
-    var $useXml         = false;
-    
-    /**
-     * @var boolean forward this option to {@link LoggerXmlLayout}. 
-     *              Ignored if {@link $useXml} is <i>false</i>.
-     */
-    var $log4jNamespace = false;
-
-    /**
-     * @var LoggerXmlLayout
-     * @access private
-     */
-    var $xmlLayout      = null;
-    
-    /**
-     * Create a socket connection using defined parameters
-     */
-    public function activateOptions() {
-        $errno = 0;
-        $errstr = '';
-        $this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout());
-        if ($errno) {
-            $this->closed = true;
-        } else {
-            if ($this->getUseXml()) {
-                $this->xmlLayout = LoggerLayout::factory('LoggerXmlLayout');
-                if ($this->xmlLayout === null) {
-                    $this->setUseXml(false);
-                } else {
-                    $this->xmlLayout->setLocationInfo($this->getLocationInfo());
-                    $this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace());
-                    $this->xmlLayout->activateOptions();
-                }            
-            }
-            $this->closed = false;
-        }
-    }
-    
-    public function close() {
-        fclose($this->sp);
-        $this->closed = true;
-    }
-
-    /**
-     * @return string
-     */
-    public function getHostname() {
-        return $this->getRemoteHost();
-    }
-    
-    /**
-     * @return boolean
-     */
-    public function getLocationInfo() {
-        return $this->locationInfo;
-    } 
-     
-    /**
-     * @return boolean
-     */
-    public function getLog4jNamespace() {
-        return $this->log4jNamespace;
-    }
-
-    /**
-     * @return integer
-     */
-    public function getPort() {
-        return $this->port;
-    }
-    
-    public function getRemoteHost() {
-        return $this->remoteHost;
-    }
-    
-    /**
-     * @return integer
-     */
-    public function getTimeout() {
-        return $this->timeout;
-    }
-    
-    /**
-     * @var boolean
-     */
-    public function getUseXml() {
-        return $this->useXml;
-    } 
-     
-    public function reset() {
-        $this->close();
-        parent::reset();
-    }
-
-    /**
-     * @param mixed
-     */
-    public function setLocationInfo($flag) {
-        $this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo());
-    } 
-
-    /**
-     * @param mixed
-     */
-    public function setLog4jNamespace($flag) {
-        $this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, $this->getLog4jNamespace());
-    } 
-            
-    /**
-     * @param integer
-     */
-    public function setPort($port) {
-        $port = LoggerOptionConverter::toInt($port, 0);
-        if ($port > 0 and $port < 65535)
-            $this->port = $port;    
-    }
-    
-    /**
-     * @param string
-     */
-    public function setRemoteHost($hostname) {
-        $this->remoteHost = $hostname;
-    }
-    
-    /**
-     * @param integer
-     */
-    public function setTimeout($timeout) {
-        $this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout());
-    }
-    
-    /**
-     * @param mixed
-     */
-    public function setUseXml($flag) {
-        $this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml());
-    } 
+	/**
+	 * @var mixed socket connection resource
+	 * @access private
+	 */
+	var $sp = false;
+	
+	/**
+	 * Target host. On how to define remote hostaname see 
+	 * {@link PHP_MANUAL#fsockopen}
+	 * @var string 
+	 */
+	var $remoteHost = '';
+	
+	/**
+	 * @var integer the network port.
+	 */
+	var $port = 4446;
+	
+	/**
+	 * @var boolean get event's location info.
+	 */
+	var $locationInfo = false;
+	
+	/**
+	 * @var integer connection timeout
+	 */
+	var $timeout = 30;
+	
+	/**
+	 * @var boolean output events via {@link LoggerXmlLayout}
+	 */
+	var $useXml = false;
+	
+	/**
+	 * @var boolean forward this option to {@link LoggerXmlLayout}. 
+	 *				Ignored if {@link $useXml} is <i>false</i>.
+	 */
+	var $log4jNamespace = false;
+
+	/**
+	 * @var LoggerXmlLayout
+	 * @access private
+	 */
+	var $xmlLayout = null;
+	
+	/**
+	 * Create a socket connection using defined parameters
+	 */
+	public function activateOptions() {
+		$errno = 0;
+		$errstr = '';
+		$this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout());
+		if($errno) {
+			$this->closed = true;
+		} else {
+			if($this->getUseXml()) {
+				$this->xmlLayout = LoggerLayout::factory('LoggerXmlLayout');
+				if($this->xmlLayout === null) {
+					$this->setUseXml(false);
+				} else {
+					$this->xmlLayout->setLocationInfo($this->getLocationInfo());
+					$this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace());
+					$this->xmlLayout->activateOptions();
+				}			 
+			}
+			$this->closed = false;
+		}
+	}
+	
+	public function close() {
+		fclose($this->sp);
+		$this->closed = true;
+	}
+
+	/**
+	 * @return string
+	 */
+	public function getHostname() {
+		return $this->getRemoteHost();
+	}
+	
+	/**
+	 * @return boolean
+	 */
+	public function getLocationInfo() {
+		return $this->locationInfo;
+	} 
+	 
+	/**
+	 * @return boolean
+	 */
+	public function getLog4jNamespace() {
+		return $this->log4jNamespace;
+	}
+
+	/**
+	 * @return integer
+	 */
+	public function getPort() {
+		return $this->port;
+	}
+	
+	public function getRemoteHost() {
+		return $this->remoteHost;
+	}
+	
+	/**
+	 * @return integer
+	 */
+	public function getTimeout() {
+		return $this->timeout;
+	}
+	
+	/**
+	 * @var boolean
+	 */
+	public function getUseXml() {
+		return $this->useXml;
+	} 
+	 
+	public function reset() {
+		$this->close();
+		parent::reset();
+	}
+
+	/**
+	 * @param mixed
+	 */
+	public function setLocationInfo($flag) {
+		$this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo());
+	} 
+
+	/**
+	 * @param mixed
+	 */
+	public function setLog4jNamespace($flag) {
+		$this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, $this->getLog4jNamespace());
+	} 
+			
+	/**
+	 * @param integer
+	 */
+	public function setPort($port) {
+		$port = LoggerOptionConverter::toInt($port, 0);
+		if($port > 0 and $port < 65535) {
+			$this->port = $port;	
+		}
+	}
+	
+	/**
+	 * @param string
+	 */
+	public function setRemoteHost($hostname) {
+		$this->remoteHost = $hostname;
+	}
+	
+	/**
+	 * @param integer
+	 */
+	public function setTimeout($timeout) {
+		$this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout());
+	}
+	
+	/**
+	 * @param mixed
+	 */
+	public function setUseXml($flag) {
+		$this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml());
+	} 
  
-    /**
-     * @param LoggerLoggingEvent
-     */
-    public function append($event) {
-        if ($this->sp) {
-            if ($this->getLocationInfo())
-                $event->getLocationInformation();
-        
-            if (!$this->getUseXml()) {
-                $sEvent = serialize($event);
-                fwrite($this->sp, $sEvent, strlen($sEvent));
-            } else {
-                fwrite($this->sp, $this->xmlLayout->format($event));
-            }            
-
-            // not sure about it...
-            fflush($this->sp);
-        } 
-    }
+	/**
+	 * @param LoggerLoggingEvent
+	 */
+	public function append($event) {
+		if($this->sp) {
+			if($this->getLocationInfo()) {
+				$event->getLocationInformation();
+			}
+		
+			if(!$this->getUseXml()) {
+				$sEvent = serialize($event);
+				fwrite($this->sp, $sEvent, strlen($sEvent));
+			} else {
+				fwrite($this->sp, $this->xmlLayout->format($event));
+			}			 
+
+			// not sure about it...
+			fflush($this->sp);
+		} 
+	}
 }
-

Modified: incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php?rev=771217&r1=771216&r2=771217&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php (original)
+++ incubator/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php Mon May  4 07:12:23 2009
@@ -1,13 +1,13 @@
 <?php
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *	   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,
@@ -35,145 +35,144 @@
  * @subpackage appenders
  */ 
 class LoggerAppenderSyslog extends LoggerAppenderSkeleton {
-    
-    /**
-         * The ident string is added to each message. Typically the name of your application.
-         *
-         * @var string Ident for your application
-         */
-        private $_ident = "Log4PHP Syslog-Event";
-
-    /**
-     * The priority parameter value indicates the level of importance of the message.
-     * It is passed on to the Syslog daemon.
-     * 
-     * @var int     Syslog priority
-     */
-    private $_priority;
-    
-    /**
-     * The option used when generating a log message.
-     * It is passed on to the Syslog daemon.
-     * 
-     * @var int     Syslog priority
-     */
-    private $_option;
-    
-    /**
-     * The facility value indicates the source of the message.
-     * It is passed on to the Syslog daemon.
-     *
-     * @var const int     Syslog facility
-     */
-    private $_facility;
-    
-    /**
-     * If it is necessary to define logging priority in the .properties-file,
-     * set this variable to "true".
-     *
-     * @var const int  value indicating whether the priority of the message is defined in the .properties-file
-     *                 (or properties-array)
-     */
-    private $_overridePriority;
+	
+	/**
+	 * The ident string is added to each message. Typically the name of your application.
+	 *
+	 * @var string Ident for your application
+	 */
+	private $_ident = "Log4PHP Syslog-Event";
+
+	/**
+	 * The priority parameter value indicates the level of importance of the message.
+	 * It is passed on to the Syslog daemon.
+	 * 
+	 * @var int Syslog priority
+	 */
+	private $_priority;
+	
+	/**
+	 * The option used when generating a log message.
+	 * It is passed on to the Syslog daemon.
+	 * 
+	 * @var int Syslog priority
+	 */
+	private $_option;
+	
+	/**
+	 * The facility value indicates the source of the message.
+	 * It is passed on to the Syslog daemon.
+	 *
+	 * @var const int Syslog facility
+	 */
+	private $_facility;
+	
+	/**
+	 * If it is necessary to define logging priority in the .properties-file,
+	 * set this variable to "true".
+	 *
+	 * @var const int  value indicating whether the priority of the message is defined in the .properties-file
+	 *				   (or properties-array)
+	 */
+	private $_overridePriority;
 
 	public function __construct($name) {
 		parent::__construct($name);
 		$this->requiresLayout = true;
 	}
 
-        /**
-     * Set the ident of the syslog message.
-     *
-     * @param string Ident
-     */
-        public function setIdent($ident) {      
-                $this->_ident = $ident;       
-    }
-
-    /**
-     * Set the priority value for the syslog message.
-     *
-     * @param const int Priority
-     */
-        public function setPriority($priority) {      
-                $this->_priority = $priority;       
-    }
-    
-    
-    /**
-     * Set the facility value for the syslog message.
-     *
-     * @param const int Facility
-     */
-    public function setFacility($facility) {
-                $this->_facility = $facility;
-    } 
-    
-    /**
-     * If the priority of the message to be sent can be defined by a value in the properties-file, 
-     * set parameter value to "true".
-     *
-     * @param bool Override priority
-     */
-    public function setOverridePriority($overridePriority) {
-                $this->_overridePriority = $overridePriority;                           
-    } 
-    
-    /**
-     * Set the option value for the syslog message.
-     * This value is used as a parameter for php openlog()  
-     * and passed on to the syslog daemon.
-     *
-     * @param string    $option
-     */
-    public function setOption($option) {      
-                $this->_option = $option;       
-    }
-    
-    
-    public function activateOptions() {
-        define_syslog_variables();
-        $this->closed = false;
-    }
-
-    public function close() {
-        closelog();
-        $this->closed = true;
-    }
-
-    public function append($event) {
-
-        if($this->_option == NULL){
-            $this->_option = LOG_PID | LOG_CONS;
-        }
-        
-        // Attach the process ID to the message, use the facility defined in the .properties-file
-        openlog($this->_ident, $this->_option, $this->_facility);
-        
-        $level   = $event->getLevel();
+	/**
+	 * Set the ident of the syslog message.
+	 *
+	 * @param string Ident
+	 */
+	public function setIdent($ident) {
+		$this->_ident = $ident; 
+	}
+
+	/**
+	 * Set the priority value for the syslog message.
+	 *
+	 * @param const int Priority
+	 */
+	public function setPriority($priority) {
+		$this->_priority = $priority;
+	}
+	
+	
+	/**
+	 * Set the facility value for the syslog message.
+	 *
+	 * @param const int Facility
+	 */
+	public function setFacility($facility) {
+		$this->_facility = $facility;
+	} 
+	
+	/**
+	 * If the priority of the message to be sent can be defined by a value in the properties-file, 
+	 * set parameter value to "true".
+	 *
+	 * @param bool Override priority
+	 */
+	public function setOverridePriority($overridePriority) {
+		$this->_overridePriority = $overridePriority;							
+	} 
+	
+	/**
+	 * Set the option value for the syslog message.
+	 * This value is used as a parameter for php openlog()	
+	 * and passed on to the syslog daemon.
+	 *
+	 * @param string	$option
+	 */
+	public function setOption($option) {	  
+		$this->_option = $option;		
+	}
+	
+	public function activateOptions() {
+		define_syslog_variables();
+		$this->closed = false;
+	}
+
+	public function close() {
+		closelog();
+		$this->closed = true;
+	}
+
+	public function append($event) {
+
+		if($this->_option == NULL){
+			$this->_option = LOG_PID | LOG_CONS;
+		}
+		
+		// Attach the process ID to the message, use the facility defined in the .properties-file
+		openlog($this->_ident, $this->_option, $this->_facility);
+		
+		$level	 = $event->getLevel();
 		if($this->layout === null) {
 			$message = $event->getRenderedMessage();
 		} else {
 			$message = $this->layout->format($event); 
 		}
 
-        // If the priority of a syslog message can be overridden by a value defined in the properties-file,
-        // use that value, else use the one that is defined in the code.
-        if($this->_overridePriority){
-                        syslog($this->_priority, $message);            
-        } else {
-        if ($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) {
-            syslog(LOG_ALERT, $message);
-        } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
-            syslog(LOG_ERR, $message);        
-        } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
-            syslog(LOG_WARNING, $message);
-        } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) {
-            syslog(LOG_INFO, $message);
-        } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) {
-            syslog(LOG_DEBUG, $message);
-        }
-    }
-        closelog();
-    }
+		// If the priority of a syslog message can be overridden by a value defined in the properties-file,
+		// use that value, else use the one that is defined in the code.
+		if($this->_overridePriority){
+						syslog($this->_priority, $message);			   
+		} else {
+			if($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) {
+				syslog(LOG_ALERT, $message);
+			} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
+				syslog(LOG_ERR, $message);		  
+			} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
+				syslog(LOG_WARNING, $message);
+			} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) {
+				syslog(LOG_INFO, $message);
+			} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) {
+				syslog(LOG_DEBUG, $message);
+			}
+		}
+		closelog();
+	}
 }