我见过有关Codeigniter错误日志记录的其他文章(here),但我的问题有点不同。出于某种原因,我所有的日志文件都被保存为.php
,我无法找到代码的哪一部分导致这种情况发生。我在回购本身和大量的谷歌搜索方面做了相当广泛的搜索,但看不到任何异乎寻常的东西。如何在Codeigniter中更改日志文件扩展名
在此先感谢。
我见过有关Codeigniter错误日志记录的其他文章(here),但我的问题有点不同。出于某种原因,我所有的日志文件都被保存为.php
,我无法找到代码的哪一部分导致这种情况发生。我在回购本身和大量的谷歌搜索方面做了相当广泛的搜索,但看不到任何异乎寻常的东西。如何在Codeigniter中更改日志文件扩展名
在此先感谢。
您可以更改application/config/config.php
。请找到下面的提及代码并设置您的自定义扩展。
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
您还可以生成日志取决于您的要求,如下所述。
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;
设置自定义目录以保存您的日志文件。
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
这将用于设置日志文件的权限。
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
这将用于为每个日志条目设置日期格式。
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
我希望这会帮助你。
打开文件/application/config/config.php
并搜索$config['log_file_extension']
。 用您最喜欢的扩展名填写空值。
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
如果您将所有这些文件都存放在您自己的PC上(我假设您这样做),请尝试搜索包含'.php'的所有文件。最好的,我可以提供。 –
所以我可以找到所有的日志文件,我只需要大量重命名它们以从最后删除'.php'。我不知道在代码中会发生什么,因为我的其他Code Igniter应用程序没有这样做。 –