Boost Logging Library v2 : Introduction


Applications today are becoming increasingly complex. Part of making them easier to develop/maintain is to do logging. Logging allows you to later see what happened in your application. It can be a great help when debugging and/or testing it. The great thing about logging is that you can use it on systems in production and/or in use - if an error occurs, by examining the log, you can get a picture of where the problem is.

Good logging is mandatory in support projects, you simply can't live without it.

Used properly, logging is a very powerful tool. Besides aiding debugging/ testing, it can also show you how your application is used (which modules, etc.), how time-consuming certain parts of your program are, how much bandwidth your application consumes, etc. - it's up to you how much information you log, and where.


Common Usage

To get you started, here's the most common usage:

This usage:

In this example, all output will be written to the console, debug output window, and "out.txt" file. It will look similar to this one:

21:03.17.243 [1] this is so cool 1
21:03.17.243 [2] first error 2
21:03.17.243 [3] hello, world
21:03.17.243 [4] second error 3
21:03.17.243 [5] good to be back ;) 4
21:03.17.243 [6] third error 5

Click to see the code

To see more examples, check out Usage Scenarios (together with code).


I certainly welcome all feedback. So, be it a suggestion, or criticism, do write to me:


See the changelog.

Copyright John Torjo © 2007
Have a question/ suggestion/ comment? Send me feedback