coldbox.system.logging.appenders

Class FileAppender

lucee.Component
    extended by coldbox.system.logging.AbstractAppender
      extended by coldbox.system.logging.appenders.FileAppender
Direct Known Subclasses:
RollingFileAppender

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- An appender that leverages the OS file system Properties: - filepath : The location of where to store the log file. - autoExpand : Whether to expand the file path or not. Defaults to true. - filename : The name of the file, if not defined, then it will use the name of this appender. Do not append an extension to it. We will append a .log to it. - fileEncoding : The file encoding to use, by default we use ISO-8859-1;

Class Attributes:
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    any logFullpath
          The log file location.

    • access = public
    • returntype = any
    true false
    Constructor Summary
    init(any name, [struct properties='[runtime expression]'], [any layout=''], [any levelMin='0'], [any levelMax='4'])
          Constructor.
    Method Summary
    private any ensureDefaultLogDirectory()
         Ensures the log directory.
    string getLogFullpath()
    FileAppender initLogLocation()
         Initialize the file log location if it does not exist.
    any logMessage(LogEvent logEvent)
         Write an entry into the appender.
    any onLogListenerEnd(struct queueContext)
         Fired once the listener stops queue processing.
    any onLogListenerSleep(struct queueContext)
         Fired once the listener will go to sleep.
    any onLogListenerStart(struct queueContext)
         Fired once the listener starts queue processing.
    FileAppender onRegistration()
         Called upon registration.
    any processQueueElement(any data, any queueContext)
         Processes a queue element to a destination.
    FileAppender removeLogFile()
         Remove the log file for this appender.
    any setLogFullpath(any logFullpath)
    any shutdown()
         Process a shutdown!.
     
    Methods inherited from class coldbox.system.logging.AbstractAppender
    $log, canLog, err, getColdbox, getCustomLayout, getHash, getInitialized, getLevelMax, getLevelMin, getLockTimeout, getLogBox, getLogListener, getName, getProperties, getProperty, getUtil, getWirebox, hasCustomLayout, isInitialized, lock, onUnRegistration, out, propertyExists, queueMessage, runLogListener, setColdbox, setCustomLayout, setInitialized, setLevelMax, setLevelMin, setLockTimeout, setLogBox, setLogListener, setName, setProperties, setProperty, setWirebox, severityToString, startLogListener
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init(any name, [struct properties='[runtime expression]'], [any layout=''], [any levelMin='0'], [any levelMax='4'])

    Constructor

    Parameters:
    name - The unique name for this appender.
    properties - A map of configuration properties for the appender"
    layout - The layout class to use in this appender for custom message rendering.
    levelMin - The default log level for this appender, by default it is 0. Optional. ex: LogBox.logLevels.WARN
    levelMax - The default log level for this appender, by default it is 5. Optional. ex: LogBox.logLevels.WARN

    Property Detail

    logFullpath

    property any logFullpath

    The log file location

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    ensureDefaultLogDirectory

    private any ensureDefaultLogDirectory()

    Ensures the log directory.


    getLogFullpath

    public string getLogFullpath()


    initLogLocation

    public FileAppender initLogLocation()

    Initialize the file log location if it does not exist. Please note that if exceptions are detected, then we log them in the CF facilities


    logMessage

    public any logMessage(LogEvent logEvent)

    Write an entry into the appender. You must implement this method yourself.

    Overrides:
    logMessage in class AbstractAppender
    Parameters:
    logEvent - The logging event to log

    onLogListenerEnd

    public any onLogListenerEnd(struct queueContext)

    Fired once the listener stops queue processing

    Overrides:
    onLogListenerEnd in class AbstractAppender
    Parameters:
    queueContext - A struct of data attached to this processing queue thread

    onLogListenerSleep

    public any onLogListenerSleep(struct queueContext)

    Fired once the listener will go to sleep

    Overrides:
    onLogListenerSleep in class AbstractAppender
    Parameters:
    queueContext - A struct of data attached to this processing queue thread

    onLogListenerStart

    public any onLogListenerStart(struct queueContext)

    Fired once the listener starts queue processing

    Overrides:
    onLogListenerStart in class AbstractAppender
    Parameters:
    queueContext - A struct of data attached to this processing queue thread

    onRegistration

    public FileAppender onRegistration()

    Called upon registration

    Overrides:
    onRegistration in class AbstractAppender

    processQueueElement

    public any processQueueElement(any data, any queueContext)

    Processes a queue element to a destination This method is called by the log listeners asynchronously.

    Overrides:
    processQueueElement in class AbstractAppender
    Parameters:
    data - The data element the queue needs processing
    queueContext - The queue context in process
    Returns:
    ConsoleAppender

    removeLogFile

    public FileAppender removeLogFile()

    Remove the log file for this appender


    setLogFullpath

    public any setLogFullpath(any logFullpath)

    Parameters:
    logFullpath

    shutdown

    public any shutdown()

    Process a shutdown!

    Overrides:
    shutdown in class AbstractAppender