Java 日志查看器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/144807/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 08:52:48  来源:igfitidea点击:

Java Log Viewer

javalog4jviewer

提问by Nadav

Unfortunately, sometimes the only way to debug a program is by going through its long log files.

不幸的是,有时调试程序的唯一方法是查看其长日志文件。

I searched for a decent log viewer for a while now, and haven't found a real solution. The only program that seemed to be most appropriate was Chainsawwith its Socket connector but after a few short uses the program proved to be buggy and unresponsive at best.

我搜索了一段时间的体面日志查看器,但还没有找到真正的解决方案。唯一似乎最合适的程序是带有 Socket 连接器的Chainsaw,但经过几次短暂的使用后,该程序被证明是有缺陷的,充其量也没有响应。

For my purposes, a log viewer should at least be able to mark log levels (for example with different colors) and perform easy filtering based on packages and free-text.

就我而言,日志查看器至少应该能够标记日志级别(例如使用不同的颜色)并根据包和自由文本执行简单的过滤。

Is there any other (free) log viewer? I'm looking for anything that could work well with log4j.

还有其他(免费)日志查看器吗?我正在寻找任何可以与 log4j 配合使用的东西。

采纳答案by Joe Skora

You didn't mention an OS, so I'll mention this though it is only on Windows.

你没有提到操作系统,所以我会提到这一点,尽管它只在 Windows 上。

Bare Metal Software makes a product called BareTailthat has a nice interface and works well. They have a free version with a startup nag screen, a licensed version with no nag, and a pro version with additional features. It has configurable highlighting based on matching lines against keywords.

Bare Metal Software 制作了一个名为BareTail的产品,它有一个漂亮的界面并且运行良好。他们有一个带启动屏幕的免费版本,一个没有唠叨的许可版本,以及一个带有附加功能的专业版。 它具有基于关键字匹配行的可配置突出显示。

They also have a BareGrep product too, which provides similar grep capabilities. Both are excellent and very stable and better than anything I've seen on Windows. I liked them so much I bought the bundle with both pro versions for $50.

他们也有一个 BareGrep 产品,它提供了类似的 grep 功能。两者都非常出色且非常稳定,比我在 Windows 上看到的任何东西都要好。我非常喜欢它们,我以 50 美元的价格购买了两个专业版的捆绑包。

回答by user20282

I've always used 'tail -f | grep re' or occasionaly 'awk'.

我一直使用 'tail -f | grep re' 或偶尔 'awk'。

回答by John Meagher

Depending on what platform you are running on and what other log viewing tools you have available, you can just use the appropriate log4j appender (syslog, Windows Event Logger) and just use your platform log viewing tools.

根据您运行的平台以及您可用的其他日志查看工具,您可以只使用适当的 log4j 附加程序(syslog、Windows 事件记录器)并使用您的平台日志查看工具。

Other than that I have usually seen custom solutions developed.

除此之外,我通常会看到开发的自定义解决方案。

Something that will drive your solution is what your overall system is like. Are you trying to aggregate logs from several computers? Or just view the logs from a single remote process?

您的整体系统是什么样的,这将推动您的解决方案。您是否正在尝试从多台计算机聚合日志?或者只是查看单个远程进程的日志?

回答by Will Sargent

You may want to use a custom log viewer that just works on files. I like Kiwi Log Vieweror Ganymede (an Eclipse plugin), but it's not hard to put a simple Swing app together that reads from the socket.

您可能希望使用仅适用于文件的自定义日志查看器。我喜欢Kiwi Log Viewer或 Ganymede(一个 Eclipse 插件),但是将一个从套接字读取的简单 Swing 应用程序放在一起并不难。

回答by Jerry B

I've rolled out Splunk (http://www.splunk.com/) for log viewing and searching with great success. The free version can be used locally and the paid version can collect all your logs into one location. We use it mostly for Log4J logs but with lots of other formats as well.

