Exemple #1
0
        public static void WriteDebugLog(string str)
        {
            if (enableLog.Equals("true", StringComparison.OrdinalIgnoreCase))
            {
                CleanUpProcess.RenameLogFiles();
                StreamWriter writer = null;
                try
                {
                    string progTime = String.Format("_{0:yyyyMMdd}", DateTime.Now);
                    string location = appPath + "\\Logs\\F-" + Thread.CurrentThread.Name + progTime + "-Status.txt";

                    writer = new StreamWriter(location, true, Encoding.UTF8, 8195);
                    writer.WriteLine(string.Format("{0} : Debug - {1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"), str));
                    writer.Flush();
                }
                catch { }
                finally
                {
                    if (writer != null)
                    {
                        writer.Close();
                        writer.Dispose();
                    }
                }
            }
        }
Exemple #2
0
        public static void WriteErrorLog(string str)
        {
            StreamWriter writer = null;

            try
            {
                CleanUpProcess.RenameLogFiles();
                string progTime = String.Format("_{0:yyyyMMdd}", DateTime.Now);
                string location = appPath + "\\Logs\\F-" + Thread.CurrentThread.Name + progTime + "-Status.txt";

                writer = new StreamWriter(location, true, Encoding.UTF8, 8195);
                writer.WriteLine(string.Format("{0} : Exception - {1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff"), str));
                writer.Flush();
            }
            catch { }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                    writer.Dispose();
                }
            }
        }