2016-03-30 50 views
0

我的Windows事件查看器没有按预期登录到我的事件查看器。Windows事件查看器c#没有特定的日志

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

愚蠢的问题,但你在事件查看器的正确位置?应用程序和服务日志/电影数据库? –

+1

谢谢,即时通讯如此愚蠢 –

回答

-1

盖伊

IK MOEST 30个字符力typen DUS票数。来JE minimaal 30个字符。

GG

+0

你是什么意思? –

相关问题