Pages

Showing posts with label Environment.NewLine. Show all posts
Showing posts with label Environment.NewLine. Show all posts

Monday, September 2, 2013

How to add new line when creating error log file.



File.AppendAllText(MapPath("ErrorLog.txt"), ex.Message.ToString() +|+DateTime.Now()+ Environment.NewLine);


It Creates a errorlog file contains all your exceptions with the new lines..

o/p comes like this format :

any Exception | 9/2/2013 4:35:18 PM 
any Exception | 9/2/2013 4:35:25 PM 
any Exception | 9/2/2013 5:30:18 PM 
any Exception | 9/2/2013 5:35:10 PM

--------------------------------------

Easy understand ::::

"Environment.NewLine"  =  "\n"