LogThis Update

I’ve been working on this data integration (between SAP Business One and a 3rd-party logistics system) project, on which I had a special need for an event logging class in C# .NET. The in-built logging class (System.Diagnostics.EventLog) of .NET is simple enough and good for basic applications but the special feature that I needed was for file roll-overs such that an archive of log files could be automatically maintained (eg: mylog.[datetime].log) based on the specified max filesize or even the max number of lines in the log file. I googled a bit and found this listing of some C# logging tools. After reviewing the project summary of the LogThis class I decided to integrate it with the project, as I was looking for a quick yet robust solution. LogThis is an open source logging drop-in class and quite functional, although not as advanced as log4net or NLog, but it seemed like it would solve my purpose … or so I thought.

Unfortunately, LogThis doesn’t quite support log file roll-overs, instead it truncates the main log file and resumes appending log text to the same file, which was unacceptable in my case. So after a bit of tweaking the code of the LogThis class, I added a new method to support log file roll-overs. Well, if anyone has a need for the updated revision (v1.3.1) then you can download it here. The code is provided ‘as-is’ without any warranty. Please do not submit any support requests here, but kindly do share any updates you make. Cheers!

Show Comments