I am using log4php to log some activities in my application.
I want the log file will be rolled once every X time and not only once a day / when it reach to a certain size.
Is there a way of doing that?
Is there a way to force the log to roll at certain time?
If not, some one know another good logger (open source preferred) I can use.
By using the
LoggerAppenderDailyFile
, you can specify adatePattern
, which accepts any parameter that is valid for thedate()
function as well. Whenever the date pattern changes, you'll get a new file created.Including seconds in the pattern will create a new logfile every second (but only if log output is created).
There is also the option of dynamically change the configuration. You can pass a php array to the
Logger::configure()
call and setup the filename inside behaving like you want.