在Eclipse控制台中着色日志 [英] Colorize logs in eclipse console

查看:452
本文介绍了在Eclipse控制台中着色日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种方法来在Eclipse控制台中对部分日志进行着色。我知道我可以发送到错误和标准流和颜色他们不同,但我更看起来在ANSI转义代码(或任何其他,HTML?)的行,其中我可以嵌入的颜色在字符串中,它的颜色在日志。

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.

一定会有助于使重要的位突出而不诉诸奇怪的布局,而保持布局为log4j setups

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]网格完成....... false

[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 。< blue> %s < / blue> ,isComplete));

log.info(String.format("The grid is complete ....... <blue>%s</blue>", isComplete ));

在一般情况下,可以在日志中嵌入元信息以帮助呈现这些日志。就像我们标记网页内容以帮助CSS显示信息。

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.

推荐答案

尝试使用此Eclipse插件:
Grep控制台

have a try with this Eclipse Plugin: Grep Console

[UPDATE]
正如评论者所指出的:
当在当前最新版本的Eclipse中安装Grep控制台时,您需要取消选中在安装对话框中查看可用的项目。

[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]
正如azdev指出的,突出显示

[UPDATE 2]: As pointed out by azdev, to get proper highlighting


只输入文字字符串不起作用。要得到一条线是彩色的,你必须把字符串放在
。*
在任一侧,像这样:
。* ERROR。*

这篇关于在Eclipse控制台中着色日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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