在eclipse控制台中着色日志 [英] Colorize logs in eclipse console
问题描述
它肯定有助于使重要的比赛脱颖而出,而不需要使用奇怪的布局,而是将布局保留在log4j设置中
这里是我正在寻找的例子:
[INFO]网格完成....... false
其中粗体部分将呈蓝色,此着色可由应用程序在一定程度上控制。像这样(标签是概念性的和任意的,但你得到的想法):
log.info(String.format(网格完成...... 。< blue>
%s < / blue>
,isComplete));
在更一般的注意事项中,可以在日志中嵌入元信息来帮助显示这些日志。很像我们标记网页内容,以帮助CSS介绍信息。
尝试使用此Eclipse插件:
Grep Console
[更新] :
正如评论者所指出的:
在当前最新版本的Eclipse中安装Grep Console时,需要取消选中按类别分组安装对话框以查看可用的项目。
[更新2] :
如azdev所指出,要正确突出显示
只输入文字字符串不起作用。要得到一条颜色的线条,您必须在两边的
。*
中包含字符串,如下所示:
。* ERROR。*
Is there a way to colorize parts of logs in the eclipse console. I know I could send to error and standard streams and color them differently but I'm more looking someting in the lines of ANSI escape codes (or anyother, HTML ?) where I could embed the colors in the string to have it colored in the logs.
It sure would help making the important bits stand out without resorting to weird layout, rather keep the layout to the log4j setups
here is an example of what I am looking for :
[INFO ] The grid is complete ....... false
where the bold parts would be in blue, this coloring can be controlled by the application to an extent. like so (tags are conceptual and arbitrary, but you get the idea):
log.info(String.format("The grid is complete ....... <blue>
%s</blue>
", isComplete ));
On a more general note it is the ability to embed meta information in the logs to help the presentation of these logs. Much like we tag web pages content to help the presentation of the information by CSS.
have a try with this Eclipse Plugin: Grep Console
[UPDATE]: As pointed out by commenters: When installing Grep Console in the currently last version of Eclipse, you need to uncheck 'Group items by category' in the Install dialog to see the available items.
[UPDATE 2]: As pointed out by azdev, to get proper highlighting
entering just literal strings doesn't work. To get a line to be colored, you have to enclose the string in
.*
on either side, like so:.*ERROR.*
这篇关于在eclipse控制台中着色日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!