Home > Backend Development > PHP Tutorial > php-log4php (转)

php-log4php (转)

WBOY
Release: 2016-06-23 14:36:28
Original
981 people have browsed it

最近研究php的log日志,发现log4php很好用。是扩展的java的log4j。废话不多说上代码。       在官网下载最新版本(http://logging.apache.org/log4php/download.html)       将src/main/php考到自己工程目录下       创建log4php.properties配置文件,内容如下       log4php.appender.default = LoggerAppenderDailyFile       log4php.appender.default.layout = LoggerLayoutPattern       #log4php.appender.default.layout.ConversionPattern = "%d{ISO8601} [%p] %c: %m (at %F line %L)%n"      log4php.appender.default.layout.ConversionPattern = "%d{Y-m-d H:m:s},%m%n"      log4php.appender.default.datePattern = Ymd       log4php.appender.default.file = E:/%s.log       log4php.rootLogger = INFO, default      新建一个php测试文件开始用了:代码如下       require_once 'php/Logger.php';       Logger::configure('log4php.properties');             $logger = Logger::getRootLogger();       $logger->info("Hello World!111");             ok,日志功能添加完毕。   

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template