Class FileoutputUtil
java.lang.Object
tools.FileoutputUtil
伺服器全域的靜態檔案輸出工具,提供時間戳記式訊息追加與自動滾動功能。
以常數字串定義各業務日誌檔名(如 Script_Bug、Hacker_Log、
UnknownPacket_Log 等中英混用檔名),
所有檔案輸出至 logs/ 目錄(錯誤另歸 logs/error/<日期>/)。
主要靜態方法:
log(file, msg)— 在訊息前自動插入當前時間戳記後追加寫入。logToFile(file, msg)— 直接追加訊息,不帶時間戳。outputFileError(file, t)— 將Throwable堆疊連同時間戳記寫入錯誤檔。logToFile_NpcScript_Bug(chr, msg)— 專用於記錄 NPC 腳本例外, 帶入MapleCharacter名稱與當前 NPC ID。CurrentReadable_Time()/CurrentReadable_Date()— 取格式化時間字串。
單一日誌檔超過 1 MB 時自動重新命名(加時間戳後綴)並建立新檔,防止無限膨脹。
檔案寫入以 UTF-8 編碼(除少數例外使用 Encoding.DEFAULT MS950)。
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidlogToFile_NpcScript_Bug(MapleCharacter chr, String msg) static voidlogToFileIfNotExists(String file, String msg) static StringNowTime()static voidoutputFileError(String file, Throwable t) static voidstatic voidstatic voidprintError(String name, String s) static voidprintError(String file, String function, Throwable t, String msg) static voidprintError(String name, Throwable t, String info)
-
Field Details
-
Acc_Stuck
- See Also:
-
Login_Error
- See Also:
-
Script_Bug
- See Also:
-
Pinkbean_Log
- See Also:
-
ScriptEx_Log
- See Also:
-
PacketEx_Log
- See Also:
-
Donator_Log
- See Also:
-
Hacker_Log
- See Also:
-
Movement_Log
- See Also:
-
CommandEx_Log
- See Also:
-
UnknownPacket_Log
- See Also:
-
KnownPacket_Log
- See Also:
-
-
Constructor Details
-
FileoutputUtil
public FileoutputUtil()
-
-
Method Details
-
log
-
log
-
logToFile
-
logToFile
-
logToFileIfNotExists
-
logToFile
-
logToFile
-
outputFileError
-
getChineseData
-
CurrentReadable_Date
-
CurrentReadable_Time
-
CurrentReadable_TimeGMT
-
NowTime
-
getString
-
logToFile_NpcScript_Bug
-
print
-
print
-
printError
-
printError
-
printError
-