Modules

optivo.common.log4lua.appenders.console Console appender.
optivo.common.log4lua.appenders.file File appender.

Log rotation

Optionally the appender can be created with a date pattern to enable log file rotation.
optivo.common.log4lua.appenders.smtp SMTP appender sending the log messages as an email.
This appender requires LuaSocket.
optivo.common.log4lua.logger Logging facility.
A logger consists of a category (to distinct different modules etc.) and an appender which actually writes the message (to console, file etc.)

Configuration

A sample configuration file looks like this:
local logger = require("optivo.common.log4lua.logger")
local console = require("optivo.common.log4lua.appenders.console")
local file = require("optivo.common.log4lua.appenders.file")
local config = {}

-- ROOT category must be configured.
config["ROOT"] = logger.Logger.new(console.new(), "ROOT", logger.FATAL)
config["foo"] = logger.Logger.new(file.new("foo-%s.log", "%Y-%m-%d"), "foo", logger.INFO)
config["bar"] = logger.Logger.new(file.new("bar.log", nil, "%LEVEL: %MESSAGE\n"), "bar", logger.INFO)

-- The config table must be returned.
return config

Then you can load this configuration file "by hand" calling loadConfig(fileName) or you can set a default configuration file using the environment variable LOG4LUA_CONFIG_FILE.

Files

/tmp/svntemp/hscale/src/optivo/common/log4lua/appenders/console.lua
/tmp/svntemp/hscale/src/optivo/common/log4lua/appenders/file.lua
/tmp/svntemp/hscale/src/optivo/common/log4lua/appenders/smtp.lua
/tmp/svntemp/hscale/src/optivo/common/log4lua/logger.lua

Valid XHTML 1.0!