C++ Log4cxx Netbeans Technology

Apache log4cxx framework – Part One

I happened to work with Apache log4cxx, a logging framework for c++. This framework offers lot of capabilities from simply outputting a log message to console, writing to log files, socket streaming and database logging. Best thing that i love about this framework that it is Thread safe.


Apache log4cxx, You can download it here

Log4cxx comprises of three main parts,


1) Public Class Logger
– Top level entry point of Logger


2) Public Interface Appender
– Controlling the Output log operations
3) Public Abstract Class Layout
– Output format

Log Levels 
There  about 6 levels of Log Levels. They are; TRACE, DEBUG, INFO, WARN, ERROR, FATAL, also there we have another two levels, “ALL” and “OFF”.
When configuring you can setup the Log Levels according to the need of the Logger. The following image describes the Log Levels and Log level accessiblity.

Descriptions of each Level: 
DEBUG 
Informational logs that is useful to debug an application
INFO
Informational logs that are usefull to highlight the progress the application

WARN
Warning logs describing certain application specific other options
ERROR
Error logs describing events which causes application exceptions, but these exceptions are handled and the application can still run continously.

FATAL
Fatal logs describing events which cause severe error and leading to application exit.

Link Library to Netbeans Project
In your Netbeans projects, after the installation of Log4cxx, to link the static library to the project, use the following in the LDLIBSOPTIONS of make debug file.

-I/usr/include pathof(liblog4cxx.a) -lapr-1 -laprutil-1

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *