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

  • SEARCH
  • Home
  • 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 8807389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:21:25+00:00 2026-06-14T02:21:25+00:00

The following code: static void Main(string[] args) { TraceSource ts = new TraceSource(MyApplication); ts.Switch

  • 0

The following code:

static void Main(string[] args)
{
    TraceSource ts = new TraceSource("MyApplication");

    ts.Switch = new SourceSwitch("MySwitch");
    ts.Switch.Level = SourceLevels.All;

    ts.Listeners.Add(new TextWriterTraceListener(Console.Out));

    ts.TraceInformation("Hello World");
    Console.ReadKey();
}

generates the following output:

MyApplication Information: 0 : Hello World

The part “MyApplication Information: 0 :” at the beginning of the trace output is coming from the TraceSource class itself.

However, I need to have a timestamp at the beginning of the line and I would like to change “Information” to “Info” also.

Is there any way to get more freedom in trace output such that I can configure it to be like:

13:03:00 – MyApplication Info: Hello World

I tried for a couple of hours, but with no success. Whatever I do, at the beginning of the output line, there is always this constant predefined “MyApplication Information: 0 : Hello World” output.

MSDN documentation did also not reveal any helpful information.

  • 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-06-14T02:21:26+00:00Added an answer on June 14, 2026 at 2:21 am

    Set the TraceOutputOptions property on the trace listener. The format is predefined, but you can opt-in for the additional pieces of data defined by the TraceOptions enum.

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

Sidebar

Related Questions

I have the following code: class Program { static void Main(string[] args) { new
Considering following code public class A { public static void main(String[] args) { new
Consider the following code: static void Main(string[] args) { using (MemoryStream memoryStream = new
The following code public static void main(String[] args) { fun(new Integer(1)); } static void
In the following code: private static void Main(string[] args) { var listy = new
Consider the following code: class Program { static void Main(string[] args) { new Program().Run(args);
I have the following Java code: public static void main(String[] args) { new Thread(new
i have written the following code class Program { static void Main(string[] args) {
I have the following code: class Test { public static void main(String[] args) {
The following code works perfectly. public class StaticClass { public static void main(String[] args)

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.