Windows事件查看器c#不具体记录日志

时间:2016-03-30 07:26:08

标签: c# events viewer

我的Windows事件查看器未按预期记录到我的事件查看器。

public class Eventlog : LogDate
{
    public void logEvent(string answer)
    {

       this.localDate = new DateTime();


        try
        {
            string sSource;
            string sLog;
            string sEvent;

            sSource = "dotNET Sample App";
            sLog = "filmdatabase";
            sEvent = answer;

            if (!EventLog.SourceExists(sSource))
            {
                EventLog.CreateEventSource(sSource, sLog);
            }


            EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Error, 234, 1);
        }
        catch (Exception exc)
        {
            MessageBox.Show("Oops! Something went wrong trying to log. \n\n" + exc , "Filmdatabase Error");
        }
    }
}

}

当我尝试登录时,它只会记录:启动数据库' db_film'。 而不是应用程序中的错误和警告。

0 个答案:

没有答案
相关问题