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 21:17:55 UTC
svn commit: r822444 - in /incubator/log4php/trunk/src/examples: php/
resources/
Author: chammers
Date: Tue Oct 6 19:17:55 2009
New Revision: 822444
URL: http://svn.apache.org/viewvc?rev=822444&view=rev
Log:
The rest of my changes to the examples dir.
Mostly added START SNIPPET: doxia" tags.
Modified:
incubator/log4php/trunk/src/examples/php/cache.php
incubator/log4php/trunk/src/examples/php/mdc.php
incubator/log4php/trunk/src/examples/php/ndc.php
incubator/log4php/trunk/src/examples/php/simple.php
incubator/log4php/trunk/src/examples/resources/cache.properties
incubator/log4php/trunk/src/examples/resources/configurator_php.php
incubator/log4php/trunk/src/examples/resources/configurator_xml.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/mdc.properties
incubator/log4php/trunk/src/examples/resources/ndc.properties
Modified: incubator/log4php/trunk/src/examples/php/cache.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/cache.php?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/cache.php (original)
+++ incubator/log4php/trunk/src/examples/php/cache.php Tue Oct 6 19:17:55 2009
@@ -1,37 +1,20 @@
<?php
-/**
- * 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.
- */
+// START SNIPPET: doxia
require_once dirname(__FILE__).'/../../main/php/Logger.php';
Logger::configure(dirname(__FILE__).'/../resources/cache.properties');
-$cache = '../../../target/examples/hierarchy.cache';
+$cache = 'target/examples/hierarchy.cache';
if(!file_exists($cache)) {
$dir = dirname($cache);
if(!is_dir($dir)) {
mkdir($dir, 0777, true);
}
- $hierarchy = Logger::getLoggerRepository();
- file_put_contents($cache, serialize($hierarchy));
+ $old_logger = Logger::getRootLogger();
+ file_put_contents($cache, serialize($old_logger));
}
-$hierarchy = unserialize(file_get_contents($cache));
-
-$logger = $hierarchy->getRootLogger();
+$logger = unserialize(file_get_contents($cache));
$logger->debug('Debug message from cached logger');
-?>
+// END SNIPPET: doxia
Modified: incubator/log4php/trunk/src/examples/php/mdc.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/mdc.php?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/mdc.php (original)
+++ incubator/log4php/trunk/src/examples/php/mdc.php Tue Oct 6 19:17:55 2009
@@ -1,24 +1,9 @@
<?php
-/**
- * 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.
- */
+// START SNIPPET: doxia
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");
-?>
+// END SNIPPET: doxia
Modified: incubator/log4php/trunk/src/examples/php/ndc.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/ndc.php?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/ndc.php (original)
+++ incubator/log4php/trunk/src/examples/php/ndc.php Tue Oct 6 19:17:55 2009
@@ -1,24 +1,15 @@
<?php
-/**
- * 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.
- */
+// START SNIPPET: doxia
require_once dirname(__FILE__).'/../../main/php/Logger.php';
-Logger::configure(dirname(__FILE__).'/../resources/mdc.properties');
+Logger::configure(dirname(__FILE__).'/../resources/ndc.properties');
$logger = Logger::getRootLogger();
-LoggerNDC::push('Context Message');
-$logger->debug("Testing NDC");
+
+LoggerNDC::push('conn=1234');
+$logger->debug("just received a new connection");
+LoggerNDC::push('client=ab23');
+$logger->debug("some more messages that can");
+$logger->debug("now related to a client");
LoggerNDC::pop();
-?>
+LoggerNDC::pop();
+$logger->debug("back and waiting for new connections");
+// END SNIPPET: doxia
Modified: incubator/log4php/trunk/src/examples/php/simple.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/php/simple.php?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/php/simple.php (original)
+++ incubator/log4php/trunk/src/examples/php/simple.php Tue Oct 6 19:17:55 2009
@@ -1,31 +1,14 @@
<?php
-/**
- * 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.
- */
+// START SNIPPET: doxia
require_once dirname(__FILE__).'/../../main/php/Logger.php';
class Log4phpTest {
-
- private $_logger;
+ private $_logger;
- public function Log4phpTest() {
+ public function __construct() {
$this->_logger = Logger::getLogger('Log4phpTest');
$this->_logger->debug('Hello!');
}
-
}
function Log4phpTestFunction() {
@@ -35,7 +18,4 @@
$test = new Log4phpTest();
Log4phpTestFunction();
-
-// Safely close all appenders with...
-Logger::shutdown();
-?>
+// END SNIPPET: doxia
Modified: incubator/log4php/trunk/src/examples/resources/cache.properties
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/cache.properties?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/cache.properties (original)
+++ incubator/log4php/trunk/src/examples/resources/cache.properties Tue Oct 6 19:17:55 2009
@@ -1,20 +1,5 @@
-; cache.properties
-;
-; 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.
-;
+; START SNIPPET: doxia
log4php.appender.default = LoggerAppenderEcho
log4php.appender.default.layout = LoggerLayoutSimple
log4php.rootLogger = DEBUG, default
+; END SNIPPET: doxia
Modified: incubator/log4php/trunk/src/examples/resources/configurator_php.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/configurator_php.php?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/configurator_php.php (original)
+++ incubator/log4php/trunk/src/examples/resources/configurator_php.php Tue Oct 6 19:17:55 2009
@@ -23,4 +23,4 @@
),
);
-?>
\ No newline at end of file
+?>
Modified: incubator/log4php/trunk/src/examples/resources/configurator_xml.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/configurator_xml.xml?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/configurator_xml.xml (original)
+++ incubator/log4php/trunk/src/examples/resources/configurator_xml.xml Tue Oct 6 19:17:55 2009
@@ -8,4 +8,4 @@
<level value="DEBUG" />
<appender_ref ref="default" />
</root>
-</log4php:configuration>
\ No newline at end of file
+</log4php:configuration>
Modified: 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=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/filter_levelmatch.xml (original)
+++ incubator/log4php/trunk/src/examples/resources/filter_levelmatch.xml Tue Oct 6 19:17:55 2009
@@ -1,21 +1,4 @@
<?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">
Modified: 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=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/filter_levelrange.xml (original)
+++ incubator/log4php/trunk/src/examples/resources/filter_levelrange.xml Tue Oct 6 19:17:55 2009
@@ -1,21 +1,4 @@
<?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">
Modified: incubator/log4php/trunk/src/examples/resources/mdc.properties
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/mdc.properties?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/mdc.properties (original)
+++ incubator/log4php/trunk/src/examples/resources/mdc.properties Tue Oct 6 19:17:55 2009
@@ -1,21 +1,6 @@
-; mdc.properties
-;
-; 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.
-;
+; START SNIPPET: doxia
log4php.appender.default = LoggerAppenderEcho
log4php.appender.default.layout = LoggerLayoutPattern
log4php.appender.default.layout.conversionPattern="%d{Y-m-d H:i:s} %-5p %c %X{username}: %m in %F at %L%n"
log4php.rootLogger = DEBUG, default
+; END SNIPPET: doxia
Modified: incubator/log4php/trunk/src/examples/resources/ndc.properties
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/examples/resources/ndc.properties?rev=822444&r1=822443&r2=822444&view=diff
==============================================================================
--- incubator/log4php/trunk/src/examples/resources/ndc.properties (original)
+++ incubator/log4php/trunk/src/examples/resources/ndc.properties Tue Oct 6 19:17:55 2009
@@ -1,21 +1,6 @@
-; ndc.properties
-;
-; 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.
-;
+; START SNIPPET: doxia
log4php.appender.default = LoggerAppenderEcho
log4php.appender.default.layout = LoggerLayoutPattern
log4php.appender.default.layout.conversionPattern="%d{Y-m-d H:i:s} %-5p %c %x: %m in %F at %L%n"
log4php.rootLogger = DEBUG, default
+; END SNIPPET: doxia