By changing /Cake/Log/Engine/Filelog.php's write function I can change "error.log" and "debug.log" file names.
Is there any way to change these file names without hacking CakePHP 2 core files.
By changing /Cake/Log/Engine/Filelog.php's write function I can change "error.log" and "debug.log" file names.
Is there any way to change these file names without hacking CakePHP 2 core files.
As of CakePHP 2.4.0 this feature is added: http://bakery.cakephp.org/articles/markstory/2013/08/30/cakephp_2_4_0_is_ready
FileLogs can now have a max size and simple rotation configured.
Filelog class has file size limit and number of files to rotate.
In your comment above, you said that the reason you're wanting to change the names of these log files is because the files in question have no size limitations. The thing is: If you have an error log that is 2MB in size, then you've clearly got bigger fish to fry. As far as I know, there is no way to change those file names without hacking the core. If you're really worried about the size of those two log files, then you could setup a cronjob that checks the size of those two files every 24 hours. If the log file size is bigger than the predetermined limit that you've set, you could send an alert email to yourself. To be honest: The best approach to take is to test your application extensively beforehand so that any entry in those two files becomes a surprise instead of a routine.
In CakePHP 2 you can change same configuration in /app/config/bootstrap.php:
CakeLog::config('debug', array(
'engine' => 'File',
'types' => array('notice', 'info', 'debug'),
'file' => 'debug',
));
CakeLog::config('error', array(
'engine' => 'File',`enter code here`
'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
'file' => 'error',
));
CakeLog::write('my_log', 'message');and cake will create a log file calledmy_log)