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 gr...@apache.org on 2009/08/17 07:04:26 UTC

svn commit: r804863 - /incubator/log4php/trunk/src/examples/php/

Author: grobmeier
Date: Mon Aug 17 05:04:25 2009
New Revision: 804863

URL: http://svn.apache.org/viewvc?rev=804863&view=rev
Log:
replaced define with new Logger::configure method

Modified:
    incubator/log4php/trunk/src/examples/php/cache.php
    incubator/log4php/trunk/src/examples/php/client.php
    incubator/log4php/trunk/src/examples/php/console.php
    incubator/log4php/trunk/src/examples/php/dailyfile.php
    incubator/log4php/trunk/src/examples/php/echo.php
    incubator/log4php/trunk/src/examples/php/file.php
    incubator/log4php/trunk/src/examples/php/levelmatchfilter.php
    incubator/log4php/trunk/src/examples/php/levelrangefilter.php
    incubator/log4php/trunk/src/examples/php/mail.php
    incubator/log4php/trunk/src/examples/php/mdc.php
    incubator/log4php/trunk/src/examples/php/ndc.php
    incubator/log4php/trunk/src/examples/php/php.php
    incubator/log4php/trunk/src/examples/php/server.php
    incubator/log4php/trunk/src/examples/php/simple.php
    incubator/log4php/trunk/src/examples/php/stringmatchfilter.php
    incubator/log4php/trunk/src/examples/php/syslog.php

Modified: incubator/log4php/trunk/src/examples/php/cache.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/cache.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/cache.php (original)
+++ incubator/log4php/trunk/src/examples/php/cache.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/cache.properties');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
-require_once LOG4PHP_DIR.'/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/cache.properties');
 
 $cache = '../../../target/examples/hierarchy.cache';
 

Modified: incubator/log4php/trunk/src/examples/php/client.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/client.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/client.php (original)
+++ incubator/log4php/trunk/src/examples/php/client.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/client.properties');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
-require_once LOG4PHP_DIR.'/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/client.properties');
 $logger = Logger::getRootLogger();
 $logger->info("Hello World!");
 ?>

Modified: incubator/log4php/trunk/src/examples/php/console.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/console.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/console.php (original)
+++ incubator/log4php/trunk/src/examples/php/console.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/console.properties');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/console.properties');
 
-require_once LOG4PHP_DIR.'/Logger.php';
 $logger = Logger::getRootLogger();
 $logger->debug("Hello World!");
 ?>

Modified: incubator/log4php/trunk/src/examples/php/dailyfile.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/dailyfile.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/dailyfile.php (original)
+++ incubator/log4php/trunk/src/examples/php/dailyfile.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/dailyfile.properties');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/dailyfile.properties');
 
-require_once LOG4PHP_DIR.'/Logger.php';
 $logger = Logger::getRootLogger();
 $logger->debug("Hello World!");
 ?>

Modified: incubator/log4php/trunk/src/examples/php/echo.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/echo.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/echo.php (original)
+++ incubator/log4php/trunk/src/examples/php/echo.php Mon Aug 17 05:04:25 2009
@@ -15,9 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/echo.properties');
-
 require_once dirname(__FILE__).'/../../main/php/Logger.php';
+
+Logger::configure(dirname(__FILE__).'/../resources/echo.properties');
 $logger = Logger::getLogger('echo-example');
 $logger->debug("Hello World!");
 ?>

Modified: incubator/log4php/trunk/src/examples/php/file.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/file.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/file.php (original)
+++ incubator/log4php/trunk/src/examples/php/file.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/file.properties');
-
-require_once LOG4PHP_DIR.'/Logger.php';
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/file.properties');
 $logger = Logger::getRootLogger();
 $logger->debug("Hello World!");
 ?>

Modified: incubator/log4php/trunk/src/examples/php/levelmatchfilter.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/levelmatchfilter.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/levelmatchfilter.php (original)
+++ incubator/log4php/trunk/src/examples/php/levelmatchfilter.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/levelmatchfilter.xml');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
-require_once LOG4PHP_DIR.'/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/levelmatchfilter.xml');
 $logger = Logger::getRootLogger();
 $logger->debug("Matching and will be rejected");
 $logger->info("Not matching and will be accepted");

