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 ch...@apache.org on 2009/10/06 20:51:49 UTC

svn commit: r822426 - in /incubator/log4php/trunk/src: examples/php/ examples/resources/ main/php/filters/ site/apt/docs/

Author: chammers
Date: Tue Oct  6 18:51:48 2009
New Revision: 822426

URL: http://svn.apache.org/viewvc?rev=822426&view=rev
Log:
* Examples for the various Filter classes
* References from the appender-filter.apt as well as from
  the classes phpdoc
* Renamed existing examples to filter_*

Added:
    incubator/log4php/trunk/src/examples/php/filter_denyall.php
    incubator/log4php/trunk/src/examples/php/filter_levelmatch.php
    incubator/log4php/trunk/src/examples/php/filter_levelrange.php
    incubator/log4php/trunk/src/examples/php/filter_stringmatch.php
    incubator/log4php/trunk/src/examples/resources/filter_denyall.xml
    incubator/log4php/trunk/src/examples/resources/filter_levelmatch.xml
    incubator/log4php/trunk/src/examples/resources/filter_levelrange.xml
    incubator/log4php/trunk/src/examples/resources/filter_stringmatch.xml
Removed:
    incubator/log4php/trunk/src/examples/php/levelmatchfilter.php
    incubator/log4php/trunk/src/examples/php/levelrangefilter.php
    incubator/log4php/trunk/src/examples/php/stringmatchfilter.php
    incubator/log4php/trunk/src/examples/resources/levelmatchfilter.xml
    incubator/log4php/trunk/src/examples/resources/levelrangefilter.xml
    incubator/log4php/trunk/src/examples/resources/stringmatchfilter.xml
Modified:
    incubator/log4php/trunk/src/main/php/filters/LoggerFilterDenyAll.php
    incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php
    incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php
    incubator/log4php/trunk/src/main/php/filters/LoggerFilterStringMatch.php
    incubator/log4php/trunk/src/site/apt/docs/appender-filter.apt

Added: incubator/log4php/trunk/src/examples/php/filter_denyall.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/filter_denyall.php?rev=822426&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/php/filter_denyall.php (added)
+++ incubator/log4php/trunk/src/examples/php/filter_denyall.php Tue Oct  6 18:51:48 2009
@@ -0,0 +1,8 @@
+<?php
+// START SNIPPET: doxia
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+
+Logger::configure(dirname(__FILE__).'/../resources/filter_denyall.xml');
+$logger = Logger::getRootLogger();
+$logger->info("Some text that will be discarded");
+// END SNIPPET: doxia

Added: incubator/log4php/trunk/src/examples/php/filter_levelmatch.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/filter_levelmatch.php?rev=822426&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/php/filter_levelmatch.php (added)
+++ incubator/log4php/trunk/src/examples/php/filter_levelmatch.php Tue Oct  6 18:51:48 2009
@@ -0,0 +1,9 @@
+<?php
+// START SNIPPET: doxia
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+
+Logger::configure(dirname(__FILE__).'/../resources/filter_levelmatch.xml');
+$logger = Logger::getRootLogger();
+$logger->debug("Matching and will be rejected");
+$logger->info("Not matching and will be accepted");
+// END SNIPPET: doxia

Added: incubator/log4php/trunk/src/examples/php/filter_levelrange.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/filter_levelrange.php?rev=822426&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/php/filter_levelrange.php (added)
+++ incubator/log4php/trunk/src/examples/php/filter_levelrange.php Tue Oct  6 18:51:48 2009
@@ -0,0 +1,12 @@
+<?php
+// START SNIPPET: doxia
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+ 
+Logger::configure(dirname(__FILE__).'/../resources/filter_levelrange.xml');
+$logger = Logger::getRootLogger();
+$logger->debug("This is a debug message");
+$logger->info("This is an info message");
+$logger->warn("This is a warning");
+$logger->error("This is an error");
+$logger->fatal("This is a fatal error");
+// END SNIPPET: doxia

Added: incubator/log4php/trunk/src/examples/php/filter_stringmatch.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/filter_stringmatch.php?rev=822426&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/php/filter_stringmatch.php (added)
+++ incubator/log4php/trunk/src/examples/php/filter_stringmatch.php Tue Oct  6 18:51:48 2009
@@ -0,0 +1,9 @@
+<?php
+// START SNIPPET: doxia
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+
+Logger::configure(dirname(__FILE__).'/../resources/filter_stringmatch.xml');
+$logger = Logger::getRootLogger();
+$logger->debug("Some text to match that will be rejected");
+$logger->info("Some other text that will be accepted");
+// END SNIPPET: doxia

