Lines get mixed up in the logs because of line breaks!
When using line breaks in the same string, sometimes for some reason the lines get swapped. For example, if I use Console.WriteLine("Line1\r\nLine2"); sometimes I see Line2 before Line1 (doesn't matter if I use \n only or \r\n).
It kinda makes the logs harder to read because of this issue. I'd like to know the reason and whether i can fix it or not.
Thank you in advance!
Discussions are closed to public comments.
If you need help with AppHarbor please
start a new discussion.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
Support Staff 1 Posted by rune on 18 Aug, 2017 03:02 AM
Hi,
I'm not quite sure why this would happen, but I haven't seen it before -- and some log messages will contain line breaks, for instance when logging exceptions. Do you have an example of this that I can take a closer look at?
Also, is there a particular reason you use
Console.WriteLinerather thanConsole.Write? I suspect you may be able to fix the issue by using the latter, but it's still odd if you're seeing inconsistent behavior for the same log messages regardless of the newline characters you use.Best,
Rune
2 Posted by Kef on 18 Aug, 2017 09:47 AM
See the attached files for an example of that I mean.
Also, do you mean that I should use `Console.Write` instead? I don't think it matters since the string itself has line breaks. I even tried `Environment.NewLine` property (though i'm pretty sure either \n or \r\n would work fine)
Thank you