CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2011
    Posts
    3

    log library: Which one, proved and experienced would you advise?

    Hello, the question is in the subject.

    Some log libraries exist in C++, Log4cpp, log4cxx, Boost.Log...
    But are those libraries widely used in industrial software production?

    Thanks for your answers

  2. #2
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: log library: Which one, proved and experienced would you advise?

    Be aware that if your application has time critical sections or high priority threads, that the locking used by most logging libraries can have a detrimental effect on timing, by causing priority inversions when a low priority thread logs.

    Ironically, it was after looking at the log files that we discovered that it was the logging that was causing the problem in the first place.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  3. #3
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: log library: Which one, proved and experienced would you advise?

    Does anyone else have any views on logging libraries?
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  4. #4
    Join Date
    Jan 2009
    Posts
    1,689

    Re: log library: Which one, proved and experienced would you advise?

    I wrote my own logger using regular FILE *s, pthread mutexes. They aren't terribly complicated and writing your own gives you absolute control over what gets logged.

  5. #5
    Join Date
    Jan 2011
    Posts
    3

    Smile Re: log library: Which one, proved and experienced would you advise?

    Indeed implementing its own log lib allows doing exactly what you want.
    But what I want is to earn time, and what I don't need is absolute control...

    Moreover, I think a proved (because mature and used) library provides
    - better efficiency about log system overhead
    - better filter options
    - easier configuration
    - ...
    And I also think a log system is not a purpose for a developer (or rarely, maybe for a log library developer), but a tool.

    That's why I ask about a library.

  6. #6
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: log library: Which one, proved and experienced would you advise?

    Boost.Log may be a good bet if you want a library that may, in time, be integrated in to the standard C++ libraries.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  7. #7
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: log library: Which one, proved and experienced would you advise?

    Quote Originally Posted by ninja9578 View Post
    I wrote my own logger using regular FILE *s, pthread mutexes. They aren't terribly complicated and writing your own gives you absolute control over what gets logged.
    We wrote our own because of the timing difficulties I mentioned.We devised a low impact way of sending log data to a low priority thread that actually did the logging. Logging sections are enabled via a configuration file, including log levels.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured