Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why \n does not work in Log.Info method?

The \n in the String.Format method below within the Log.Info prints "\n" as a text instead of starting a new line; why it does not work? Any idea? How can I make it work?

Log.Info(String.Format("Some arguments : \n Since : {0}\nBefore: {1}\nLog file name : {2}", since, before,logFileName));

Thanks!

like image 737
pencilCake Avatar asked Dec 27 '22 15:12

pencilCake


1 Answers

On windows, the line feed is actually \r\n. Try Environment.NewLine:

Log.Info(String.Format("Some arguments : "+Environment.NewLine+" Since : {0}"+Environment.NewLine+"Before: {1}"+Environment.NewLine+"Log file name : {2}", since, before,logFileName));
like image 105
dwerner Avatar answered Jan 12 '23 18:01

dwerner