如何禁用CodeIgniter中的日志记录?如何在Codeigniter中禁用日志记录?
我的应用程序有3个应用程序,我的前2个应用程序的日志被写入公共日志目录。所以维护日志文件已变得困难。
所以,请帮助我在我的应用程序的其他优先位置写入日志,或帮助我禁用日志记录。
如何禁用CodeIgniter中的日志记录?如何在Codeigniter中禁用日志记录?
我的应用程序有3个应用程序,我的前2个应用程序的日志被写入公共日志目录。所以维护日志文件已变得困难。
所以,请帮助我在我的应用程序的其他优先位置写入日志,或帮助我禁用日志记录。
记录可以为每个应用程序进行配置,但是在
/application/config.php
的完成有问题的设置是$config['log_path']
。
如果要禁用日志记录,该阈值设置为0:
$config['log_threshold'] = 0;
但我不知道一点,如果你有三个应用程序,为什么他们登录到同一日志文件夹。每个应用程序应该有它自己的日志文件夹。
采取index.php
看看为每个应用程序:
/*
* -------------------------------------------------------------------
* CUSTOM CONFIG VALUES
* -------------------------------------------------------------------
*
* The $assign_to_config array below will be passed dynamically to the
* config class when initialized. This allows you to set custom config
* items or override any default config values found in the config.php file.
* This can be handy as it permits you to share one application between
* multiple front controller files, with each file containing different
* config values.
*
* Un-comment the $assign_to_config array below to use this feature
*
*/
// $assign_to_config['name_of_config_item'] = 'value of config item';
我从来没有亲自使用这一点,但它似乎表明,每个单独的应用程序可以使用config.php
共享应用程序重写设置。所以,你应该能够做这样的事情在每个单独的索引文件:
$assign_to_config['log_threshold'] = 0;
// OR
$assign_to_config['log_path'] = 'app3/logs/';
试试这个
$this->log->enable_logging(FALSE);
error_reporting(0);