storm 自定義 日誌檔案

2021-09-02 11:56:09 字數 376 閱讀 8434

storm中的日誌級級別預設為info,並且,日誌檔案是根據worker號來進行區分的,這樣,同乙個log檔案中的資訊不一定是乙個業務的,這樣就會有以下兩個需求出現:

1. 想要進行一些除錯資訊的輸出

2. 除錯資訊或者業務日誌資訊想要輸出到一些固定的檔案中

不要怕,不要煩惱,其實storm已經提供了這樣的支援,可以通過自定義logback 下的 cluster.xml 來輸出自己想要的日誌資訊,並且自定義日誌輸出的格式。下面是我自定義的一些配置,其實跟storm提供的差不多。

$/user_redis.log.%i

120

100mb

%d %c [%p] %m%n

自定義日誌檔案

借用 部落格 usr bin python coding utf 8 importlogging importos.path importtime 自定義日誌類 classlogger object def init self,logger 指定儲存日誌的檔案路徑,日誌級別,以及呼叫檔案 將日誌存入...

自定義日誌記錄檔案

舉例 郵件傳送錯誤記錄日誌 日誌記錄介面 ilogservice.cs public inte ce ilogservice 日誌記錄介面 實現 filelogservice.cs public class filelogservice ilogservice finally catch endre...

自定義日誌工具

import android.util.log created by xiongxl on 2017 2 20.public class logutil public static void d string tag,string msg public static void i string ta...