Welcome to Ashutosh Nilkanth’s Blog on Life and Technology!

You can quickly checkout the blog’s “greatest hits“, or read a post from the archives.
Or you can continue reading the latest posts and articles below, and rate them by selecting a star rating to the right of each post.

Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. You can also follow me on Twitter. Thanks for visiting!


LogThis Update

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

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!


Leave a Comment

(required)

(required)

Formatting Your Comment

The following XHTML tags are available for use:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

URLs are automatically converted to hyperlinks.