log4go折腾
导包
go get -u github.com/alecthomas/log4go
log4go.xml配置
<logging>
<filter enabled="true">
<tag>stdout</tag>
<type>console</type>
<!-- level is (:?FINEST|FINE|DEBUG|TRACE|INFO|WARNING|ERROR) -->
<level>DEBUG</level>
</filter>
<filter enabled="true">
<tag>file</tag>
<type>file</type>
<level>INFO</level>
<property name="filename">test_client.log</property>
<!--
%T - Time (15:04:05 MST)
%t - Time (15:04)
%D - Date (2006/01/02)
%d - Date (01/02/06)
%L - Level (FNST, FINE, DEBG, TRAC, WARN, EROR, CRIT)
%S - Source
%M - Message
It ignores unknown format strings (and removes them)
Recommended: "[%D %T] [%L] (%S) %M"
-->
<property name="format">[%D %T] [%L] (%S) %M</property>
<property name="rotate">false</property> <!-- true enables log rotation, otherwise append -->
<property name="maxsize">10M</property> <!-- \d+[KMG]? Suffixes are in terms of 2**10 -->
<property name="maxlines">0K</property> <!-- \d+[KMG]? Suffixes are in terms of thousands -->
<property name="daily">false
</property> <!-- Automatically rotates when a log message is written after midnight -->
</filter>
<filter enabled="false">
<tag>xmllog</tag>
<type>xml</type>
<level>INFO</level>
<property name="filename">trace.xml</property>
<property name="rotate">true</property> <!-- true enables log rotation, otherwise append -->
<property name="maxsize">100M</property> <!-- \d+[KMG]? Suffixes are in terms of 2**10 -->
<property name="maxrecords">6K</property> <!-- \d+[KMG]? Suffixes are in terms of thousands -->
<property name="daily">false
</property> <!-- Automatically rotates when a log message is written after midnight -->
</filter>
<filter enabled="false"><!-- enabled=false means this logger won't actually be created -->
<tag>donotopen</tag>
<type>socket</type>
<level>FINEST</level>
<property name="endpoint">192.168.1.255:12124</property> <!-- recommend UDP broadcast -->
<property name="protocol">udp</property> <!-- tcp or udp -->
</filter>
</logging>
加载log4go
func init() {
log.LoadConfiguration("log4go.xml")
}
写日志
//导包 log "github.com/alecthomas/log4go"
log.Info("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") log.Debug("111111111111111111111111111")
java折腾久了,日志框架还是喜欢这个
log4go折腾的更多相关文章
- Go -- log4go日志
折腾: [已解决]go语言中实现log信息同时输出到文件和控制台(命令行) 期间,已经通过io的MultiWriter搞定了同时输出信息到文件和console,但是不支持level. 所以,再去试试这 ...
- ASP.NET Core 折腾笔记二:自己写个完整的Cache缓存类来支持.NET Core
背景: 1:.NET Core 已经没System.Web,也木有了HttpRuntime.Cache,因此,该空间下Cache也木有了. 2:.NET Core 有新的Memory Cache提供, ...
- ASP.NET Core 折腾笔记一
前言: 在ASP.NET Core 1.0时,曾折腾过一次,后因发现不了System.Data而停止. 更因VS2015提示过期Delete掉VS了,其实主要还是笔记本的硬盘空间吃紧. 快双十一了,本 ...
- Gulp探究折腾之路(I)
前言: gulp是前端开发过程中对代码进行构建的工具,是自动化项目的构建利器:她不仅能对网站资源进行优化,而且在开发过程中很多重复的任务能够使用正确的工具自动完成:使用她,我们不仅可以很愉快的编写代码 ...
- 两年来的core折腾之路几点总结,附上nginx启用http2拿来即用的配置
序:一年多没更新博客园的内容了,core已经发生了翻天覆地的变化,想起2014年这时候,我就开始了从当时还叫k的那套preview都不如的vnext搭建这套系统,陆陆续续它每一次升级,我也相应地折腾, ...
- 记录一下折腾webp 的过程
最近有客户想要处理webp 的动图,情况当然是我们并不能处理webp 格式的图片.这事就交给了我来折腾,一开始想着用瑞士军刀ffmpeg.结果是折腾了差不多一天,前前后后编译了几十次ffmpeg 源码 ...
- Hexo折腾记
如果时间可以静止,我希望就停在此刻. 前言 博主之前也有折腾wordpress和jekyll可对于一个前端er来说,wordpress让人没法尽兴,因为不知道该如何添加自己的代码.而jekyll就太麻 ...
- [无聊的事-连载之连开100个VS] 折腾你的骚机吧,骚年们!!!
[无聊的事-连载之连开100个VS] 折腾你的骚机吧,骚年们!!! 只有8G内存的,用这个:打开你的CMD命令提示符如果只装了Visual Studio 2010,用这条命令,打开50个VSfor / ...
- 关于Qt creator 无法使用fcitx输入中文的问题折腾
环境: 系统ubuntu16.04amd64,qt5.4.2 安装完qt5.4后,在编写代码时,发现无法输入中文,离开qt creator 就立刻正常.原因似乎是qt对fcitx支持. 解决方法我是参 ...
随机推荐
- 织梦栏目页分页title加"第N页"
以上就是调用栏目管理的SEO标题代码:{dede:field.seotitle /}的方法,这样充分体现列表页标题显示的效果,有利于搜索引擎的收录. 第二个问题就是这样列表页的标题都成了一个样子的了, ...
- iOS字符串的各种用法(字符串插入、字符串覆盖、字符串截取、分割字符串)
NSString* str=@"hello";//存在代码区,不可变 NSLog(@"%@",str); //1.[字符串插入] NSMutableString ...
- nginx最简单的网站配置:单主机+静态文件
1.域名绑定主机:新建一个A记录,将www的子域名绑定到主机的ip上:2.主机的nginx设置监听端口,绑定域名,修改网站根目录路径和默认首选文件:/etc/nginx/conf.d 这个目录中新建一 ...
- windows下关闭指定端口服务,解决tomcat端口占用问题
http://blog.aizhet.com/Server/640.html 在windows下做java EE的开发时:搭建 Eclipse+tomcat的java web开发环境:在应用之中经常遇 ...
- linux静默安装Oracle 11g
./runInstaller -silent -force -responseFile /home/oracle/software/database/response/orcl_install.rsp ...
- 在线制作一键生成微信小程序实现原理之需求分析
随着微信小程序接口不断的放开,小程序在今年或许是明年必将成为商家的一个标配,这个标配的标准就是要开发周期短,费用低,功能实用.只有这样才能让线下的广大商家快速接入.现在也有好多公司开发出了一键生成快速 ...
- PYTHON路线图
路线图: 第一部分:Python语言基础 第二部分:数据库开发 第三部分:web前端 第四部分:Python web开发 第五部分:Python web项目 第六部分:Linux 第七部分:NoSQL ...
- iOS copy/retain/assign
1 深复制:内容拷贝,源对象和副本对象指的是两个不同的对象,源对象引用计数器不变,副本对象引用计数器为1 2 浅复制:指针拷贝,源对象和副本对象指的都是同一个对象,对象引用计数器+1,相当于retai ...
- B. Chris and Magic Square
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- lightoj1169【DP】
题意(来自大哥): 有两栋楼,左边一栋,右边一栋,层数从1-n,地面的标号为0,每一层有一个水果.有一只猴子在地面上,他现在要上到n层去,在第i层会吃掉水果花费一定时间. 猴子有两种方式从第i层到i+ ...