log4cpp Category

Posted by Joys of Programming on 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.

  1. EMERG, FATAL
  2. ALERT
  3. CRIT
  4. ERROR
  5. WARN
  6. NOTICE
  7. INFO
  8. DEBUG
  9. NOTSET (no priority set)

A log message will be printed only when the priority of the message is greater than or equal to the priority of the scenario.

In log4cpp, this scenario is often referred to as the Category. A Category must have the following values

  1. Appender: Destination of Logs
  2. Layout: Log format, Log Layout
  3. Priority: Priority of the Category,  assuming only the values given above

This is clearly seen how the different values of Category are set in the sample log4cpp program. We can direct the logs to multiple places. We can also disable this feature for an application.

Tags: , , , , , , , ,

Comments:

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

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