Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Log4D. Made by analogy with Log4j.
TLogBasicConfigurator.Configure(TLogRollingFileAppender.Create('filelog', 'file.log',
TLogPatternLayout.Create('%d %p [%c] (%a:%t) - %m%n'), True, 'InterProcessLock',
10 * 1024 * 1024, 3));
DefaultHierarchy.Root.Level := TLogLevel.GetLevel('all');
I analyzed what is on the Internet and realized that for my tasks it is better and easier to write a simple procedure myself
function Log_write(fname, text:string):string;
var f:TStringList;
begin
if not DirectoryExists('logs') then CreateDir('logs');
f:=TStringList.Create;
try
if FileExists('logs\'+fname+'.log') then
f.LoadFromFile('logs\'+fname+'.log');
f.Insert(0,DateTimeToStr(Now)+chr(9)+text);
while f.Count>1000 do f.Delete(1001);
f.SaveToFile('logs\'+fname+'.log');
finally
f.Destroy;
end;
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question