2012-11-05 27 views
4

Log.Info下面的String.Format方法中的\ n將文本打印爲「\ n」而不是開始新行;爲什麼它不起作用?任何想法?我怎樣才能使它工作?爲什麼 n在Log.Info方法中不起作用?

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

謝謝!

+0

A,對不起,我以爲你會考慮標記列表中的Log4Net。 – pencilCake

+0

我的歉意,我不知何故錯過了它。 –

回答

10

在窗口上,換行實際上是\r\n。試試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)); 
相關問題