国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > Linux服務器 > 正文

linux下實時查看tomcat運行日志的方法

2024-09-05 23:03:01
字體:
來源:轉載
供稿:網友

1、先切換到:cd usr/local/tomcat5/logs

2、tail -f catalina.out

3、這樣運行時就可以實時查看運行日志了

Ctrl+c 是退出tail命令。

順便講一下Linux中tail命令

tail 命令從指定點開始將文件寫到標準輸出.使用tail命令的-f選項可以方便的查閱正在改變的日志文件,tail -f filename會把filename里最尾部的內容顯示在屏幕上,并且不但刷新,使你看到最新的文件內容.

1.命令格式;

tail[必要參數][選擇參數][文件]  

2.命令功能:

用于顯示指定文件末尾內容,不指定文件時,作為輸入信息進行處理。常用查看日志文件。

3.命令參數:

-f 循環讀取
-q 不顯示處理信息
-v 顯示詳細的處理信息
-c<數目> 顯示的字節數
-n<行數> 顯示行數
--pid=PID 與-f合用,表示在進程ID,PID死掉之后結束.
-q, --quiet, --silent 從不輸出給出文件名的首部
-s, --sleep-interval=S 與-f合用,表示在每次反復的間隔休眠S秒

4.使用實例:

實例1:顯示文件末尾內容

命令:

tail -n 5 log2014.log

輸出:

[root@localhost test]# tail -n 5 log2014.log 2014-092014-102014-112014-12==============================[root@localhost test]#

說明:

顯示文件最后5行內容

實例2:循環查看文件內容

命令:

tail -f test.log

輸出:

[root@localhost ~]# ping 192.168.120.204 > test.log &[1] 11891[root@localhost ~]# tail -f test.log PING 192.168.120.204 (192.168.120.204) 56(84) bytes of data.64 bytes from 192.168.120.204: icmp_seq=1 ttl=64 time=0.038 ms64 bytes from 192.168.120.204: icmp_seq=2 ttl=64 time=0.036 ms64 bytes from 192.168.120.204: icmp_seq=3 ttl=64 time=0.033 ms64 bytes from 192.168.120.204: icmp_seq=4 ttl=64 time=0.027 ms64 bytes from 192.168.120.204: icmp_seq=5 ttl=64 time=0.032 ms64 bytes from 192.168.120.204: icmp_seq=6 ttl=64 time=0.026 ms64 bytes from 192.168.120.204: icmp_seq=7 ttl=64 time=0.030 ms64 bytes from 192.168.120.204: icmp_seq=8 ttl=64 time=0.029 ms64 bytes from 192.168.120.204: icmp_seq=9 ttl=64 time=0.044 ms64 bytes from 192.168.120.204: icmp_seq=10 ttl=64 time=0.033 ms64 bytes from 192.168.120.204: icmp_seq=11 ttl=64 time=0.027 ms[root@localhost ~]#

說明:

ping 192.168.120.204 > test.log & //在后臺ping遠程主機。并輸出文件到test.log;這種做法也使用于一個以上的檔案監視。用Ctrl+c來終止。

實例3:從第5行開始顯示文件

命令:

tail -n +5 log2014.log

輸出:

[root@localhost test]# cat log2014.log 2014-012014-022014-032014-042014-052014-062014-072014-082014-092014-102014-112014-12==============================[root@localhost test]# tail -n +5 log2014.log2014-052014-062014-072014-082014-092014-102014-112014-12==============================

以上就是小編為大家帶來的linux下實時查看tomcat運行日志的方法全部內容了,希望大家多多支持VEVB武林網~


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 凌云县| 鹿邑县| 满城县| 宁乡县| 修水县| 通城县| 汉中市| 桐柏县| 临澧县| 清镇市| 独山县| 麦盖提县| 南川市| 大洼县| 科尔| 通山县| 同心县| 兰溪市| 甘孜县| 拜城县| 浦江县| 枣阳市| 锦州市| 巴彦淖尔市| 岱山县| 青岛市| 天峨县| 罗江县| 江华| 鄯善县| 永福县| 临桂县| 正安县| 崇明县| 陇南市| 田林县| 泗水县| 遂昌县| 托克托县| 遂平县| 武川县|