LoggerAppenderDailyFileLoggerAppenderDailyFile writes logging events to a file. The file is rolled over once a day. In other words, for each day a new file is created. The path specified in the file parameter string should contain the string %s which will be substituted with the current date when logging. The datePattern parameter determines how the date will be formatted. LayoutThis appender requires a layout. If no layout is specified in configuration, LoggerLayoutSimple will be used by default. ParametersThe following parameters are available:
ExamplesThis example shows how to configure LoggerAppenderDailyFile. The date pattern used is Y-m-d which will result in filenames similar to file-2011-10-01.log.
<configuration xmlns="http://logging.apache.org/log4php/"> <appender name="default" class="LoggerAppenderDailyFile"> <layout class="LoggerLayoutTTCC" /> <param name="file" value="file-%s.log" /> <param name="datePattern" value="Y-m-d" /> </appender> <root> <appender_ref ref="default" /> </root> </configuration> array( 'appenders' => array( 'default' => array( 'class' => 'LoggerAppenderDailyFile', 'layout' => array( 'class' => 'LoggerLayoutTTCC', ), 'params' => array( 'datePattern' => 'Y-m-d', 'file' => 'file-%s.log', ), ), ), 'rootLogger' => array( 'appenders' => array('default'), ), ); |