Added: incubator/log4php/trunk/src/examples/resources/filter_denyall.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/filter_denyall.xml?rev=822426&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/filter_denyall.xml (added)
+++ incubator/log4php/trunk/src/examples/resources/filter_denyall.xml Tue Oct  6 18:51:48 2009
@@ -0,0 +1,12 @@
+<log4php:configuration
+  xmlns:log4php="http://logging.apache.org/log4php/"
+  threshold="all" debug="false">
+    <appender name="default" class="LoggerAppenderEcho">
+        <layout class="LoggerLayoutTTCC"/>
+        <filter class="LoggerFilterDenyAll"/>
+    </appender>
+    <root>
+        <level value="DEBUG" />
+        <appender_ref ref="default" />
+    </root>
+</log4php:configuration>

Added: incubator/log4php/trunk/src/examples/resources/filter_levelmatch.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/filter_levelmatch.xml?rev=822426&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/filter_levelmatch.xml (added)
+++ incubator/log4php/trunk/src/examples/resources/filter_levelmatch.xml Tue Oct  6 18:51:48 2009
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<log4php:configuration
+  xmlns:log4php="http://logging.apache.org/log4php/"
+  threshold="all" debug="false">
+    <appender name="default" class="LoggerAppenderEcho">
+        <layout class="LoggerLayoutTTCC"/>
+        <filter class="LoggerFilterLevelMatch">
+            <param name="LevelToMatch" value="DEBUG" />
+            <param name="AcceptOnMatch" value="false" />
+        </filter>
+    </appender>
+    <root>
+        <level value="DEBUG" />
+        <appender_ref ref="default" />
+    </root>
+</log4php:configuration>

Added: incubator/log4php/trunk/src/examples/resources/filter_levelrange.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/filter_levelrange.xml?rev=822426&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/filter_levelrange.xml (added)
+++ incubator/log4php/trunk/src/examples/resources/filter_levelrange.xml Tue Oct  6 18:51:48 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<log4php:configuration
+  xmlns:log4php="http://logging.apache.org/log4php/"
+  threshold="all" debug="false">
+    <appender name="default" class="LoggerAppenderEcho">
+        <layout class="LoggerLayoutTTCC"/>
+        <filter class="LoggerFilterLevelRange">
+            <param name="LevelMin" value="ERROR" />
+                        <param name="LevelMax" value="FATAL" />
+            <param name="AcceptOnMatch" value="false" />
+        </filter>
+    </appender>
+    <root>
+        <level value="DEBUG" />
+        <appender_ref ref="default" />
+    </root>
+</log4php:configuration>

Added: incubator/log4php/trunk/src/examples/resources/filter_stringmatch.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/filter_stringmatch.xml?rev=822426&view=auto
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/filter_stringmatch.xml (added)
+++ incubator/log4php/trunk/src/examples/resources/filter_stringmatch.xml Tue Oct  6 18:51:48 2009
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<log4php:configuration xmlns:log4php="http://logging.apache.org/log4php/" threshold="all" debug="false">
+    <appender name="default" class="LoggerAppenderEcho">
+        <layout class="LoggerLayoutTTCC"/>
+        <filter class="LoggerFilterStringMatch">
+            <param name="StringToMatch" value="match" />
+            <param name="AcceptOnMatch" value="false" />
+        </filter>
+    </appender>
+    <root>
+        <level value="DEBUG" />
+        <appender_ref ref="default" />
+    </root>
+</log4php:configuration>

