开发者

Force the roll of LoggerAppenderRollingFile

开发者 https://www.devze.com 2023-04-11 18:48 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号