~~ 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. ------ Apache log4php usage example ------ ------ ------ Apache Log4php Usage Example"> +-- logger =& LoggerManager::getLogger('Test'); } function testLog() { $this->logger->debug('this is a DEBUG log generated by Test::testLog() class'); $this->logger->info('this is an INFO log generated by Test::testLog() class'); $this->logger->warn('this is a WARN log generated by Test::testLog() class'); $this->logger->error('this is an ERROR log generated by Test::testLog() class'); $this->logger->fatal('this is a FATAL log generated by Test::testLog() class'); } } class TestTest extends Test { var $logger; function TestTest() { $this->Test(); $this->logger =& LoggerManager::getLogger('Test.Test'); } function testLog() { LoggerNDC::push('NDC generated by TestTest::testLog()'); $this->logger->debug('this is a DEBUG log generated by TestTest::testLog() class'); $this->logger->info('this is an INFO log generated by TestTest::testLog() class'); $this->logger->warn('this is a WARN log generated by TestTest::testLog() class'); $this>->logger->error('this is an ERROR log generated by TestTest::testLog() class'); $this->logger->fatal('this is a FATAL log generated by TestTest::testLog() class'); LoggerNDC::pop(); } } function Bar() { $logger =& LoggerManager::getLogger('bar'); /* note that the message here is an array */ $logger->debug(array('one', 'two', 'tree')); $logger->info('this is an INFO log generated by Bar() function'); $logger->warn('this is a WARN log generated by Bar() function'); $logger->error('this is an ERROR log generated by Bar() function'); $logger->fatal('this is a FATAL log generated by Bar() function'); } $logger =& LoggerManager::getLogger('main'); $logger->debug('this is a DEBUG log generated by main() function'); $logger->info('this is an INFO log generated by main() function'); $logger->warn('this is a WARN log generated by main() function'); $logger->error('this is an ERROR log generated by main() function'); $logger->fatal('this is a FATAL log generated by main() function') $test = new Test(); $test->testLog(); $testTest = new TestTest(); $testTest->testLog(); Bar(); ?> +--