## Class LoggerAppenderDailyFile

Description

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 http://www.php.net/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.

- version: $Revision: 1382274 $
- link: Appender documentation
- license: Apache License, Version 2.0

Located in /log4php/appenders/LoggerAppenderDailyFile.php (line 43)

    LoggerConfigurable
       |
       --LoggerAppender
          |
          --LoggerAppenderFile
             |
             --LoggerAppenderDailyFile

Variable Summary
string $currentDate
string $datePattern
Method Summary
void activateOptions ()
void append (LoggerLoggingEvent $event)
void getDate ([ $timestamp = null])
string getDatePattern ()
void getTargetFile ()
void setDatePattern (string $datePattern)
Variables
string $currentDate (line 57)

Current date which was used when opening a file.

Used to determine if a rollover is needed when the date changes.

- access: protected

string $datePattern = "Ymd" (line 50)

The 'datePattern' parameter.

Determines how date will be formatted in file name.

- access: protected

#### Inherited Variables

Inherited from LoggerAppenderFile

> LoggerAppenderFile::$append
> LoggerAppenderFile::$file
> LoggerAppenderFile::$fp
> LoggerAppenderFile::$locking

Inherited from LoggerAppender

> LoggerAppender::$closed
> LoggerAppender::$filter
> LoggerAppender::$layout
> LoggerAppender::$name
> LoggerAppender::$requiresLayout
> LoggerAppender::$threshold

Methods
activateOptions (line 60)

Additional validation for the date pattern.

- access: public

void activateOptions ()

Redefinition of:

LoggerAppenderFile::activateOptions()

append (line 77)

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.

- access: public

void append (LoggerLoggingEvent $event)

- LoggerLoggingEvent $event

Redefinition of:

LoggerAppenderFile::append()

getDate (line 104)

Renders the date using the configured

- access: protected

void getDate ([ $timestamp = null])

- $timestamp

getDatePattern (line 127)

Returns the 'datePattern' parameter.

- access: public

string getDatePattern ()
getTargetFile (line 111)

Determines target file. Replaces %s in file path with a date.

- access: protected

void getTargetFile ()

Redefinition of:

LoggerAppenderFile::getTargetFile()
  Helper function which can be easily overriden by daily file appender.

setDatePattern (line 119)

Sets the 'datePattern' parameter.

- access: public

void setDatePattern (string $datePattern)

- string $datePattern

#### Inherited Methods

Inherited From LoggerAppenderFile

> LoggerAppenderFile::activateOptions()
> LoggerAppenderFile::append()
> LoggerAppenderFile::close()
> LoggerAppenderFile::getAppend()
> LoggerAppenderFile::getFile()
> LoggerAppenderFile::getFileName()
> LoggerAppenderFile::getTargetFile()
> LoggerAppenderFile::openFile()
> LoggerAppenderFile::setAppend()
> LoggerAppenderFile::setFile()
> LoggerAppenderFile::setFileName()
> LoggerAppenderFile::write()
> LoggerAppenderFile::writeWithLocking()
> LoggerAppenderFile::writeWithoutLocking()

Inherited From LoggerAppender

> LoggerAppender::__construct()
> LoggerAppender::activateOptions()
> LoggerAppender::addFilter()
> LoggerAppender::append()
> LoggerAppender::clearFilters()
> LoggerAppender::close()
> LoggerAppender::doAppend()
> LoggerAppender::getDefaultLayout()
> LoggerAppender::getFilter()
> LoggerAppender::getFirstFilter()
> LoggerAppender::getLayout()
> LoggerAppender::getName()
> LoggerAppender::getThreshold()
> LoggerAppender::isAsSevereAsThreshold()
> LoggerAppender::requiresLayout()
> LoggerAppender::setLayout()
> LoggerAppender::setName()
> LoggerAppender::setThreshold()
> LoggerAppender::warn()
> LoggerAppender::__destruct()

Inherited From LoggerConfigurable

> LoggerConfigurable::setBoolean()
> LoggerConfigurable::setFileSize()
> LoggerConfigurable::setInteger()
> LoggerConfigurable::setLevel()
> LoggerConfigurable::setNumeric()
> LoggerConfigurable::setPositiveInteger()
> LoggerConfigurable::setString()
> LoggerConfigurable::warn()

Documentation generated on Wed, 12 Nov 2025 18:40:31 +0900 by phpDocumentor 1.4.4