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 6122845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:56:50+00:00 2026-05-23T15:56:50+00:00

I am printing a lot of lines in my log while debugging like this:

  • 0

I am printing a lot of lines in my log while debugging like this:

System.Diagnostics.Debugger.Log(0, null, responseFromServer);
System.Diagnostics.Debugger.Log(0, null, t[0]); 
....

All of them are getting printed at the same line.. How can i make them print in seperate lines?

I tried using

System.Diagnostics.Debugger.Log(0, null, t[0]+"\n");

But, it didnt work. Any help will be appreciated . Thanks

  • 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-23T15:56:50+00:00Added an answer on May 23, 2026 at 3:56 pm

    In .NET the idiom Environment.NewLine is a System.String that consists of the proper System.Char(s) to terminate a line of text, so:

    System.Diagnostics.Debugger.Log(0, null, t[0] + Environment.NewLine);
    

    [Updated 2015-05-07]

    Reflecting upon this a few years on, i feel like i dropped the ball on this at least a little bit (though, i do think that it’s important to be able to do the low-level NewLine without having to fight the language sometimes as well; so i also like the original answer…)

    First off, David Brown did give a good answer below: using System.Diagnostics.Debug.WriteLine (and Write) instead. That is a good solution to this, especially in the case of the OP, as the other parameters of the call aren’t even really being used; and the Debug.Write/WriteLine calls looks like this (using for examples the OP’s original calls, assuming for the sake of example that the OP’s original first parameter responseFromServer was already terminated, and the second needed termination):

    System.Diagnostics.Debug.Write(responseFromServer);
    System.Diagnostics.Debug.WriteLine(t[0]);
    

    Easy peasy.

    Better yet though, why not Trace?

    I will just point you to this stackoverflow question here but here’s the gist.

    You can set up in your App.config but, of course you can also just create it all programatically as well, since the app.config sections simply create objects!

    Something like:

         ⋮
       <trace>
          <!-- note: notional notation only -->
          <add name="consoleLog" logLevel="debug" enabled="" type="⋯ 
          <add name="netLog" logLevel="verbose" enabled="false" addr="rdp://127.0.0.1:1935/nothing/stream" type="⋯
          <add name="fileLog" logLevel="errors" enabled="true" file="c:\boots.ini" type="⋯ 
       </trace>
         ⋮ 
    

    and then your code calls Trace() just like Debug().

    System.Diagnostics.Trace.Write(responseFromServer);
    System.Diagnostics.Trace.WriteLine(t[0]);
    

    Yep, it’s multi-target; and you can set it up to be multi-target, and you can either use built-in System.Diagnostics Trace types (like a Console tracer if you want to print to the screen, for example) or you can create your own custom types as necessary. Beautiful!

    Last word: both Debug and Trace have lots of helper functions that are there to make whatever writes you’re doing more symbolic; WriteLineIf, TraceError, etc. and it pays to play around with them until you figure out why they are there. It’s almost guaranteed that the more you use them, the more useful you will find them. ♡

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

Sidebar

Related Questions

I'm printing a document by creating a System.Diagnostics.Process object and then setting the StartInfo
There's a graph with a lot of nodes, and very few edges between them
I'm using the Java default logger, and right now it's printing a lot of
I draw a lot of lines rectangles each frame in my game - it's
I see a lot of questions about how to remove them, but I haven't
I've been searching a lot but I haven't found anything about this question. I'm
for my small printing business i would like to have an upload tool on
For a long time now, we've had a logging system that worked much like
I would like to take input from a text file in Perl. Though lot
Printing button is not shown in the report toolbar when they are opened in

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.