DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Changing the log to daily in CakePHP 3.x
Mohammed Samgan Khan
Mohammed Samgan Khan

Posted on • Originally published at codebysamgan.com

Changing the log to daily in CakePHP 3.x

As you may know according to the default configuration of CakePHP the debug and error log is generated in the same file. But this can be changed in a few simple steps. All you have to do is following.

  1. Got to config/app.php
  2. Find the β€˜Log’ configuration array
  3. In both debug and error replace the β€˜file’ with β€œβ€™debug-β€˜ . date(β€˜Y-m-d’),” and β€œβ€™error-β€˜ . date(β€˜Y-m-d’),” respectively
  4. Save the file and you are good to go.

Now, the log will be generated on a daily basis.

Top comments (3)

Collapse
 
msamgan profile image
Mohammed Samgan Khan

thanks, Ankush. I also shifted to laravel quite some time ago. This was my work when I use to work on CakePHP. I have also created a CakePHP plugin for smooth log reading. Here is the link. I am thinking of putting an article about it in a day or two.

BTW thanks again.

Collapse
 
elcotu profile image
Daniel Coturel

Good post.
Aguante CakePHP.

Top Heroku Alternatives (For Free)

>> Check out this classic DEV post <<