我已经推出了 Splunk ( http://www.splunk.com/) 以进行日志查看和搜索,并取得了巨大成功。免费版可以在本地使用,付费版可以将您的所有日志收集到一个位置。我们主要将它用于 Log4J 日志,但也有许多其他格式。

Beyond tail and grep support (without needing to know grep...) it automatically indexes logs and allows easy analysis (e.g. # of events in last xx timeframe) as well as basic charting, alerting, and event aggregation.

除了 tail 和 grep 支持(无需知道 grep...),它还可以自动索引日志并允许轻松分析(例如,最近 xx 时间范围内的事件数量)以及基本的图表、警报和事件聚合。

I won't say that the app is perfect or that the company has matured yet. But I don't hesitate at all to recommend that you try it.

我不会说该应用程序是完美的或公司已经成熟。但我毫不犹豫地建议您尝试一下。

回答by Nadav

Just wanted to say that I've finally found a tool that I can get along with just fine...

只想说,我终于找到了一个可以很好相处的工具……

It's called LogExpert (see http://www.log-expert.de/) and is free. Besides the usual tail function, it also has a filter and a search function - two crucial things that are missing from BareTail. And if you happen to want to customize the way it parses columns further, it's dead simple. Just implement an interface in .NET and you're done (and I'm a Java/Flex programmer...)

它被称为 LogExpert(参见http://www.log-expert.de/)并且是免费的。除了通常的 tail 功能外,它还具有过滤器和搜索功能 - BareTail 缺少的两个关键功能。如果您碰巧想自定义它进一步解析列的方式,那就太简单了。只需在 .NET 中实现一个接口就完成了(我是一名 Java/Flex 程序员......)

回答by Dima

You can try logFaces, it has fantastic real-time log viewer based on eclipse-like design.

您可以尝试logFaces,它具有基于 eclipse-like 设计的出色实时日志查看器。

alt text

替代文字

Disclosure: I am the author of this product.

披露:我是该产品的作者。

回答by Dima

Take a look to http://jlogviewer.sourceforge.net/or http://sourceforge.net/projects/jlogviewer/Java log viewer is lightweight GUI to easily view the java application logs generated by the "java.util.logging" package. It's open source!!

查看http://jlogviewer.sourceforge.net/http://sourceforge.net/projects/jlogviewer/Java 日志查看器是轻量级 GUI,可以轻松查看“java.util.logging”生成的 Java 应用程序日志包裹。它是开源的!!

回答by vstrale

LogSawbased on Eclipse and free. Log4j log file analyzer, simple to use with easy filtering. Supports several flavors of log4j log files: JBoss, Log4j pattern layout, Log4j XML layout, WebSphere.

Works like a charm. After couple of hours googling and trying several recommended free log4j viewers, this one was pleasant surprise. Have tried Chainsaw, BareTail, Insight, LogExpert, logview4j.

It is released weeks ago, and I guess still builds its way up on google.

LogSaw基于 Eclipse 且免费。Log4j 日志文件分析器,简单易用,易于过滤。支持多种 log4j 日志文件:JBoss、Log4j 模式布局、Log4j XML 布局、WebSphere。

奇迹般有效。经过几个小时的谷歌搜索并尝试了几个推荐的免费 log4j 查看器,这个令人惊喜。尝试过 Chainsaw、BareTail、Insight、LogExpert、logview4j。

它是几周前发布的,我想它仍然在谷歌上建立起来。

回答by Kumba

I'll add that for Windows, WireShark makes for a handy syslog viewer, ironically enough. I've tried several other syslog tools, and really, Kiwi is the best for syslog out there, but the "free" version is a bit nerfed. Others I ran into were either poorly programmed (crashing on minor issues -- logview4net), had a poor interface (Star SysLog Daemon Lite), or didn't even run (nxlog)

我要补充一点,对于 Windows,WireShark 提供了一个方便的系统日志查看器,具有讽刺意味的是。我已经尝试了其他几种 syslog 工具,实际上,Kiwi 是最适合 syslog 的工具,但“免费”版本有点弱。我遇到的其他人要么编程不佳(在小问题上崩溃——logview4net),界面很差(Star SysLog Daemon Lite),或者甚至没有运行(nxlog)

You can use WireShark's filter language to drill down on log data. It's overkill, but until someone writes a free syslog viewer/collector for Windows and makes it decent, this is one field that will be a hard one for most people.

您可以使用 WireShark 的过滤器语言来深入查看日志数据。这有点矫枉过正,但除非有人为 Windows 编写免费的系统日志查看器/收集器并使其变得体面,否则对于大多数人来说,这是一个很难的领域。

Example:

例子:

# Display level 6 alerts from 192.168.5.90 in WireShark
syslog.level == 6 && ip.addr == 192.168.5.90