fuelphp log file path and log file name change Summary of issues encountered

Without modifying the configuration file, which is the default, fuelphp log file is saved in the following path

 / Fuel / app / logs folders is fixed, YYYY / MM / DD.php is automatically generated based on the log generation time.

That is, by default, folders and MM YYYY If there is no will automatically generate

/fuel/app/logs/YYYY/MM/DD.php

 

 

If you want to change the location to save the log files that do not want to save / fuel / app / logs folder, and to save elsewhere, so long as the modifications log_path fuel / app / config / config.php in

    //'log_path'         => APPPATH.'logs/',
    'log_path'         => APPPATH.'logs/batch',     //①
   // 'log_path'         => APPPATH.'logs/'.date('Y/m').DS, // ②

 

Note: If you want to modify log_path, we must ensure that the specified path to exist, otherwise it will error

My mistakes as ②, the specified path is changed over time, once the year or month changes, the specified path does not exist, it will error

 

If you want to change the file name or extension, it would have to amend log_file.

'Log_file' => date ( 'd'). '. Log', // the form of "DD.php"

Note: log_file without modification, and it is by default, fuelphp will automatically generate MM YYYY folders and folders, and DD.php log files in the specified path log_path

But once modified log_file, it will no longer automatically generates MM YYYY folders and folders, but generate the corresponding files and folders in accordance with the manner specified

'log_file' => date ( ' d'). '. log', // In this case, only the form of generating DD.log log files without generating a folder, if both want to change the file name, and and the like and generating YYYY MM folder by default, may be provided as 
'log_file' => date ( ' Y / m'). DS.date ( 'd'). '. log', // this case It will generate the appropriate folders specified paths

  

 

My demand is just change the extension of the log file that DD.php changed DD.log

Initial amended as follows

    'log_file'         => date('d').'.log',   // "DD.php" という形式
   'log_path'         => APPPATH.'logs/'.date('Y/m').DS, // APPPATH/YYYY/MM/  

Results after Rigid nothing wrong, the result becomes a month on the error, the reason as described above, after the month has changed, log_path, specified path does not exist.

The correct fix is ​​as follows, in fact, you can simply modify the log_file, just to add changes before the file name path name

    'log_file'         => date('Y/m').DS.date('d').'.log',   // "DD.php" という形式
   // 'log_path'         => APPPATH.'logs'.DS, // APPPATH/YYYY/MM/

  

Summary: The fixed portion of the path set log_path, change the settings section log_file. log_file will not only set the file name, you can also set the path to save the latter part of the file

log_path requirements specified path must exist, not automatically generated, the error will be absent

log_file requirements specified path does not have to exist, if there will be generated automatically just log_file specified path will be saved under the save path of log_path

 

Guess you like

Origin www.cnblogs.com/gaoBlog/p/11422999.html