1.需要让eclipse中的console支持ANSI,所以需要下载插件ANSIConsole,具体下载地址为:http://www.mihai-nita.net/eclipse 安装完成后,然后重启eclipse
2.在log4j.properties中对debug/info/warn/error/fatal的颜色进行配置
3.
所支持的颜色范围(根据ANSI标准):
前景色:black/red/green/yellow/blue/magenta/cyan/white
背景色:black/red/green/yellow/blue/magenta/cyan/white
属性:normal/bright/dim/underline/blink/reverse/hidde
4.也可以到如下地址下载具体的代码:http://down.51cto.com/data/800211
转载于:https://blog.51cto.com/zwbjava/1204757