停用PHP错误日志记录

时间:2016-02-06 19:02:48

标签: php logging compiler-errors xampp reporting

我刚刚注意到,我在XAMPP中获得的所有PHP错误都存储在日志中,该日志的大小已经为500 MB。我现在想要停用日志记录,而不是在执行时实际停止报告。我怎么能做到这一点?

2 个答案:

答案 0 :(得分:1)

在php文件的顶部

long then = System.currentTimeMillis();
long now = System.currentTimeMillis();
System.out.println("Elapsed time: " + (now - then));

或在PHP.ini中:

ini_set('log_errors', 'off');

答案 1 :(得分:0)

    <?php

// Turn off all error reporting
error_reporting(0);

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);

// Report all PHP errors (see changelog)
error_reporting(E_ALL);

// Report all PHP errors
error_reporting(-1);

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);

?>