logbox.system.logging.appenders

Class DBAppender

lucee.Component
    extended by logbox.system.logging.AbstractAppender
      extended by logbox.system.logging.appenders.DBAppender

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- A simple DB appender for MySQL, MSSQL, Oracle, PostgreSQL Properties: - dsn : the dsn to use for logging - table : the table to store the logs in - schema : which schema the table exists in (Optional) - columnMap : A column map for aliasing columns. (Optional) - autocreate : if true, then we will create the table. Defaults to false (Optional) - ensureChecks : if true, then we will check the dsn and table existence. Defaults to true (Optional) The columns needed in the table are - id : UUID - severity : string - category : string - logdate : timestamp - appendername : string - message : string - extrainfo : string If you are building a mapper, the map must have the above keys in it.

Class Attributes:
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Constructor Summary
    init(any name, [struct properties='[runtime expression]'], [any layout=''], [any levelMin='0'], [any levelMax='4'])
          Constructor.
    Method Summary
    private any checkColumnMap()
         Check a column map definition.
    any doRotation()
         Do the rotation.
    private any ensureTable()
         Verify or create the logging table.
    private any getDateTimeColumnType()
         Get db specific text column type.
    private any getDateTimeDBType()
         Get db specific date time column type.
    private any getTable()
         Return the table name with the schema included if found.
    private any getTextColumnType()
         Get db specific text column type.
    any logMessage(LogEvent logEvent)
         Write an entry into the appender.
    any onRegistration()
         Runs on registration.
    any rotationCheck()
         Rotation checks.
     
    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

    Method Detail

    checkColumnMap

    private any checkColumnMap()

    Check a column map definition

    Throws:
    DBAppender.InvalidColumnMapException

    doRotation

    public any doRotation()

    Do the rotation


    ensureTable

    private any ensureTable()

    Verify or create the logging table


    getDateTimeColumnType

    private any getDateTimeColumnType()

    Get db specific text column type


    getDateTimeDBType

    private any getDateTimeDBType()

    Get db specific date time column type


    getTable

    private any getTable()

    Return the table name with the schema included if found.


    getTextColumnType

    private any getTextColumnType()

    Get db specific text column type


    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 any onRegistration()

    Runs on registration

    Overrides:
    onRegistration in class AbstractAppender

    rotationCheck

    public any rotationCheck()

    Rotation checks