0

How to direct logs to multiple log files (destinations) – log4cpp

Posted by Joys of Programming on January 15, 2010 in C/C++

log4cpp can not only be used to log the events to a log file or standard output, but also helps you to log events to multiple destinations. For this purpose, either you can add multiple appenders to a single category or make use of multiple Categories. We will explore the first options. With this option, [...]

Tags: , , , , , , , , , , ,

 
0

log4cpp: Logging Events and Priorities

Posted by Joys of Programming on January 14, 2010 in C/C++

The most important aspect of a log message is its priority. Take a simple scenario, when you are debugging your program, you want to display all the logs in your program. At that moment, you are not concerned about the resource crunch and performance impact. But when your program is running, you do not want [...]

Tags: , , , , , , , , ,

 
0

log4cpp Category

Posted by Joys of Programming on January 14, 2010 in C/C++

Every log message has a priority. But depending on the scenario we decide whether we need to log a message or not. Like every message has a priority, similarly every scenario has a priority. We have the following priorities arranged in the descending order. EMERG, FATAL ALERT CRIT ERROR WARN NOTICE INFO DEBUG NOTSET (no [...]

Tags: , , , , , , , ,

 
0

log4cpp::PatternLayout – Available log4cpp log formats

Posted by Joys of Programming on January 14, 2010 in C/C++

log4cpp supports three layouts: Simple Layout, Basic Layout and PatternLayout. Simple and Basic Layout are the simplest ones and you need not configure them in any way. The display the log in a fixed format. log4cpp::PatternLayout has the additional advantage that it supports four different formats and provides a mechanism to create a format of [...]

Tags: , , , ,

 
0

log4cpp::SimpleLayout – A Simple Layout for log4cpp logs

Posted by Joys of Programming on January 13, 2010 in C/C++

log4cpp supports three different Layouts, one of which is the SimpleLayout. log4cpp::SimpleLayout has the following format for every log message priority message where priority is one of the different values like DEBUG, WARN, NOTICE, INFO, CRIT, ERROR and the message is the same as the string which you want to print. Initializing a SimpleLayout is [...]

Tags: , , , , , ,

 
0

log4cpp::Layout – Deciding on the Layout of Logs

Posted by Joys of Programming on January 13, 2010 in C/C++

log4cpp helps you to decide on the Layout of the logs. The layout of a log means the format according to which you want to display a message depending on the logging event. log4cpp supports the following Layouts Simple Layout Basic Layout Pattern Layout You can even make a Layout of your own. Making a [...]

Tags: , , , , , , ,

 
0

Configuring log4cpp (Simple)

Posted by Joys of Programming on January 12, 2010 in C/C++

If you want to see how log4cpp works with the basic configuration, there is a log4cpp::BasicConfigurator. It adds a FileAppender which logs the output to standard output and uses a BasicLayout. #include <stdio.h> #include <log4cpp/Category.hh> #include <log4cpp/BasicConfigurator.hh> using namespace std; int main() { /*Simple Setting up Appender, layout and Category*/ log4cpp::BasicConfigurator::configure(); log4cpp::Category& category = log4cpp::Category::getInstance("Category"); [...]

Tags: , , , , , ,

Pages: 1 2 Next

Copyright © 2009-2010 Joys of Programming All rights reserved.
Desk Mess Mirrored v1.7.2 theme from BuyNowShop.com.