Hope this helps you:
I am trying the code from the link: GlobalCache.Instance.AppPathError 13 The name 'GlobalCache' does not exist in the current context
public void LogErrors(Exception ex)
StreamWriter _sw = null;
//Instantiate an appendable streamwriter that writes to a file called ErrorLog.txt
_sw = new StreamWriter(GlobalCache.Instance.AppPath + "ErrorLog.txt", true, System.Text.Encoding.ASCII);
//Write a row of data containing the time, the error message, and the stack trace
_sw.WriteLine("* " + System.DateTime.Now.ToString() + " | " + ex.Message + " | " + ex.StackTrace);
//Ensure the streamwriter gets closed
if (_sw != null)
_sw = null;
Im not sure exactly what it is you wish to log but the .netcf framework provides the ability to enable logging of various things.
Hope this helps.