log4cxx在linux下的编译使用
http://logging.apache.org/log4cxx/, http://apr.apache.org/
apr-1.4.6.tar.gz, apr-util-1.4.1.tar.gz, apache-log4cxx-0.10.0.tar.gz
1.tar zxvf apr-1.4.6.tar.gz
2.tar zxvf apr-util-1.4.1.tar.gz
3.tar zxvf apache-log4cxx-0.10.0.tar.gz
二 .编译安装
首先安装apr-1.4.6,切换cd apr-1.4.6,配置./configure --prefix=/usr/local/apr,接着make, make install
接着安装apr-util-1.4.1,切换至cd ../apr-util-1.4.1, ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr,接着make,make install;
最后安装apache-log4cxx-0.10.0,切换cd ../apache-log4cxx-0.10.0,配置./configure --prefix=/usr/local/log4cxx --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
注意配置前需进行以下操作:
1.vim src/main/cpp/inputstreamreader.cpp
增加#include <string.h>;
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/inputstreamreader.h>
#include <log4cxx/helpers/exception.h>
#include <log4cxx/helpers/pool.h>
#include <log4cxx/helpers/bytebuffer.h>
+
#include <string.h>
+
否则会出现inputstreamreader.cpp:66: error: 'memmove' was not declared in this scope
make[3]: *** [inputstreamreader.lo] 错误 1
2.vim src/main/cpp/socketoutputstream.cpp
增加#include <string.h>;
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/socketoutputstream.h>
#include <log4cxx/helpers/socket.h>
#include <log4cxx/helpers/bytebuffer.h>
+
#include <string.h>
+
否则会出现socketoutputstream.cpp:52: error: 'memcpy' was not declared in this scope
3.vim src/examples/cpp/console.cpp
增加#include <string.h>,#include <stdio.h>;
+
#include <stdio.h>
+
#include <stdlib.h>
+
#include <string.h>
+
#include <log4cxx/logger.h>
#include <log4cxx/consoleappender.h>
#include <log4cxx/simplelayout.h>
#include <log4cxx/logmanager.h>
#include <iostream>
#include <locale.h>
否则会出现
console.cpp: In function ‘int main(int, char**)’:
console.cpp:58: 错误:‘puts’在此作用域中尚未声明
#include <log4cxx/logstring.h>
#include <log4cxx/propertyconfigurator.h>
int main(int argc, char* argv[])
{
using namespace log4cxx;
// 读取配置文件
PropertyConfigurator::configure("conf.log");
// 建立两个logger
LoggerPtr logger1 = Logger::getLogger("TraceYourMama");
LoggerPtr logger2 = Logger::getLogger("Patch");
LOG4CXX_TRACE(logger1, "跟踪");
LOG4CXX_WARN(logger1, "警告");
LOG4CXX_DEBUG(logger1, "调试");
LOG4CXX_ASSERT(logger1, false, "断言");
LOG4CXX_FATAL(logger1, "致命");
LOG4CXX_TRACE(logger2, "跟踪");
LOG4CXX_ERROR(logger2, "错误");
return 0;
}
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=./ZW.log
log4j.appender.logfile.MaxFileSize=100KB
log4j.appender.logfile.MaxBackupIndex=10
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d [%t] %-5p %c - %m%
本文出自 “永远的朋友” 博客,请务必保留此出处http://yaocoder.blog.51cto.com/2668309/980276
log4cxx在linux下的编译使用的更多相关文章
- log4cxx在linux下的编译和使用
[下载] [编译动态库] [使用动态库]
- LINUX下文件编译
body, table{font-family: 微软雅黑} table{border-collapse: collapse; border: solid gray; border-width: 2p ...
- ACE-6.1.0 linux 下的编译与安装步骤
ACE-6.1.0 linux 下的编译与安装步骤 引用至http://www.cnblogs.com/liangxiaxu/archive/2013/03/07/2948417.html 1.从 ...
- FFmpeg在Linux下安装编译过程
转载请把头部出处链接和尾部二维码一起转载,本文出自:http://blog.csdn.net/hejjunlin/article/details/52402759 今天介绍下FFmpeg在Linux下 ...
- Linux下nginx编译安装教程和编译参数详解
这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # y ...
- linux下将编译错误输出到一个文本文件
linux下将编译错误输出到一个文本文件 command > filename 把把标准输出重定向到一个新文件中 command > > filename 把把标准输出重定向到一个文 ...
- 从四个问题透析Linux下C++编译&链接
摘要:编译&链接对C&C++程序员既熟悉又陌生,熟悉在于每份代码都要经历编译&链接过程,陌生在于大部分人并不会刻意关注编译&链接的原理.本文通过开发过程中碰到的四个典型 ...
- [转]Linux下g++编译与使用静态库(.a)和动态库(.os) (+修正与解释)
在windows环境下,我们通常在IDE如VS的工程中开发C++项目,对于生成和使用静态库(*.lib)与动态库(*.dll)可能都已经比较熟悉,但是,在linux环境下,则是另一套模式,对应的静态库 ...
- linux 下cmake 编译 ,调用,调试 poco 1.6.0 小记
上篇文章 小记了: 关于 Poco::TCPServer框架 (windows 下使用的是 select模型) 学习笔记. http://www.cnblogs.com/bleachli/p/4352 ...
随机推荐
- 基于tiny4412的Linux内核移植 -- PWM子系统学习(七)
作者信息 作者: 彭东林 邮箱:pengdonglin137@163.com QQ:405728433 平台简介 开发板:tiny4412ADK + S700 + 4GB Flash 要移植的内核版本 ...
- U-Boot添加menu命令的方法及U-Boot命令执行过程
转;http://chenxing777414.blog.163.com/blog/static/186567350201141791224740/ 下面以添加menu命令(启动菜单)为例讲解U-Bo ...
- openresty记录响应body乱码问题
问题背景 最近新上了一个功能,openresty通过syslog记录请求日志,然后由logstash推送至ES.测试上线时未发现这个问题,在日常查看日志的过程中,发现logstash推送有错误日志,错 ...
- Koch 分形,海岸线,雪花
此算法用于生成Koch分形(海岸线,雪花).速度高速,效果绚丽 //支持的初始直线水平角度为60 的倍数. 交换起点与终点坐标可改变生成方向 void Koch(CDC *pDC, int x1, i ...
- python 机器学习中的数据处理学习记录
在机器学习中,选择合适的算法固然重要,但是数据的处理也同样重要.通过对数据的处理,能提高计算效率,提高预测识别精确度等等 以下记录下一些数据处理的方法 一.处理缺失值 对于数据集中有缺失值的,粗暴的方 ...
- SQL 之 Group By
SQL 之 Group By Group By从字面意义上理解就是根据By指定的规则对数据进行分组,所谓的分组就是将一个数据表划分成若干个小区域. 例如:有这么一张表
- jQuery.toggleClass() 和detach()方法详解
一.toggleClass()函数: toggleClass()函数用于切换当前jQuery对象所匹配的每一个元素上指定的css类名.所谓"切换",就是如果该元素上已存在指定的类名 ...
- 百度编辑器同一id重复调用不能生效的办法
在使用js 调用表单组件模板的时候,表单内有一个编辑框 第一次调出的时候,百度编辑器正常显示,关闭后,再打开,百度编辑器不能显示 原因:第一次使用的时候, UE.getEditor('node_con ...
- [OpenCV]实验1.1:图像加载、显示
实验要求:利用图像库的功能,实现从文件加载图像,并在窗口中进行显示的功能:利用常见的图像文件格式(.jpg;.png;.bmp; .gif)进行测试 实验原理:图片读取到程序中是以Mat结构存储的,在 ...
- centos关于vsftpd的配置、配置说明及常见问题
一.安装vsftpd 安装yum install -y vsftpd 开机启动 chkconfig vsftpd on 启动 service vsftpd start 加入防火墙 vi /etc/sy ...