66366 members! Sign up to stay informed.

Sponsored Links


Resources

.NET Research Library
Get .NET related white papers, case studies and webcasts

News News News Messages: 4 Messages: 4 Messages: 4 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

Rolling TextWriter TraceListener log files

Posted by: Ted Neward on May 01, 2004 DIGG
One of the classic diagnostic tricks for long-running services is to have useful information written to log files for later perusal; unfortunately, those files often grow very large, so people "roll" them to different filenames as time progresses. Dave Bost describes how to do this for System.Diagnostic.TraceListeners.

Check out his weblog for his first-cut solution. One question he asks:
There is one question I hope the blog community can help me come to a conclusion on. What happens when the log file rolls over and another process is trying to write a trace message during the rollover? Does that message get lost? Can I solve it through thread synchronization? Is this even an issue?

Threaded replies

·  Rolling TextWriter TraceListener log files by Ted Neward on Sat May 01 03:14:00 EDT 2004
  ·  Re-invent the wheel by Lance Fogtman on Tue May 04 10:32:14 EDT 2004
    ·  Re-invent the wheel by B K on Tue May 04 10:49:26 EDT 2004
    ·  Point taken by Dave Bost on Tue May 04 10:50:59 EDT 2004
      ·  Does or will MS have its own by rui fan on Sat May 08 11:05:30 EDT 2004
  Message #120567 Post reply Post reply Post reply Go to top Go to top Go to top

Re-invent the wheel

Posted by: Lance Fogtman on May 04, 2004 in response to Message #120240
<digression>
Why is it that we continually re-invent the wheel? MS leveraged the experience of the existing development platforms/languages (C++, Java, Delphi, etc.) to create the .Net platform. This is the classic "technology leapfrog" strategy employed by companies (leverage and extend). So, why is it that we (the .net community) are not leveraging well-known technologies? The log4j logging/diagnostic framework is the dominant player in the Java community and the log4net port is a very usable .net analog. The log4j community solved these problems a while back with solutions that are (for the most part) platform AGNOSTIC.

Hence, if the dominant languages and development platforms are on a convergent path, then why do we diverge with the tools, frameworks, etc? Does this make sense? I am remiss to taint your thread with this tangent but this is a painful spot for me and the development teams that I represent. We do both .net and java development and prefer to use a neutral platform with as many semantically equivalent tools, frameworks, patterns, etc. as possible.
</digression>

I suggest you look at the log4j rolling file appender for an idiom to manage this timing issue.

Thanks,
Lance

  Message #120572 Post reply Post reply Post reply Go to top Go to top Go to top

Re-invent the wheel

Posted by: B K on May 04, 2004 in response to Message #120567
I agree with you in using Log4Net rather than reinventing the wheel. Even in Java World Sun introduced there own logging thingy instead of using log4j.
NOT INVENTED HERE syndrome i guess.

  Message #120573 Post reply Post reply Post reply Go to top Go to top Go to top

Point taken

Posted by: Dave Bost on May 04, 2004 in response to Message #120567
Lance, I whole heartedly agree with you 100%. There's no need to re-invent the wheel. However, this excercise was more for my own benefit in understanding how much trouble someone can get into by implementing such as a simple feature. I can almost guarantee developers are creating these types of implementations without really understanding the consequences. I was just trying to get a dialog started to discuss the issues.

With that said, I will fire up my browser and pull down log4net.

Thanks for the advice.

Dave B.

  Message #121173 Post reply Post reply Post reply Go to top Go to top Go to top

Does or will MS have its own

Posted by: rui fan on May 08, 2004 in response to Message #120573
Log4J is good, but then Sun introduced their own anyway. So my question is does MS already have a solution that's like Log4net or will MS introduce one in .NET 2.0? Thanks for any feedback!

Ray.

 
New content on TheServerSide.NETNew content on TheServerSide.NETNew content on TheServerSide.NET

DSLs and language interop

Language "mashups" will become more prominent, and developers will become polyglots, one programmer suggests.

VS 2008 Resources

SearchWinDevelopment.com offers an introduction to the language, performance, testing and data management improvements in VS 2008.

VB code downloads home

VBCode.com code snippets cover all aspects of application development, from data binding to security to the user interface.

XAML Learning Guide

Get up to date on XAML best practices with a variety of articles, tutorials and webcasts. [SearchWinDevelopment.com]

Company uses VSTS DB edition to tame workflow

One team's experience with the VSTS DB edition suggests that it can improve workflow for dev teams. It also enhanced Agile efforts. (June 24, Article)

Book: Intro to DSL Tools

Microsoft has begun to include DSL tools in the VSTS kit. A new book by Steve Cook and other VSTS team members helps set the stage. (June 24, Article)

I See the Silverlight Shining!

Cartoon: Be it ever so humble there is no place like your home after you get a Microsoft Home Server . (June 18, Cartoon)

A look at .NET 3.5

Microsoft's Thom Robbins says new technology to highlight in NET 3.5 includes AJAX, LINQ for both C# and VB, as well as tooling enhancements intended to ease the task of building WPF, WF and WCF apps. (June 29, Podcast)

Venkat Subramaniam on AJAX

Venkat Subramaniam discusses AJAX bottlenecks, the tenets of Agile development and more. He spoke at the Ajax Experience. (June 25, Tech Talk)

Building a Claims-Based Security Model in WCF - Part 2

In the second of a two-part series, Michele Leroux Bustamente discusses design decisions related to the claims-based security model. Read the story and walk through the process for creating a set of claims-based utilities to encapsulate claims authorization at the service tier. (May 24, Article)

Introducing the Entity Framework

Understanding why the Entity Framework exists and learning where it can fit into your projects can get you prepared for the eventual release early next year. (May 10, Article)

WCF Security Learning Guide

Resource: This learning guide gives you quick access to useful links on Windows Communication Foundation security information. (April 24, Article)

Brad Abrams: Patterns for successful ASP.NET AJAX development

TSS.NET's Jack Vaughan spoke recently spoke with Microsoft's Brad Abrams to find out what he is seeing in the field and what the chefs in Redmond are cooking. Along the way he discusses patterns of AJAX frameworks. (April 11, Article)

Building a Claims-Based Security Model in WCF

In a two-part series, Michele Leroux Bustamente explains how claims-based security is supported by WCF, and how you can implement a claims-based security model for your services. (March 29, Article)

Authoring workflow using XAML

Windows Workflow Foundation is a new technology that many developers will need to get their heads around. In a brief excerpt adapted from Programming Windows Workflow Foundation: Practical WF Techniques and Examples using XAML and C#, K.Scott Allen considers aspects of workflow definition. (March 22, Chapter Excerpt)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map