Modified: incubator/log4php/trunk/src/examples/php/levelrangefilter.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/levelrangefilter.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/levelrangefilter.php (original)
+++ incubator/log4php/trunk/src/examples/php/levelrangefilter.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/levelrangefilter.xml');
-
-require_once LOG4PHP_DIR.'/Logger.php';
+ require_once dirname(__FILE__).'/../../main/php/Logger.php';
+ 
+Logger::configure(dirname(__FILE__).'/../resources/levelrangefilter.xml');
 $logger = Logger::getRootLogger();
 $logger->debug("This is a debug message");
 $logger->info("This is an info message");

Modified: incubator/log4php/trunk/src/examples/php/mail.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/mail.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/mail.php (original)
+++ incubator/log4php/trunk/src/examples/php/mail.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/mail.properties');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
-require_once LOG4PHP_DIR.'/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/mail.properties');
 $logger = Logger::getRootLogger();
 $logger->fatal("Some critical message!");
 ?>

Modified: incubator/log4php/trunk/src/examples/php/mdc.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/mdc.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/mdc.php (original)
+++ incubator/log4php/trunk/src/examples/php/mdc.php Mon Aug 17 05:04:25 2009
@@ -15,13 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/mdc.properties');
-
-require_once LOG4PHP_DIR.'/Logger.php';
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
+Logger::configure(dirname(__FILE__).'/../resources/mdc.properties');
 LoggerMDC::put('username', 'knut');
-
 $logger = Logger::getRootLogger();
 $logger->debug("Testing MDC");
 ?>

Modified: incubator/log4php/trunk/src/examples/php/ndc.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/ndc.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/ndc.php (original)
+++ incubator/log4php/trunk/src/examples/php/ndc.php Mon Aug 17 05:04:25 2009
@@ -15,17 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/mdc.properties');
-
-require_once LOG4PHP_DIR.'/Logger.php';
-
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/mdc.properties');
 $logger = Logger::getRootLogger();
-
 LoggerNDC::push('Context Message');
-
 $logger->debug("Testing NDC");
-
 LoggerNDC::pop();
-
 ?>

Modified: incubator/log4php/trunk/src/examples/php/php.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/php.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/php.php (original)
+++ incubator/log4php/trunk/src/examples/php/php.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/php.properties');
-
-require_once LOG4PHP_DIR.'/Logger.php';
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/php.properties');
 $logger = Logger::getRootLogger();
 $logger->debug("Hello PHP!");
 ?>

Modified: incubator/log4php/trunk/src/examples/php/server.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/server.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/server.php (original)
+++ incubator/log4php/trunk/src/examples/php/server.php Mon Aug 17 05:04:25 2009
@@ -15,9 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/server.properties');
-require_once LOG4PHP_DIR.'/Logger.php';
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/server.properties');
 
 require_once 'Net/Server.php';
 require_once 'Net/Server/Handler.php';

Modified: incubator/log4php/trunk/src/examples/php/simple.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/simple.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/simple.php (original)
+++ incubator/log4php/trunk/src/examples/php/simple.php Mon Aug 17 05:04:25 2009
@@ -15,9 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-
-require_once LOG4PHP_DIR.'/Logger.php';
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
 class Log4phpTest {
 
@@ -40,5 +38,4 @@
 
 // Safely close all appenders with...
 Logger::shutdown();
-
 ?>

Modified: incubator/log4php/trunk/src/examples/php/stringmatchfilter.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/stringmatchfilter.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/stringmatchfilter.php (original)
+++ incubator/log4php/trunk/src/examples/php/stringmatchfilter.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/stringmatchfilter.xml');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
-require_once LOG4PHP_DIR.'/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/stringmatchfilter.xml');
 $logger = Logger::getRootLogger();
 $logger->debug("Some text to match that will be rejected");
 $logger->info("Some other text that will be accepted");

Modified: incubator/log4php/trunk/src/examples/php/syslog.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/syslog.php?rev=804863&r1=804862&r2=804863&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/syslog.php (original)
+++ incubator/log4php/trunk/src/examples/php/syslog.php Mon Aug 17 05:04:25 2009
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-define('LOG4PHP_DIR', dirname(__FILE__).'/../../main/php');
-define('LOG4PHP_CONFIGURATION', dirname(__FILE__).'/../resources/syslog.properties');
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
 
-require_once LOG4PHP_DIR.'/Logger.php';
+Logger::configure(dirname(__FILE__).'/../resources/syslog.properties');
 $logger = Logger::getRootLogger();
 $logger->fatal("Hello World!");
 ?>