Author: ihabunek
Date: Mon Mar 19 15:14:36 2012
New Revision: 1302503
URL: http://svn.apache.org/viewvc?rev=1302503&view=rev
Log:
Made TTCC layout deprecated (updated docs, added a warning, removed it from
examples in site docs, removed it from default config). Minor docs improvements.
Modified:
logging/log4php/trunk/src/changes/changes.xml
logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php
logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php
logging/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php
logging/log4php/trunk/src/site/xdoc/docs/appenders.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/console.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/daily-file.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/echo.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/file.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/mail-event.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/mail.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/php.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/rolling-file.xml
logging/log4php/trunk/src/site/xdoc/docs/appenders/syslog.xml
logging/log4php/trunk/src/site/xdoc/docs/configuration.xml
logging/log4php/trunk/src/site/xdoc/docs/layouts.xml
logging/log4php/trunk/src/site/xdoc/docs/layouts/ttcc.xml
logging/log4php/trunk/src/site/xdoc/quickstart.xml
logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php
logging/log4php/trunk/src/test/php/layouts/LoggerLayoutTTCCTest.php
logging/log4php/trunk/src/test/resources/configs/loggers/config_invalid_additivity.xml
logging/log4php/trunk/src/test/resources/configs/renderers/config_invalid_rendering_class.xml
logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendered_class.xml
logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendering_class.xml
logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendered_class.xml
logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendering_class.xml
Modified: logging/log4php/trunk/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/changes/changes.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/changes/changes.xml (original)
+++ logging/log4php/trunk/src/changes/changes.xml Mon Mar 19 15:14:36 2012
@@ -21,6 +21,7 @@
</properties>
<body>
<release version="2.3.0" date="SVN">
+ <action date="2011-03-19" type="update" dev="Ivan
Habunek">Made LoggerLayoutTTCC deprecated.</action>
<action date="2011-02-28" type="fix"
issue="LOG4PHP-163" dev="Ivan Habunek">Fixed formatting bug in
LoggerLayoutPattern.</action>
<action date="2011-02-28" type="update"
issue="LOG4PHP-172" dev="Ivan Habunek">Rewritten pattern system to allow longer
conversion words and some new ones.</action>
<action date="2011-02-28" type="add"
issue="LOG4PHP-134" dev="Ivan Habunek">Added reconnectAttempts parameter to
LoggerAppenderPDO. Adds support for reconnect if connection fails while
appending.</action>
Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php
(original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php Mon Mar
19 15:14:36 2012
@@ -19,7 +19,7 @@
*/
/**
- * Log events using php {@link PHP_MANUAL#trigger_error} function and a {@link
LoggerLayoutTTCC} default layout.
+ * Log events using php {@link PHP_MANUAL#trigger_error} function and a {@link
LoggerLayoutSimple} default layout.
*
* This appender has no configurable parameters.
*
Modified:
logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
---
logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php
(original)
+++
logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php
Mon Mar 19 15:14:36 2012
@@ -55,10 +55,7 @@ class LoggerConfiguratorDefault implemen
),
'appenders' => array(
'default' => array(
- 'class' => 'LoggerAppenderEcho',
- 'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
- ),
+ 'class' => 'LoggerAppenderEcho'
),
),
);
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=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php (original)
+++ logging/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php Mon Mar 19
15:14:36 2012
@@ -47,6 +47,9 @@
* @version $Revision$
* @package log4php
* @subpackage layouts
+ *
+ * @deprecated LoggerLayout TTCC is deprecated and will be removed in a future
release. Please use
+ * LoggerLayoutPattern instead.
*/
class LoggerLayoutTTCC extends LoggerLayout {
@@ -68,6 +71,7 @@ class LoggerLayoutTTCC extends LoggerLay
* @see dateFormat
*/
public function __construct($dateFormat = '') {
+ $this->warn("LoggerLayout TTCC is deprecated and will be
removed in a future release. Please use LoggerLayoutPattern instead.");
if (!empty($dateFormat)) {
$this->dateFormat = $dateFormat;
}
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders.xml Mon Mar 19 15:14:36
2012
@@ -107,7 +107,7 @@
<pre class="prettyprint linenums"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderFile">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="file" value="/var/log/my.log" />
<param name="append" value="true" />
</appender>
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/console.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/console.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/console.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/console.xml Mon Mar 19
15:14:36 2012
@@ -74,7 +74,7 @@
<pre class="prettyprint linenums"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderConsole">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
</appender>
<root>
<appender_ref ref="default" />
@@ -90,7 +90,7 @@ array(
'default' => array(
'class' => 'LoggerAppenderConsole',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
),
),
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/daily-file.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/daily-file.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/daily-file.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/daily-file.xml Mon Mar
19 15:14:36 2012
@@ -97,7 +97,7 @@
<pre class="prettyprint linenums"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderDailyFile">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="file" value="file-%s.log" />
<param name="datePattern" value="Y-m-d" />
</appender>
@@ -114,7 +114,7 @@ array(
'default' => array(
'class' => 'LoggerAppenderDailyFile',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
'params' => array(
'datePattern' => 'Y-m-d',
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/echo.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/echo.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/echo.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/echo.xml Mon Mar 19
15:14:36 2012
@@ -75,7 +75,7 @@
<pre class="prettyprint"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderEcho">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="htmlLineBreaks" value="true" />
</appender>
<root>
@@ -91,7 +91,7 @@
'default' => array(
'class' => 'LoggerAppenderEcho',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
'params' => array(
'htmlLineBreaks' => 'true',
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/file.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/file.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/file.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/file.xml Mon Mar 19
15:14:36 2012
@@ -86,7 +86,7 @@
<pre class="prettyprint"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderFile">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="file" value="file.log" />
<param name="append" value="false" />
</appender>
@@ -103,7 +103,7 @@ array(
'default' => array(
'class' => 'LoggerAppenderFile',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
'params' => array(
'file' => 'file.log',
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/mail-event.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/mail-event.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/mail-event.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/mail-event.xml Mon Mar
19 15:14:36 2012
@@ -105,7 +105,7 @@
<pre class="prettyprint"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderMailEvent">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="to" value="[email protected],[email protected]" />
<param name="from" value="[email protected]" />
</appender>
@@ -122,7 +122,7 @@ array(
'default' => array(
'class' => 'LoggerAppenderMailEvent',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
'params' => array(
'to' => '[email protected],[email protected]',
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/mail.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/mail.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/mail.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/mail.xml Mon Mar 19
15:14:36 2012
@@ -98,7 +98,7 @@
<pre class="prettyprint"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderMail">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="to" value="[email protected],[email protected]" />
<param name="from" value="[email protected]" />
</appender>
@@ -115,7 +115,7 @@ array(
'default' => array(
'class' => 'LoggerAppenderMail',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
'params' => array(
'to' => '[email protected],[email protected]',
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/php.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/php.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/php.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/php.xml Mon Mar 19
15:14:36 2012
@@ -58,7 +58,7 @@
<pre class="prettyprint"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderPhp">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
</appender>
<root>
<appender_ref ref="default" />
@@ -73,7 +73,7 @@ array(
'default' => array(
'class' => 'LoggerAppenderPhp',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
),
),
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/rolling-file.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/rolling-file.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/rolling-file.xml
(original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/rolling-file.xml Mon Mar
19 15:14:36 2012
@@ -107,7 +107,7 @@
<pre class="prettyprint"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderRollingFile">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="file" value="file.log" />
<param name="maxFileSize" value="1MB" />
<param name="maxBackupIndex" value="5" />
@@ -125,7 +125,7 @@ array(
'default' => array(
'class' => 'LoggerAppenderRollingFile',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
'params' => array(
'file' => 'file.log',
Modified: logging/log4php/trunk/src/site/xdoc/docs/appenders/syslog.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/appenders/syslog.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/appenders/syslog.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/appenders/syslog.xml Mon Mar 19
15:14:36 2012
@@ -314,7 +314,7 @@
<pre class="prettyprint linenums"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderSyslog">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="ident" value="log4php-test" />
<param name="facility" value="LOCAL0" />
<param name="option" value="NDELAY|PID" />
@@ -332,7 +332,7 @@ array(
'default' => array(
'class' => 'LoggerAppenderSyslog',
'layout' => array(
- 'class' => 'LoggerLayoutTTCC',
+ 'class' => 'LoggerLayoutSimple',
),
'params' => array(
'ident' => 'log4php-test',
Modified: logging/log4php/trunk/src/site/xdoc/docs/configuration.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/configuration.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/configuration.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/configuration.xml Mon Mar 19
15:14:36 2012
@@ -47,7 +47,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderFile">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutSimple" />
<param name="file" value="/var/log/my.log" />
<param name="append" value="true" />
</appender>
@@ -148,7 +148,7 @@ $config = $configurator->parse('/path/to
<pre class="prettyprint">
# Appender named "default"
log4php.appender.default = LoggerAppenderEcho
-log4php.appender.default.layout = LoggerLayoutTTCC
+log4php.appender.default.layout = LoggerLayoutSimple
# Appender named "file"
log4php.appender.file = LoggerAppenderDailyFile
@@ -184,7 +184,7 @@ log4php.threshold = debug
<subsection name="Default configuration"
id="Default_configuration">
<p>If no configuration is provided before the
initial logging request is issued, log4php will configure
using the default configuration. This consists
of a single <code>LoggerAppenderEcho</code> appender,
- using <code>LoggerLayoutTTCC</code>, attached
to the root logger and set to the DEBUG level.</p>
+ using <code>LoggerLayoutSimple</code>, attached
to the root logger and set to the DEBUG level.</p>
<p>The default configuration in PHP format
is:</p>
@@ -231,9 +231,8 @@ class MyConfigurator implements LoggerCo
$appFile->activateOptions();
// Use a different layout for the next appender
- $layout = new LoggerLayoutTTCC();
- $layout->setContextPrinting(false);
- $layout->setDateFormat('%Y-%m-%d %H:%M:%S');
+ $layout = new LoggerLayoutPattern();
+ $layout->setConversionPattern("%date %logger %msg%newline");
$layout->activateOptions();
// Create an appender which echoes log events, using a custom layout
Modified: logging/log4php/trunk/src/site/xdoc/docs/layouts.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/layouts.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/layouts.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/layouts.xml Mon Mar 19 15:14:36
2012
@@ -60,7 +60,8 @@
</tr>
<tr>
<td><a
href="layouts/ttcc.html">LoggerLayoutTTCC</a></td>
- <td>Consists of Time,
Thread, Category and nested diagnostic Context.</td>
+ <td>Consists of Time,
Thread, Category and nested diagnostic Context.
+ <span class="label
label-warning">DEPRECATED</span></td>
</tr>
<tr>
<td><a
href="layouts/xml.html">LoggerLayoutXml</a></td>
Modified: logging/log4php/trunk/src/site/xdoc/docs/layouts/ttcc.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/docs/layouts/ttcc.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/docs/layouts/ttcc.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/docs/layouts/ttcc.xml Mon Mar 19
15:14:36 2012
@@ -25,9 +25,15 @@
<body>
<section name="LoggerLayoutTTCC">
+ <div class="alert alert-error">
+ <span class="alert-heading">Deprecated!</span>
+ <p>LoggerLayoutTTCC is deprecated and will be removed
in a future release. Please use
+ <a href="pattern.html">LoggerLayoutPattern</a>
instead.</p>
+ </div>
+
<p>The TTCC layout format was taken from Apache log4j,
and originally consisted of Time, Thread, Category
and nested diagnostic Context information, hence the
name.</p>
-
+
<p><code>LoggerLayoutTTCC</code> contains equivalent
information:</p>
<ul>
<li>Time</li>
Modified: logging/log4php/trunk/src/site/xdoc/quickstart.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/site/xdoc/quickstart.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/site/xdoc/quickstart.xml (original)
+++ logging/log4php/trunk/src/site/xdoc/quickstart.xml Mon Mar 19 15:14:36 2012
@@ -34,26 +34,27 @@
<p>Just want logging to stdout?</p>
<pre class="prettyprint linenums">
-include('log4php/Logger.php');
+include('Logger.php');
$logger = Logger::getLogger("main");
-$logger->info("foo");
-$logger->warn("bar");
+$logger->info("This is an informational message.");
+$logger->warn("I'm not feeling so good...");
</pre>
<p>This produces the following output:</p>
<pre>
-Sun Jul 26 01:40:23 2009,021 [10093] INFO main - foo
-Sun Jul 26 01:40:23 2009,030 [10093] WARN main - bar
+INFO - This is an informational message.
+WARN - I'm not feeling so good...
</pre>
</subsection>
<subsection name="A simple example">
- <p>This example demonstrates how to log
messages to a file, but only with level greater or equal to
- WARN.</p>
+ <p>This example shows how to configure log4php
using an XML configuration file. The framework will be
+ configured to log messages to a file, but only
those with level greater or equal to <code>WARN</code>.
+ </p>
- <p>Create a configuration file named
<code>log4php.xml</code> containing:</p>
+ <p>First, create a configuration file named
<code>config.xml</code> containing:</p>
<pre class="prettyprint linenums"><![CDATA[
<configuration xmlns="http://logging.apache.org/log4php/">
@@ -67,20 +68,20 @@ Sun Jul 26 01:40:23 2009,030 [10093] WAR
</configuration>
]]></pre>
- <p>This configuration file:</p>
+ <p>This configuration file does the
following:</p>
<ul>
- <li>Creates an appender named
<code>myAppender</code> using appender class <code>
- <a
href="docs/appenders.html#LoggerAppenderFile">LoggerAppenderFile</a></code>
which is used for
- logging to a file (on line 2).</li>
+ <li><em>line 2</em>: Creates an appender
named <code>myAppender</code> using appender class <code>
+ <a
href="docs/appenders/file.html">LoggerAppenderFile</a></code> which is used for
+ logging to a file.</li>
- <li>Sets the <code>file</code>
parameter, which is required for LoggerAppenderFile, to the path
- to the file in which events will be
logged (on line 3).</li>
+ <li><em>line 3</em>: Sets the
<code>file</code> parameter, which tells the appender to which file to
+ write.</li>
- <li>Sets the root logger level to
<code>WARN</code> (on line 6)). This means that logging requests
- with the level lower than WARN will be
ignored.</li>
+ <li><em>line 6</em>: Sets the root
logger level to <code>WARN</code>. This means that logging requests
+ with the level lower than
<code>WARN</code> will not be logged by the root logger.</li>
- <li>Links <code>myAppender</code> to
the root logger (on line 7) so that all events recieved by the root
+ <li><em>line 7</em>: Links
<code>myAppender</code> to the root logger so that all events recieved by the
root
logger will be forwarded to
<code>myAppender</code> and written into the log file.</li>
</ul>
@@ -91,7 +92,7 @@ Sun Jul 26 01:40:23 2009,030 [10093] WAR
include('log4php/Logger.php');
// Tell log4php to use our configuration file.
-Logger::configure('log4php.xml');
+Logger::configure('config.xml');
// Fetch a logger, it will inherit settings from the root logger
$log = Logger::getLogger('myLogger');
@@ -112,22 +113,24 @@ WARN - My fourth message.
ERROR - My fifth message.
FATAL - My sixth message.
]]></pre>
+
</subsection>
<subsection name="An advanced example">
<p>This example covers named loggers, layouts
and best practices in object-oriented programming.</p>
- <p>Create a configuration file named
<code>log4php.xml</code> with the following content:</p>
+ <p>Create a configuration file named
<code>config.xml</code> with the following content:</p>
<pre class="prettyprint linenums"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="myConsoleAppender" class="LoggerAppenderConsole" />
<appender name="myFileAppender" class="LoggerAppenderFile">
- <layout class="LoggerLayoutTTCC" />
+ <layout class="LoggerLayoutPattern">
+ <param name="conversionPattern" value="%date [%logger]
%message%newline" />
+ </layout>
<param name="file" value="myLog.log" />
</appender>
@@ -148,7 +151,7 @@ FATAL - My sixth message.
console appender doesn't have a layout defined,
so it will revert to default layout
(<code><a
href="docs/layouts/simple.html">LoggerLayoutSimple</a></code>). The
file appender uses a different layout
- (<code><a
href="docs/layouts/ttcc.html">LoggerLayoutTTCC</a></code>)
+ (<code><a
href="docs/layouts/pattern.html">LoggerLayoutPattern</a></code>)
which will result in different formatting of
the logging
events.</p>
@@ -162,7 +165,7 @@ FATAL - My sixth message.
<pre class="prettyprint linenums"><![CDATA[
// Include and configure log4php
include('log4php/Logger.php');
-Logger::configure('log4php.xml');
+Logger::configure('config.xml');
/**
* This is a classic usage pattern: one logger object per class.
Modified: logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php (original)
+++ logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php Mon Mar 19
15:14:36 2012
@@ -66,7 +66,7 @@ class CostumDefaultRenderer implements L
$this->assertSame('default', $appender->getName());
$layout = $appender->getLayout();
- $this->assertInstanceOf('LoggerLayoutTTCC', $layout);
+ $this->assertInstanceOf('LoggerLayoutSimple', $layout);
$root = Logger::getRootLogger();
$appenders = $root->getAllAppenders();
Modified: logging/log4php/trunk/src/test/php/layouts/LoggerLayoutTTCCTest.php
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/php/layouts/LoggerLayoutTTCCTest.php?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
--- logging/log4php/trunk/src/test/php/layouts/LoggerLayoutTTCCTest.php
(original)
+++ logging/log4php/trunk/src/test/php/layouts/LoggerLayoutTTCCTest.php Mon Mar
19 15:14:36 2012
@@ -27,11 +27,19 @@
* @group layouts
*/
class LoggerLayoutTTCCTest extends PHPUnit_Framework_TestCase {
-
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ * @expectedExceptionMessage LoggerLayout TTCC is deprecated and will
be removed in a future release.
+ */
+ public function testDeprecationWarning() {
+ $layout = new LoggerLayoutTTCC();
+ }
+
public function testErrorLayout() {
$event = new LoggerLoggingEvent("LoggerLayoutTTCC", new
Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
- $layout = new LoggerLayoutTTCC();
+ $layout = @new LoggerLayoutTTCC();
$v = $layout->format($event);
$pos = strpos($v, "[".$event->getThreadName()."] ERROR TEST -
testmessage");
@@ -46,7 +54,7 @@ class LoggerLayoutTTCCTest extends PHPUn
public function testWarnLayout() {
$event = new LoggerLoggingEvent("LoggerLayoutXml", new
Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
- $layout = new LoggerLayoutTTCC();
+ $layout = @new LoggerLayoutTTCC();
$v = $layout->format($event);
$pos = strpos($v, "[".$event->getThreadName()."] WARN TEST -
testmessage");
Modified:
logging/log4php/trunk/src/test/resources/configs/loggers/config_invalid_additivity.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/resources/configs/loggers/config_invalid_additivity.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
---
logging/log4php/trunk/src/test/resources/configs/loggers/config_invalid_additivity.xml
(original)
+++
logging/log4php/trunk/src/test/resources/configs/loggers/config_invalid_additivity.xml
Mon Mar 19 15:14:36 2012
@@ -17,7 +17,7 @@
-->
<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
<appender name="default" class="LoggerAppenderEcho">
- <layout class="LoggerLayoutTTCC"/>
+ <layout class="LoggerLayoutSimple"/>
</appender>
<logger name="myLogger" additivity="4711">
<level value="warn" />
Modified:
logging/log4php/trunk/src/test/resources/configs/renderers/config_invalid_rendering_class.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/resources/configs/renderers/config_invalid_rendering_class.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
---
logging/log4php/trunk/src/test/resources/configs/renderers/config_invalid_rendering_class.xml
(original)
+++
logging/log4php/trunk/src/test/resources/configs/renderers/config_invalid_rendering_class.xml
Mon Mar 19 15:14:36 2012
@@ -17,7 +17,7 @@
-->
<configuration xmlns="http://logging.apache.org/log4php">
<appender name="foo" class="LoggerAppenderConsole">
- <layout class="LoggerLayoutTTCC"/>
+ <layout class="LoggerLayoutSimple"/>
</appender>
<renderer renderedClass="stdClass" renderingClass="stdClass" />
Modified:
logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendered_class.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendered_class.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
---
logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendered_class.xml
(original)
+++
logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendered_class.xml
Mon Mar 19 15:14:36 2012
@@ -17,7 +17,7 @@
-->
<configuration xmlns="http://logging.apache.org/log4php">
<appender name="foo" class="LoggerAppenderConsole">
- <layout class="LoggerLayoutTTCC"/>
+ <layout class="LoggerLayoutSimple"/>
</appender>
<renderer renderingClass="LoggerRendererDefault" />
Modified:
logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendering_class.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendering_class.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
---
logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendering_class.xml
(original)
+++
logging/log4php/trunk/src/test/resources/configs/renderers/config_no_rendering_class.xml
Mon Mar 19 15:14:36 2012
@@ -17,7 +17,7 @@
-->
<configuration xmlns="http://logging.apache.org/log4php">
<appender name="foo" class="LoggerAppenderConsole">
- <layout class="LoggerLayoutTTCC"/>
+ <layout class="LoggerLayoutSimple"/>
</appender>
<renderer />
Modified:
logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendered_class.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendered_class.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
---
logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendered_class.xml
(original)
+++
logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendered_class.xml
Mon Mar 19 15:14:36 2012
@@ -17,7 +17,7 @@
-->
<configuration xmlns="http://logging.apache.org/log4php">
<appender name="foo" class="LoggerAppenderConsole">
- <layout class="LoggerLayoutTTCC"/>
+ <layout class="LoggerLayoutSimple"/>
</appender>
<renderer renderedClass="RenderFooClass"
renderingClass="LoggerRendererDefault" />
Modified:
logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendering_class.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendering_class.xml?rev=1302503&r1=1302502&r2=1302503&view=diff
==============================================================================
---
logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendering_class.xml
(original)
+++
logging/log4php/trunk/src/test/resources/configs/renderers/config_not_existing_rendering_class.xml
Mon Mar 19 15:14:36 2012
@@ -17,7 +17,7 @@
-->
<configuration xmlns="http://logging.apache.org/log4php">
<appender name="foo" class="LoggerAppenderConsole">
- <layout class="LoggerLayoutTTCC"/>
+ <layout class="LoggerLayoutSimple"/>
</appender>
<renderer renderedClass="stdClass" renderingClass="FooRenderer" />