Experience using Boost.Log logging library? [closed]
Asked Answered
G

3

90

I am considering starting to use the Boost.Log logging library. Is anyone using Boost.Log? Please share your experiences in this regard.

The other libraries I am considering are Apache log4cxx (it seems tedious to install but my team mates want something simple to get started) and Pantheios (the same problem since it works with extra front and back end).

Gadmon answered 18/8, 2010 at 9:5 Comment(10)
I have my own Logging system, but I am considering to switch, so interesting question !Dufy
@Cedric Yes, I too have my own logging system but can't get too far with it as I need high performance, configurability like sending debug to console as well as to file, dynamic reconfigurability (optional), component-wise logging and that logs do not get mangled while using multiple threads.Gadmon
bloost.log is VERY VERY slow, insanly complex to configure, it barely passed its review process, and as of 1.47 is still not in the Boost release. Its one of those libraries that might not make it into the mainline within the next couple of years, so for now log4c etc are better options.Charlottecharlottenburg
Actually, it have been explained that it needs some fixes and that the current target of release is this summer - libraries abandonned don't have a schedule and work-in-progress repository. Also, it have been reported by the author that user reported VERY VERY good performance. The complexity is useful in some contexts and if you don't need it, you can just use the easy macros provided. So, I don't agree with your comment.Jurist
I really wish StackOverflow would stop closing obviously useful questions like this one as "not constructive".Schnorrer
@Matthieu I hope I could see your comment here berfore I use Boost.Log, it is SO SLOW, and finally I have to disable logging feature due to performance issue.Angeli
I wonder, how's performance in 2015? Maybe using 2.0 is "OK" now?Polygraph
The API is not friendly, hard to be understood and configured. Macros makes it hard to use. IMOInscribe
@CedricH. Why consider to switch?Lease
@Jurist It's 2021! Any better now? Many comments indicate that boost::log is slow.Lease
C
41

UPDATE: I've since this was written replaced Boost.Log with my own custom logging, mostly because I decided to get rid of all Boost dependencies in all my projects for various reasons. If you are fine with using Boost I guess Boost.Log is still a valid choice judging by Klaim's answer.

My experience with Boost.Log in year 2010 follows.


I've successfully integrated Boost.Log in my game engine and I can only talk good things about it. Sure, it's a little early to use, since version 2 will be the actual version that will become the official Boost.Log.

Beware that the version "1.0" available is not being maintained. To receive updates you must use the bleeding edge (trunk) version which might become unstable. Take this into account if you are going to use this version in any serious projects. If you are not afraid to use bleeding edge versions or future breakage, then go for it. It's really nice to use as it is in its current state.

I've long thought the hierarchical logging system in log4j/log4cxx was superior, but Boost.Log has got me thinking otherwise. Filtering and attributes is way more flexible.

The design of sinks separated by frontend/backend makes it really easy to add additional backends. No need to worry about synchronization issues or filtering which is handled by the frontend. The library also comes with lots of backends already, rotational files, console, syslog, Windows event register, etc.

I have written my own sink backends; one goes to the in-game console and one to a kind of notification system for more serious events. Was easier than I expected, had it up and running in just a few minutes.

Last but not least, the maintainer/developer is really helpful as well. You'll get plenty of help in the project forums. He's fixed two bugs (whereof one major) just this weekend that I reported :-)

Coquillage answered 22/8, 2010 at 19:28 Comment(0)
J
21

UPDATE: I am using Boost.Log into a game engine system and I am very happy with it. It's fast, thread-safe and very very flexible when you need it.

Boost.Log should be provided with all Boost libraries in a coming release this year (2013).


Boost.Log is made to setup a log system over it. If you read the documentation, you'll see that it's so flexible that any logging system yon can think of can be build with it (like logging on a distant computer).

So, there are macro to ease use in simple projects but I think it's the kind of library that is useful mostly to people that really understand logging and want to build a specific architecture for their application.

About performance, I remember that there was problems at the submission that made it slow compared to other (less flexible) logging libraries but as it was a draft and the first release is not out yet I would not bother if you're not coding a time-critical application.

In the end, I think it's simply too "new" to be evaluated "now". There is no other logging library that is as flexible as this one and I'm not sure if a lot of people will feel the need to use it.

Update: a recent email exchange with the Boost.Log author result in some data that suggest tat Boost.Log is clearly an excellent alternative for fast logging.

Jurist answered 18/8, 2010 at 9:33 Comment(0)
C
7

I recently looked into implementing a logging system on a project I was starting.

I tried log4cxx as you mention it, it is indeed very tedious to install. It took me several hours to get it to compile under VS2012 (with other dependency libraries...), and then it just crashed when I used it in my project. Certainly some weird stuff going on with standard libraries mismatches, but couldn't figure it out.

So I switched to log4cpp which I got up and running in just a few minutes. I find it elegant and lightweight, just what I needed. It has the big advantage of having the same features as the well-known log4j & co. logging systems which might be a real plus for your teamwork (configuration through config file, etc.)

As far as performance is concerned, it takes one function call to check if the logger is active for the level of the message, then one function call to actually log the data.

With a few home-made macros (to add LINE & co. to messages), log4cpp has really proven useful in my project.

Unfortunately, I didn't try Boost.Log so can't speak about it, but I hope this feedback will still be useful for you if you choose not to go the Boost.Log way.

Clientele answered 27/11, 2012 at 13:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.