浏览代码

ft: 默认检查文件时间改为10秒

master
SisMaker 6 个月前
父节点
当前提交
fe0a89e416
共有 2 个文件被更改,包括 2 次插入13 次删除
  1. +0
    -2
      include/lgDef.hrl
  2. +2
    -11
      src/backend/lgBkdFile.erl

+ 0
- 2
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').

+ 2
- 11
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) ->

正在加载...
取消
保存