我見過有關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應用程序沒有這樣做。 –