logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject [5/5] git commit: LOG4PHP-153: Made LoggerAppenderMailEvent deprecated
Date Mon, 07 Jan 2013 14:34:18 GMT
Updated Branches:
  refs/heads/LOG4PHP-153 a513de009 -> e40ac7fad
  refs/heads/develop 63e20f67a -> e40ac7fad


LOG4PHP-153: Made LoggerAppenderMailEvent deprecated

A warning will be issued if used. Added a warning to docs.

Signed-off-by: Ivan Habunek <ihabunek@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/logging-log4php/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4php/commit/e40ac7fa
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4php/tree/e40ac7fa
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4php/diff/e40ac7fa

Branch: refs/heads/develop
Commit: e40ac7fad28c1c6751ed42e05c5ed393f073652a
Parents: 549e88c
Author: Ivan Habunek <ihabunek@apache.org>
Authored: Mon Jan 7 15:31:15 2013 +0100
Committer: Ivan Habunek <ihabunek@apache.org>
Committed: Mon Jan 7 15:31:15 2013 +0100

----------------------------------------------------------------------
 src/main/php/appenders/LoggerAppenderMailEvent.php |    7 +++-
 src/site/xdoc/docs/appenders/mail-event.xml        |    7 ++++
 .../php/appenders/LoggerAppenderMailEventTest.php  |   29 ++++++++++-----
 3 files changed, 33 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/e40ac7fa/src/main/php/appenders/LoggerAppenderMailEvent.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderMailEvent.php b/src/main/php/appenders/LoggerAppenderMailEvent.php
index 5053c67..75fb4ca 100644
--- a/src/main/php/appenders/LoggerAppenderMailEvent.php
+++ b/src/main/php/appenders/LoggerAppenderMailEvent.php
@@ -38,6 +38,8 @@
  * @subpackage appenders
  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  * @link http://logging.apache.org/log4php/docs/appenders/mail-event.html Appender documentation
+ * @deprecated LoggerAppenderMailEvent is deprecated and will be removed in a
+ *   future release. Please use LoggerAppenderMail instead.
  */
 class LoggerAppenderMailEvent extends LoggerAppender {
 
@@ -91,7 +93,10 @@ class LoggerAppenderMailEvent extends LoggerAppender {
 			$this->close = true;
 			return;
 		}
-		
+
+		$this->warn("LoggerAppenderMailEvent is deprecated and will be removed in a future release."
. 
+			"Please use LoggerAppenderMail instead.");
+
 		$this->closed = false;
 	}
 

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/e40ac7fa/src/site/xdoc/docs/appenders/mail-event.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/docs/appenders/mail-event.xml b/src/site/xdoc/docs/appenders/mail-event.xml
index b2adeb8..768210f 100644
--- a/src/site/xdoc/docs/appenders/mail-event.xml
+++ b/src/site/xdoc/docs/appenders/mail-event.xml
@@ -30,6 +30,13 @@
 			<p>This appender is similar to <code><a href="mail.html">LoggerAppenderMail</a></code>,
except that it 
   			sends each each log event in an individual email message at the time when it occurs.</p>
 			
+		    <div class="alert alert-error">
+		        <span class="alert-heading">Deprecated!</span>
+		        <p>LoggerAppenderMailEvent is deprecated and will be removed in a future
release. Please use 
+		        <a href="mail.html">LoggerAppenderMail</a> with <code>bufferSize</code>
parameter set to 
+				<code>1</code> instead.</p>
+            </div>
+			
 			<subsection name="Layout">
 				<p>This appender requires a layout. If no layout is specified in configuration,

 				<code><a href="../layouts/simple.html">LoggerLayoutSimple</a></code>
will be used by default.</p>

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/e40ac7fa/src/test/php/appenders/LoggerAppenderMailEventTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderMailEventTest.php b/src/test/php/appenders/LoggerAppenderMailEventTest.php
index 0cfb4df..10ecd80 100644
--- a/src/test/php/appenders/LoggerAppenderMailEventTest.php
+++ b/src/test/php/appenders/LoggerAppenderMailEventTest.php
@@ -31,7 +31,18 @@ class LoggerAppenderMailEventTest extends PHPUnit_Framework_TestCase {
 		$appender = new LoggerAppenderMailEvent();
 		self::assertTrue($appender->requiresLayout());
 	}
-	
+
+	/**
+	 * @expectedException PHPUnit_Framework_Error
+	 * @expectedExceptionMessage LoggerAppenderMailEvent is deprecated and will be removed in
a future release.Please use LoggerAppenderMail instead.
+	 */
+	public function checkDeprecationWarning() {
+		$appender = new LoggerAppenderMailEvent("myname");
+		$appender->setTo('test@example.com');
+		$appender->setFrom('Testsender');
+		$appender->activateOptions();
+	}
+
 	public function testMail() {
 		$appender = new LoggerAppenderMailEvent("myname");
 		
@@ -41,7 +52,7 @@ class LoggerAppenderMailEventTest extends PHPUnit_Framework_TestCase {
 		$appender->setTo('test@example.com');
 		$appender->setFrom('Testsender');
 		
-		$appender->activateOptions();
+		@$appender->activateOptions(); // Mute deprecation warning.
 		$event = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(),
"testmessage");
 		 
 		ob_start();
@@ -66,15 +77,15 @@ class LoggerAppenderMailEventTest extends PHPUnit_Framework_TestCase {
 		$appender->activateOptions();
 	}
 	
-	/**
+	/**
 	 * Check an error is reported if 'from' is not set.
 	 * @expectedException PHPUnit_Framework_Error
-	 * @expectedExceptionMessage Required parameter 'from' not set.
+	 * @expectedExceptionMessage Required parameter 'from' not set.
 	 */
-	public function testEmptyFrom() {
-		$appender = new LoggerAppenderMailEvent("myname");
-		$appender->setLayout(new LoggerLayoutSimple());
-		$appender->setTo('info@example.com');
-		$appender->activateOptions();
+	public function testEmptyFrom() {
+		$appender = new LoggerAppenderMailEvent("myname");
+		$appender->setLayout(new LoggerLayoutSimple());
+		$appender->setTo('info@example.com');
+		$appender->activateOptions();
 	}
 }


Mime
View raw message