log4php Configuration File Example

Source: Internet
Author: User
log4php configuration File Instance
Recently a project intends to introduce log4php as a project log system, but found that the official explanation of the configuration file is too broad, not good understanding, engaged for two hours, a more flexible configuration file, share to everyone, the overall structure is as follows:
File name: product.cam.properties
File contents:
Log4php.threshold = Warnlog4php.rootlogger = WARN, Defaultlog4php.appender.default = LoggerAppenderDailyFilelog4php.appender.default.layout = LoggerLayoutPatternlog4php.appender.default.layout.ConversionPattern = "%d{iso8601} [%p]%c:%m (at%F line%l)%n" Log4php.appender.default.datePattern = Ymdlog4php.appender.default.file =/app/logs/products/cam/%s.log


This makes it easy to configure different configurations for each product or module by creating multiple profiles, and of course the resulting log directory can be managed flexibly.

The call is as follows:
Include_once (' log4php/logger.php '); Logger::configure ("Product.cam.properties"); $logger = Logger::getlogger (' cam ');
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.