# Class LoggerAppenderDailyFile

An Appender that automatically creates a new logfile each day.

The file is rolled over once a day. That means, for each day a new file is created. A formatted version of the date pattern is used as to create the file name using the PHP_MANUAL#sprintf function.

This appender uses a layout.

# Configurable parameters:

- datePattern - Format for the date in the file path, follows formatting rules used by the PHP date() function. Default value: "Ymd".
- file - Path to the target file. Should contain a %s which gets substituted by the date.
- append - If set to true, the appender will append to the file, otherwise the file contents will be overwritten. Defaults to true.

  LoggerConfigurable
  LoggerAppender
  LoggerAppenderFile
  LoggerAppenderDailyFile

Package: log4php\appenders
License: Apache License, Version 2.0
Version: $Revision: 1382274 $
Link: Appender documentation
Located at appenders/LoggerAppenderDailyFile.php

Methods summary
`public` | # `activateOptions( )` Additional validation for the date pattern. Additional validation for the date pattern.

#### Overrides

`LoggerAppenderFile::activateOptions()`
`public` | # `append( `LoggerLoggingEvent` $event )` Appends a logging event. Appends a logging event. If the target file changes because of passage of time (e.g. at midnight) the current file is closed. A new file, with the new date, will be opened by the write() method.

#### Parameters

$event
  ``LoggerLoggingEvent``
  $event

#### Overrides

`LoggerAppenderFile::append()`
`protected` | # `getDate( mixed $timestamp = null )` Renders the date using the configured datePattern. Renders the date using the configured datePattern.
`protected` | # `getTargetFile( )` Determines target file. Replaces %s in file path with a date. Determines target file. Replaces %s in file path with a date.

#### Overrides

`LoggerAppenderFile::getTargetFile()`
`public` | # `setDatePattern( string $datePattern )` Sets the 'datePattern' parameter. Sets the 'datePattern' parameter.

#### Parameters

$datePattern
  `string`
  $datePattern

`public string` | # `getDatePattern( )` Returns the 'datePattern' parameter. Returns the 'datePattern' parameter.

#### Returns

`string`

Methods inherited from LoggerAppenderFile
`close(), getAppend(), getFile(), openFile(), setAppend(), setFile(), write(), writeWithLocking(), writeWithoutLocking()`

Methods inherited from LoggerAppender
`__construct(), __destruct(), addFilter(), clearFilters(), doAppend(), getDefaultLayout(), getFilter(), getFirstFilter(), getLayout(), getName(), getThreshold(), isAsSevereAsThreshold(), requiresLayout(), setLayout(), setName(), setThreshold(), warn()`

Methods inherited from LoggerConfigurable
`setBoolean(), setFileSize(), setInteger(), setLevel(), setNumeric(), setPositiveInteger(), setString()`

Properties summary
`protected string` | $datePattern | `"Ymd"` | # The 'datePattern' parameter. Determines how date will be formatted in file name. The 'datePattern' parameter. Determines how date will be formatted in file name.
`protected string` | $currentDate | `` | # Current date which was used when opening a file. Used to determine if a rollover is needed when the date changes. Current date which was used when opening a file. Used to determine if a rollover is needed when the date changes.

Properties inherited from LoggerAppenderFile
`$append, $file, $fp, $locking`

Properties inherited from LoggerAppender
`$closed, $filter, $layout, $name, $requiresLayout, $threshold`