Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:18:40+00:00 2026-05-26T03:18:40+00:00

I want to implement some basic tracing in a simple c# (WPF) application that

  • 0

I want to implement some basic tracing in a simple c# (WPF) application that will only be used internally by testers. I basically want the testers to be able to view a log of what they’ve done and then optionally save it to a file (of their choosing). This would allow the testers to see what they’ve done thus far in the test and optionally save the log to file for posterity or whatever.

In researching how to implement simple tracing in .Net (using System.Diagnostics.Trace), it seems the default answer is to use log4net (or perhaps NLog, as referenced in Is log4net dead?) instead. My issue with that is that my tracing doesn’t need to be fully-featured or anything special, so it seems like overkill to implement an external library (which seems to be backed up by Jeff Atwood himself in a comment in How to save the output of a console application (and others elsewhere, but still…)). If either log4net or NLog is, in fact, the best/only answer (even in my case), I may still accept it (i.e. I’m not entirely closed to the idea of using them, but not terribly excited in it), but try not to harp on (/focus solely on) that one (if possible)…

With that in mind, does anyone have any suggestions on how to implement the listeners such that I can pop open a dialog with the trace log visible (e.g. via a View Log button) and then optionally save the contents of that dialog (or the trace log itself) to a file (e.g. via a Save Log button in the `View )?

It seems like it would be relatively simple to implement a listener that simply logs the traces to a collection of some sort in the app, in which case View simply shows the collection in a listbox or something and Save just saves that list to file (duh), but then what if the app stays open for a long time and the trace log grows super-large? Perhaps a buffer-type collection that only logs the last x messages? Suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:18:40+00:00Added an answer on May 26, 2026 at 3:18 am

    Redirecting your logger’s output to a text box will depend on the technology you opted for. I would recommend log4net or NLog (I am using the first one myself) instead of simply using .NET’s built in classes (or your own), because it is much more configurable, and it will prove valuable sooner or later.

    I am using log4net, and there are several examples on the web of how to attach its output to a text box (like this one, or this one, for example – although this latter example may lack some UI thread synchronization on first sight if used in a multithreaded app). Not only that, but you can also choose to log your data to a database, send it by e-mail, write it to the Windows’s Event Log, and many other great things, simply by adding a couple of lines to your config file.

    For a first time use, it may seem like an overkill, but it really isn’t. Setting up is quick and there are many examples out there. Once you use it, you will continue to add it to all of your future projects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I want to do is implement some basic security by checking not only
I'm developing a simple site for local student contest. I want to implement some
I want to implement a basic login system in some PHP app where no
We want to implement a sitemap.xml feature in out CMS system. There is some
Microsoft has announce that WindowsLiveID become a OpenID provider . I want implement it
I want to implement an automatic update system for a windows application. Right now
I am attempting to implement some very basic debugger protection to prevent kids from
I want to implement FSM like below First Level Most basic State is BASE_STATE.
I want to implement global variable in InstallShield, basic msi project (2011). I know
I want to write a program in Objective-c that grabs some sports stats off

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.