logbox.system.logging.appenders

Class FileAppender

lucee.Component
    extended by logbox.system.logging.AbstractAppender
      extended by logbox.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 lockName
          The default lock name.

    • access = public
    • returntype = any
    true false
    numeric lockTimeout
          The default lock timeout.

    • access = public
    • returntype = any
    25 true false
    any logFullpath
          The log file location.

    • access = public
    • returntype = any
    true false
    struct logListener
          Log Listener Queue.

    • 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 FileAppender append(any message)
         Append a message to the log file.
    private any ensureDefaultLogDirectory()
         Ensures the log directory.
    string getLockName()
    string getLockTimeout()
    string getLogFullpath()
    string getLogListener()
    FileAppender initLogLocation()
         Initialize the file log location if it does not exist.
    any logMessage(LogEvent logEvent)
         Write an entry into the appender.
    FileAppender onRegistration()
         Called upon registration.
    FileAppender removeLogFile()
         Remove the log file for this appender.
    any setLockName(any lockName)
    any setLockTimeout(numeric lockTimeout)
    any setLogFullpath(any logFullpath)
    any setLogListener(struct logListener)
    any startLogListener()
         Start the log listener so we can queue up the logging to alleviate for disk operations.
     
    Methods inherited from class logbox.system.logging.AbstractAppender
    $log, canLog, getColdbox, getCustomLayout, getHash, getInitialized, getLevelMax, getLevelMin, getName, getProperties, getProperty, getUtil, hasCustomLayout, isInitialized, onUnRegistration, out, propertyExists, setColdbox, setCustomLayout, setInitialized, setLevelMax, setLevelMin, setName, setProperties, setProperty, severityToString
     
    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

    lockName

    property any lockName

    The default lock name

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

    lockTimeout

    property numeric lockTimeout = [25]

    The default lock timeout

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

    logFullpath

    property any logFullpath

    The log file location

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

    logListener

    property struct logListener

    Log Listener Queue

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

    Method Detail

    append

    private FileAppender append(any message)

    Append a message to the log file

    Parameters:
    message - The target message

    ensureDefaultLogDirectory

    private any ensureDefaultLogDirectory()

    Ensures the log directory.


    getLockName

    public string getLockName()


    getLockTimeout

    public string getLockTimeout()


    getLogFullpath

    public string getLogFullpath()


    getLogListener

    public string getLogListener()


    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

    onRegistration

    public FileAppender onRegistration()

    Called upon registration

    Overrides:
    onRegistration in class AbstractAppender

    removeLogFile

    public FileAppender removeLogFile()

    Remove the log file for this appender


    setLockName

    public any setLockName(any lockName)

    Parameters:
    lockName

    setLockTimeout

    public any setLockTimeout(numeric lockTimeout)

    Parameters:
    lockTimeout

    setLogFullpath

    public any setLogFullpath(any logFullpath)

    Parameters:
    logFullpath

    setLogListener

    public any setLogListener(struct logListener)

    Parameters:
    logListener

    startLogListener

    public any startLogListener()

    Start the log listener so we can queue up the logging to alleviate for disk operations