妙用编辑器:使用Notepad--的标记颜色功能更高效的阅读日志文件

应用场景

在日常维护工作中,经常需要查看一些日志,以判断系统的运行状态或者进行问题定位,当系统出现故障时,一般都会有特殊的关键字,但对于浩如烟海的日志来说,识别这些关键字信息还是非常费眼力的,比如有如下一段日志,尝试一眼看到关键信息:

06-10 13:14:11.639  5784  9658 W System.err: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 9667) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)
06-10 13:14:11.639  5784  9658 W System.err: 	at libcore.io.IoBridge.isConnected(IoBridge.java:223)
06-10 13:14:11.639  5784  9658 W System.err: 	at libcore.io.IoBridge.connectErrno(IoBridge.java:161)
06-10 13:14:11.639  5784  9658 W System.err: 	at libcore.io.IoBridge.connect(IoBridge.java:112)
06-10 13:14:11.639  5784  9658 W System.err: 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
06-10 13:14:11.639  5784  9658 W System.err: 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
06-10 13:14:11.639  5784  9658 W System.err: 	at java.net.Socket.connect(Socket.java:843)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.android.okhttp.internal.Platform.connectSocket(Platform.java:152)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.android.okhttp.Connection.connect(Connection.java:101)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.certus.ottstb.qosmonloader.a.e.a(SourceFile:117)
06-10 13:14:11.639  5784  9658 W System.err: 	at com.certus.ottstb.qosmonloader.qosmon.a.run(SourceFile:149)
06-10 13:14:11.639  5784  9658 W System.err: 	at java.lang.Thread.run(Thread.java:841)
06-10 13:14:11.639  5784  9658 W System.err: Caused by: libcore.io.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)
06-10 13:14:11.649  5784  9658 W System.err: 	at libcore.io.IoBridge.isConnected(IoBridge.java:208)
06-10 13:14:11.649  5784  9658 W System.err: 	... 16 more

这种日志,实事求是的讲,一点也不养眼,看多了对身心是一种摧残, 那有没有什么办法提高生活质量呢? 请尝尝下面的方法。

操作方法

步骤1:将日志拷贝到Notepad--或使用Notepad--打开日志文件,如下图所示:

步骤2:选中关键字“failed”,选择菜单 “查找-> 标记颜色”,选择自己喜欢的颜色,如下图所示:

步骤3: 重复步骤2,将其他关键字也使用颜色标记(可以选择相同或不同的颜色),最终效果如下图所示:


文档作者声明:本文档仅用于学习和交流,文中示例均来自网络,如有侵权,请联系删除。
Copyright © 2022~2024 All rights reserved.

posted @ 2024-09-28 22:40  tyysoft  阅读(88)  评论(0编辑  收藏  举报