Force the roll of LoggerAppenderRollingFile
I am using log4php to log some activities in my application.开发者_JAVA技巧
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 a datePattern
, which accepts any parameter that is valid for the date()
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.
精彩评论