From fe0a89e41642b1ec08a0955c9d442c4384005294 Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Fri, 29 Nov 2024 17:01:06 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20=20=20=E9=BB=98=E8=AE=A4=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=96=87=E4=BB=B6=E6=97=B6=E9=97=B4=E6=94=B9=E4=B8=BA?= =?UTF-8?q?10=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/lgDef.hrl | 2 -- src/backend/lgBkdFile.erl | 13 ++----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/include/lgDef.hrl b/include/lgDef.hrl index 06266b6..b0b7f81 100644 --- a/include/lgDef.hrl +++ b/include/lgDef.hrl @@ -6,8 +6,6 @@ -define(ERR(Format), error_logger:error_msg(Format)). -define(ERR(Format, Args), error_logger:error_msg(Format, Args)). --define(Print(Args), io:format("IMY************~p~n", [Args])). - %% 额外进程字典key -define(PdMdKey, pdLgMd). -define(LgTrackSink, '_trace_sink'). diff --git a/src/backend/lgBkdFile.erl b/src/backend/lgBkdFile.erl index 6c6d0f8..5a61235 100644 --- a/src/backend/lgBkdFile.erl +++ b/src/backend/lgBkdFile.erl @@ -184,7 +184,6 @@ code_change(_OldVsn, State, _Extra) -> writeLog(#state{fileName = FileName, fd = Fd, inode = Inode, cTime = CTime, flap = Flap, size = RotSize, rotator = Rotator, lastCheck = LastCheck, checkInt = CheckInt, syncSize = SyncSize, syncInt = SyncInt} = State, Timestamp, Level, Msg) -> case isWriteCheck(Fd, LastCheck, CheckInt, FileName, Inode, CTime, Timestamp) of true -> - io:format("IMY****************111 ~p ~p ~p~n", [Fd, CheckInt, Timestamp]), %% need to check for rotation case Rotator:ensureLogFile(FileName, Fd, Inode, CTime, {SyncSize, SyncInt}) of {ok, NewFD, NewInode, NewCTime, FileSize} -> @@ -202,7 +201,6 @@ writeLog(#state{fileName = FileName, fd = Fd, inode = Inode, cTime = CTime, flap ?lgCASE(Flap, State, begin ?INT_LOG(?llvError, <<"Failed to reopen log file ~ts with error ~s">>, [FileName, file:format_error(Reason)]), State#state{flap = true} end) end; _ -> - io:format("IMY***************222 ~p ~p ~p~n", [Fd, CheckInt, Timestamp]), writeFile(State, Level, Msg) end. @@ -229,16 +227,9 @@ writeFile(#state{fd = Fd, fileName = FileName, flap = Flap, syncOn = SyncOn} = S isWriteCheck(undefined, _LastCheck, _CheckInt, _Name, _Inode, _CTime, _Timestamp) -> true; -isWriteCheck(_Fd, LastCheck, CheckInt, Name, Inode, CTime, Timestamp) -> +isWriteCheck(_Fd, LastCheck, CheckInt, _Name, _Inode, _CTime, Timestamp) -> DiffTime = abs(Timestamp - LastCheck), - case DiffTime >= CheckInt of - true -> - % We need to know if the file has changed "out from under eLog" so we don't write to an invalid Fd - {Result, _FInfo} = lgUtil:isFileChanged(Name, Inode, CTime), - Result; - _ -> - false - end. + DiffTime >= CheckInt. %% Convert the config into a gen_event handler ID configToId(Config) ->