Modified: incubator/log4php/trunk/src/main/php/filters/LoggerFilterDenyAll.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/filters/LoggerFilterDenyAll.php?rev=822426&r1=822425&r2=822426&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/filters/LoggerFilterDenyAll.php (original)
+++ incubator/log4php/trunk/src/main/php/filters/LoggerFilterDenyAll.php Tue Oct  6 18:51:48 2009
@@ -15,15 +15,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
+ * @package log4php
  */
 
 /**
  * This filter drops all logging events. 
  * 
- * <p>You can add this filter to the end of a filter chain to
+ * You can add this filter to the end of a filter chain to
  * switch from the default "accept all unless instructed otherwise"
  * filtering behaviour to a "deny all unless instructed otherwise"
- * behaviour.</p>
+ * behaviour.
+ * 
+ * <p>
+ * An example for this filter:
+ * 
+ * {@example ../../examples/php/filter_denyall.php}
+ *
+ * <p>
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/filter_denyall.xml}
  *
  * @version $Revision$
  * @package log4php

Modified: incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php?rev=822426&r1=822425&r2=822426&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php (original)
+++ incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php Tue Oct  6 18:51:48 2009
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
+ * @package log4php
  */
 
 /**
@@ -28,7 +29,17 @@
  * option value is set to <i>true</i>, if it is <i>false</i> then 
  * {@link LoggerFilter::DENY} is returned. If there is no match, 
  * {@link LoggerFilter::NEUTRAL} is returned.</p>
+ * 
+ * <p>
+ * An example for this filter:
+ * 
+ * {@example ../../examples/php/filter_levelmatch.php}
  *
+ * <p>
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/filter_levelmatch.xml}
+ * 
  * @version $Revision$
  * @package log4php
  * @subpackage filters

Modified: incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php?rev=822426&r1=822425&r2=822426&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php (original)
+++ incubator/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php Tue Oct  6 18:51:48 2009
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
+ * @package log4php
  */
 
 /**
@@ -43,9 +44,18 @@
  * available to <b>all</b> appenders extending {@link LoggerAppender} 
  * for a more convenient way to filter out events by level.</p>
  *
- * @log4j-class org.apache.log4j.varia.LevelRangeFilter
- * @log4j-author Simon Kitching
- * @log4j-author based on code by Ceki G&uuml;lc&uuml; 
+ * <p>
+ * An example for this filter:
+ * 
+ * {@example ../../examples/php/filter_levelrange.php}
+ *
+ * <p>
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/filter_levelrange.xml}
+ *
+ * @author Simon Kitching
+ * @author based on the org.apache.log4j.varia.LevelRangeFilte Java code by Ceki G&uuml;lc&uuml; 
  *
  * @version $Revision$
  * @package log4php

Modified: incubator/log4php/trunk/src/main/php/filters/LoggerFilterStringMatch.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/filters/LoggerFilterStringMatch.php?rev=822426&r1=822425&r2=822426&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/filters/LoggerFilterStringMatch.php (original)
+++ incubator/log4php/trunk/src/main/php/filters/LoggerFilterStringMatch.php Tue Oct  6 18:51:48 2009
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
+ * @package log4php
  */
 
 /**
@@ -28,6 +29,16 @@
  * the <b>AcceptOnMatch</b> option value is true, if it is false then
  * {@link LoggerFilter::DENY} is returned. If there is no match, {@link LoggerFilter::NEUTRAL}
  * is returned.</p>
+ * 
+ * <p>
+ * An example for this filter:
+ * 
+ * {@example ../../examples/php/filter_stringmatch.php}
+ *
+ * <p>
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/filter_stringmatch.xml}
  *
  * @version $Revision$
  * @package log4php

Modified: incubator/log4php/trunk/src/site/apt/docs/appender-filter.apt
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/site/apt/docs/appender-filter.apt?rev=822426&r1=822425&r2=822426&view=diff
==============================================================================
--- incubator/log4php/trunk/src/site/apt/docs/appender-filter.apt (original)
+++ incubator/log4php/trunk/src/site/apt/docs/appender-filter.apt Tue Oct  6 18:51:48 2009
@@ -18,6 +18,8 @@
  ------
  ------
 
+%{toc|section=1|fromDepth=1|toDepth=2}
+
 Filtering Messages
 
   Filtering is a mechanism to configure enhanced logging. For example, filter enable you to
@@ -115,10 +117,8 @@
 
   Example:
   
-+--
-<filter class="LoggerFilterStringMatch">
-	<param name="StringToMatch" value="matchingstring" />
-	<param name="AcceptOnMatch" value="true" />
-</filter>
-+--
-  
+%{snippet|id=doxia|file=src/examples/php/filter_stringmatch.php}
+
+%{snippet|id=doxia|file=src/examples/resources/filter_stringmatch.xml}
+
+