logging exception in c#
<p><strong>logging exception</strong> 
 this is  below  code  which is used  for logging exception in a text file.
here i am getting only the decription of the error.</p>

<p><strong>but it is not  telling me  where the exception occured at which line.</strong>
would  any onr  tell me  howi can achive that  so that i get even the  line  number where  the exception occured.</p>

<pre><code>    try
     {

     }
   catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
      }

    #region WriteLogError
        /// &lt;summary&gt;
        /// Write an error Log in File
        /// &lt;/summary&gt;
        /// &lt;param name="errorMessage"&gt;&lt;/param&gt;
        public void WriteLogError(string errorMessage)
        {
            try
            {
                string path = "~/Error/" + DateTime.Today.ToString("dd-mm-yy") + ".txt";
                if (!File.Exists(System.Web.HttpContext.Current.Server.MapPath(path)))
                {
                    File.Create(System.Web.HttpContext.Current.Server.MapPath(path)).Close();
                }
                using (StreamWriter w = File.AppendText(System.Web.HttpContext.Current.Server.MapPath(path)))
                {
                    w.WriteLine("\r\nLog Entry : ");
                    w.WriteLine("{0}", DateTime.Now.ToString(CultureInfo.InvariantCulture));
                    string err = "Error in: " + System.Web.HttpContext.Current.Request.Url.ToString() +
                                  ". Error Message:" + errorMessage;
                    w.WriteLine(err);
                    w.WriteLine("__________________________");
                    w.Flush();
                    w.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogError(ex.Message);
            }

        }

        #endregion
</code></pre>
