Dynamiv Yii logFilename

Hi all

Can i append the current date to the yii logfile ?

for example application.log be application.log.2011-04-18

and each day it should take the date from the system.

Thanks in advance

A job like this is probably best handled by logrotate

http://linuxcommand.org/man_pages/logrotate8.html

Should also work with a log route setup like:




array(

    'class'=>'CFileLogRoute',

    'logFile'=>'application.log.'.date('Y-m-d'),

),

is this mean that every day a new file will be created?

Yes, as long as the date changes with every day (which is the case in our part of the universe… ;) ).

I mean the log file name maybe will be cached ,so yii will not get the logFile property each time a log

statement called.

How we can force the Yii to get the logFile property(if its really stored in cache) only every new day ?

No. The statement above is called once per request, when the log files are written (this happens onEndRequest).

Thanks man this work,

for testing and not changing my system date or wait a whole day i used


array(

    'class'=>'CFileLogRoute',

    'logFile'=>'application.log.'.date('Y-m-d s'),

),

:)

hello … I want to make a daily log. how to set: setMaxFileSize() << unlimited

You can’t. Just use a high enough value to never reach this limit.