快速定位系統問題之logger

2021-08-19 14:12:36 字數 2172 閱讀 3365

一般系統出問題,我們都會去查詢logger,正常系統都會把log分為正常級別與異常,異常的還好查,但是遇到不是異常的又如何查呢?

1:普通查詢:vi ***.log /關鍵字

2:高階查詢:vi ***.log esc :v/關鍵字/d(以此查詢出來的log只會把有關鍵字的log顯示出來,精準定位)

1

2018

-04-27

17:05:04.747 error com.xx.api.commonctrl : invoke sms api error. code=2,msg=請求引數格式錯誤

22018

-04-27

17:05:11.899 error com.xx.api.commonctrl : invoke sms api error. code=2,msg=請求引數格式錯誤

32018

-04-28

09:57:50.511 error com.xx.api.commonctrl : invoke sms api error. code=15,msg=簽名不匹配

42018

-04-28

09:58:00.995 error com.xx.api.commonctrl : invoke sms api error. code=15,msg=簽名不匹配

52018

-04-28

09:58:37.311 error com.xx.api.commonctrl : invoke sms api error. code=15,msg=簽名不匹配

上述的是簡單的日誌查詢技巧,接下來介紹的是單獨流程日誌,正常系統的關鍵模組需要單獨開乙個log,比如提現,充值,這樣排查的時候比較好查,那麼如何實現呢?

1:新建提現日誌類

1

public

class

rechargelog

6public

static

void

info

(string format)

9public

static

void

debug

(string format,object... arguments)

12public

static

void

debug

(string format)

15public

static

void

error

(string format, object... arguments)

18public

static

void

error

(string format)

21}

2:logger.xml配置

1

2name="recharge_log"34

$/recharge.txtfile>

5class="ch.qos.logback.core.rolling.timebasedrollingpolicy">

6$/%d/recharge.%d.%i.zip

7filenamepattern>

89class="ch.qos.logback.core.rolling.sizeandtimebasedfnatp">

101024mbmaxfilesize>

11timebasedfilenamingandtriggeringpolicy>

12rollingpolicy>

1314%d %level - %msg%n

15pattern>

16encoder>

1718

name="com.xm.stmall.log.rechargelog"

level="debug"

additivity="false" >

19ref="recharge_log" />

20logger>

3:使用方法

在你的業務**中有關提現或者充值的日誌直接呼叫 rechargelog .info('提現')即可

iOS快速定位問題

作為開發人員在除錯程式的時候,我們很想馬上知道錯誤的 在哪一行,而不想大概設定乙個斷點,逐行除錯發現最終是哪一行 出問題導致程式崩潰。可以使用下面這個辦法快速定位問題 1.unrecognized selector send to instancd 快速定位 在debug選單中breakpoints...

PHP快速排查定位問題

方法 一 伺服器日誌 ps aux grep nginx 執行命令看主程序master process,有nginx的安裝位置和配置檔案的位置 usr sbin nginx t 獲取當前配置nginx.config 配置檔案位置 tail f var log nginx t3.local error...

系統問題定位總結

1 問題的描述 在ipran的組網環境中,裝置之間建立ldp會話 mpls 中分發標籤的協議 在其中的一台裝置中灌入3kospf路由和3k ldp標籤協議,裝置會生成3k條lsp,由於裝置容量問題,只會生成2k條ldp lsp,裝置容量達到上限。然後裝置進行ha倒換 高可靠性 主備板卡需要平滑資料,...