Back to all posts
C++Log4cxxNetbeansTechnology

Apache log4cxx framework – Part One

SathishOctober 11, 2010
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 is that it is Thread safe.

Apache log4cxx can be downloaded from the official Apache website.

Log4cxx comprises of three main parts

  • **Public Class Logger** – Top level entry point of Logger
  • **Public Interface Appender** – Controlling the Output log operations
  • **Public Abstract Class Layout** – Output format

Log Levels

There are about 6 levels of Log Levels. They are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Also there are two additional levels: "ALL" and "OFF".

When configuring you can setup the Log Levels according to the need of the Logger.

Descriptions of each Level:

  • **DEBUG** – Informational logs that are useful to debug an application
  • **INFO** – Informational logs that are useful to highlight the progress of the application
  • **WARN** – Warning logs describing certain application specific other options
  • **ERROR** – Error logs describing events which cause application exceptions, but these exceptions are handled and the application can still run continuously
  • **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.

text
-I/usr/include pathof(liblog4cxx.a) -lapr-1 -laprutil-1
0claps
Share this post

Comments

Protected by reCAPTCHA v3

No comments yet. Be the first to comment.