Log4g Reference Manual |
---|
IntroductionIntroduction — Getting started with Log4g |
Log4g is a GObject-based logging utility. The design of Log4g is based on a port of the popular Log4j 1.2 logging package. Log4j has been ported to many programming languages, including (but not limited to) C ++, Perl and Python. Log4g brings this functionality to the C/GLib/GObject programming stack.
For more information on what the Log4g API can do for you, refer to the articles in the references section of this document.
The core components of Log4g are loggers, appenders and layouts.
Log4g elements (i.e. appenders, layouts and filters) are configured via GObject properties. For a summary of the properties available to each element refer to the API documentation.
Loggers are the central object in the Log4g package.
Loggers are arranged in a named hierarchy. The naming convention used by Log4g is to separate logger "classes" with a dot (.). For example, the logger named "org.gnome" is an ancestor of the logger named "org.gnome.foo". Loggers can inherit the appenders of their ancestors. This means that any events logged to the logger named "org.gnome.foo" will also be logged to the appenders of "org.gnome". This property is known as logger additivity. By default all loggers are additive. This property can be disabled via a configuration file (the additivity property of loggers) or with log4g_logger_set_additivity().
Appenders determine how events are logged.
Log4g ships with the following appenders:
Asynchronous appender
Console appender
File appender
Rolling file appender
Syslog appender
Layouts determine the format of an event before it is logged by an appender.
Log4g ships with the following layouts:
HTML layout
Pattern layout
Simple layout
TTCC layout
XML layout
Log4g has builtin filtering rules, however custom filtering is also possible through the use of filters.
Log4g ships with the following filters:
Deny all filter
Level match filter
Level range filter
String match filter
Log4g must be initialized before it can be used in an application. The documentation for log4g_init() & log4g_get_option_group() provides some initialization and usage examples.
See: The Log4g core API (log4g/log4g.h)
Ceki Gulcu and the developers of Log4j. This work is entirely based upon their effort.
The GLib/GObject development team for their fantastic work.
Copyright 2010 Michael Steinert
Log4g is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version.
Log4g is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with Log4g. If not, see http://www.gnu.org/licenses/.