Author: floriansemm
Date: Wed Mar 21 20:15:40 2012
New Revision: 1303551
URL: http://svn.apache.org/viewvc?rev=1303551&view=rev
Log:
add examples
Added:
logging/log4php/trunk/src/examples/php/appender_firephp.php
logging/log4php/trunk/src/examples/resources/appender_firephp.xml (with
props)
Modified:
logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFirephp.php
Added: logging/log4php/trunk/src/examples/php/appender_firephp.php
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/examples/php/appender_firephp.php?rev=1303551&view=auto
==============================================================================
--- logging/log4php/trunk/src/examples/php/appender_firephp.php (added)
+++ logging/log4php/trunk/src/examples/php/appender_firephp.php Wed Mar 21
20:15:40 2012
@@ -0,0 +1,120 @@
+<?php
+/**
+ * Appender_Firephp example. Copy this file into your DOCUMENT_ROOT
+ *
+ * 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.
+ *
+ * PHP version 5
+ *
+ * @category Example
+ * @package LoggerAppenderFirephp
+ * @author Bruce Ingalls <Bruce.Ingalls-at-gmail-dot-com>
+ * @copyright 2012 Apache Software Foundation
+ * @license Apache License, Version 2.0
+ * @version SVN: $Id:$
+ * @link
http://sourcemint.com/github.com/firephp/firephp/1:1.0.0b1rc6/-docs/Configuration/Constants
+ * @link
https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/FirePHPHandler.php
+ * @since Feb 22, 2012
+ * @internal CodeSniffs as PEAR, adapted to Apache style. Phpmd clean.
+ */
+
+//Change next line to URL path following domain. I.e. chop off
'http://localhost'
+define('INSIGHT_SERVER_PATH', $_SERVER['REQUEST_URI']);
+//define('INSIGHT_SERVER_PATH', $_SERVER['SCRIPT_NAME']);
+define('INSIGHT_DEBUG', true); //Comment, after config is debugged, to remove
'Flushing headers'
+define('INSIGHT_IPS', '*'); //Your IP here for extra security
+//Works, but replace next line with free key from Developer Companion, for
security on live sites
+define('INSIGHT_AUTHKEYS', '*');
+define('INSIGHT_PATHS', dirname(__FILE__));
+
+//EDIT YOUR FirePHP LOCATION HERE
+// If using ZIP Archive
+//TODO: Add 'lib/' of extracted archive to include path
+require_once 'FirePHP/Init.php'; //Must be declared before log4php
+
+// If using PHAR Archive (php 5.3+)
+//require_once('phar://.../firephp.phar/FirePHP/Init.php');
+// TODO: Replace ----^^^
+
+
+
+require_once dirname(__FILE__).'/../../main/php/Logger.php';
+
+Logger::configure(dirname(__FILE__).'/../resources/appender_firephp.xml');
+
+?>
+<!-- RUN THIS FROM WEB DOCUMENT_ROOT (~/public_html/ or /var/www/) -->
+
+<h1>FirePHP appender test & configuration</h1>
+<h2>Requirements</h2>
+<ul>
+ <li>
+ <a href="http://logging.apache.org/log4php/">Apache log4php</a>
+ >= <b style="color:red;">v2.2.2</b>
+ </li>
+ <li>
+ <a href="http://getfirebug.com/">Mozilla Firebug</a> with
console & net enabled.
+ </li>
+ <li>
+ <a
href="http://sourcemint.com/github.com/firephp/firephp/1:1.0.0b1rc6/-docs/Welcome"
+ >FirePHP >= 1.0</a> (beta, as of March 2012) server lib
& Firefox plugin.
+ This one is also referred to as <i>Insight</i> or
<i>Developer's Companion</i>
+ </li>
+</ul>
+
+<h2>Untested (or not supported)</h2>
+<ul>
+ <li>Old versions of Mozilla Firefox</li>
+ <li>
+ Versions of FirePHP prior to <b>v1.0beta</b>!
+ Currently, this is the default at addons.mozilla.org !
+ </li>
+ <li>
+ <a
href="https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/FirePHPHandler.php"
+ >Monolog</a>
+ </li>
+ <li>*FirePHP* for Google Chrome</li>
+ <li>No other browser currently has a similar plugin</li>
+</ul>
+
+<h2>Instructions</h2>
+<ul>
+ <li>Install the requirements above, following their instructions</li>
+ <li>If you installed the phar package, edit its location at the top of
this file</li>
+ <li>Ensure this file has web server read permissions in
<code>DOCUMENT_ROOT</code></li>
+ <li>
+ Similarly, place <b style="color:red;">sample log4php.xml</b>
in the same directory
+ <small>(Note that log4php.xml runs LogggerAppenderFirephp at
debug level)</small>
+ </li>
+ <li>Optional: launch Developer Companion. Follow its instructions to
generate a key</li>
+ <li>Open the Firebug console (window), and enable <i>Console</i> &
<i>Net</i></li>
+ <li>Reload Firefox</li>
+ <li>
+ If the greeting in Firebug console displays with problems,
click on it,
+ to see a stack trace
+ </li>
+ <li>
+ Comment out <b><code>define('INSIGHT_DEBUG', true);</code></b>
at the top of
+ this file, to disable the notice:
+ <small style="border: 2px solid black; background-color: red;">
+ <span style="font-weight: bold;">[INSIGHT]</span>
Flushing headers
+ </small>
+ </li>
+</ul>
+
+<h2>If you see a greeting in Firebug, you can now return to work!</h2>
+
+<?php
+$log = Logger::getLogger('FirePhp_Example_Logger_Name');
+$log->debug('Congrats! Enjoy log4php with FirePHP!');
+
Added: logging/log4php/trunk/src/examples/resources/appender_firephp.xml
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/examples/resources/appender_firephp.xml?rev=1303551&view=auto
==============================================================================
--- logging/log4php/trunk/src/examples/resources/appender_firephp.xml (added)
+++ logging/log4php/trunk/src/examples/resources/appender_firephp.xml Wed Mar
21 20:15:40 2012
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- http://logging.apache.org/log4php/ -->
+
+<configuration xmlns="http://logging.apache.org/log4php/">
+ <appender name="firePhpAppender" class="LoggerAppenderFirephp">
+ <layout class="LoggerLayoutSimple" />
+ <param name="medium" value="page" />
+ </appender>
+ <appender name="consoleAppender" class="LoggerAppenderConsole" />
+
+ <root>
+ <level value="DEBUG" />
+ <appender_ref ref="firePhpAppender" />
+ <appender_ref ref="consoleAppender" />
+ </root>
+</configuration>
Propchange: logging/log4php/trunk/src/examples/resources/appender_firephp.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFirephp.php
URL:
http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFirephp.php?rev=1303551&r1=1303550&r2=1303551&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFirephp.php
(original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFirephp.php Wed
Mar 21 20:15:40 2012
@@ -29,8 +29,6 @@
* @since Feb 22, 2012
* @internal CodeSniffs as PEAR style, adapted to Apache. Phpmd clean.
* @example require_once 'FirePHP/Init.php'; //Must be declared before
log4php
- * @example use Monolog/Logger; //Alternate to
firephp lib
- * @example use Monolog/Handler/FirePHPHandler;
*/
/**