3

I've had log4cxx recommended to me as a good way of generating log messages from C++ applications. However, plain old UNIX syslog() calls do let me output to files, or over the network, and have all the usual DEBUG/INFO/WARN/ERROR levels.

log4cxx is clearly more modular/customizable, but I really just want to log to a file so can't imagine needing to write any custom output functionality. I feel like I must be missing something: what does log4cxx give me over and above using plain syslog? Performance? Robustness? Portability?

kdt
  • 27,905
  • 33
  • 92
  • 139

2 Answers2

4

Portability.

If one day you chose to move your application to a windows environment or somewhere else that doesn't provide syslog(), you won't have to rewrite your logger.

bgura
  • 860
  • 15
  • 33
2

It gives you the dubious joy of reinventing a wheel. I've seen the light, and I'm shining it. Unix works better. Syslog().

chiggsy
  • 8,153
  • 5
  • 33
  • 43
  • Would you care to expand on what it is about syslog that you prefer, and how it compares to log4xx in the areas that matter to you? – kdt Jan 10 '11 at 12:46
  • 1
    Portability is one thing I suppose. log4XXXXX is pretty much a standard API across languages, but I live in unix, and I would say why add a layer to logging? If you can't think of anything syslog is missing, and I can't think of anything, then why not use syslog? – chiggsy Jan 11 '11 at 22:07