C ++的日志库设置 [英] C++ Logging Library Setup

查看:182
本文介绍了C ++的日志库设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想约2周,现在得到一个日志库的工作。我试过Log4cxx,Log4cpp,log4cplus和boost.log。问题不在于没有这些工作对我来说,这是我无法弄清楚如何让他们在所有的工作。我真的想用log4cxx因为我用的log4j /的logback在工作中的工作,但我一直没能得到任何基于log4j的构建库。我已经能够建造和使用Boost库,但boost.log给了我各种链接错误的,不管我怎么努力。如果任何人都可以直接我一步一步的指导,以使这些库中的一个工作,我会大大AP preciate它。另外,我使用的Eclipse作为我的IDE如果该事项。

I've been trying for about 2 weeks now to get a logging library to work with. I've tried Log4cxx, Log4cpp, log4cplus and boost.log. The problem isn't that none of these work for me, it's that I can't figure out how to get them to work at all. I would really like to use log4cxx since I'm working with log4j/logback at work, but I haven't been able to get any of the libraries based on log4j to build. I've been able to build and use the boost library, but boost.log gives me all kinds of linker errors no matter what I try. If anyone could direct me to a step-by-step guide to get one of these libraries working I would greatly appreciate it. Also, I'm using eclipse as my IDE if that matters.

推荐答案

Boost.Log工作对我来说相当不错(Linux和Windows)。这不是一个仅有头库,还有就是你需要进行链接编译的一部分。详见说明书这里

Boost.Log works for me quite well (Linux and Windows). It is not a header only library, there is a compiled part that you need to link against. See instructions here.

这也取决于其他非头,Boost库:

It also depends on other, non-header, Boost libraries:

日志记录库使用需要其他几个Boost库
  建筑了。这些都是Boost.Filesystem的,Boost.System,
  Boost.DateTime,Boost.Thread和Boost.Regex。参考其
  文档在建筑过程的详细说明。

The logging library uses several other Boost libraries that need building too. These are Boost.Filesystem, Boost.System, Boost.DateTime, Boost.Thread and Boost.Regex. Refer to their documentation for detailed instructions on the building procedure.

根据您的平台上有可能是Boost库的pre-内置的版本。否则,构建它自己很简单,如果你按照指示。如果您遇到问题更新你看到的地方正是你卡住了,什么你的问题。

Depending on your platform there may be pre-built versions of the Boost libraries. Otherwise building it yourself is straightforward if you follow the instructions. If you get stuck update your question with where exactly you got stuck and what you're seeing.

这篇关于C ++的日志库设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