6

I need to make my C# application to write log in Windows Event viewer.

I Used ,

 <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
  <param name="ApplicationName" value="DataLoader" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value='{"Processed":"%d{yyyy-MM-dd HH:mm:ss}","Loglevel":"%p","Service":"DataLoader","Instance":"","AdditionalInfo":"%c{1}|%M","logtext":"%m%n"}'/>
  </layout>
</appender>

No Errors in Console but it does not write logs in windows event viewer

Jeeva N
  • 431
  • 1
  • 5
  • 17
  • 1
    Is that all?Did you define your event sources? – Hasan Emrah Süngü Jul 04 '17 at 07:26
  • Yes i have defined event source in registry – Jeeva N Jul 04 '17 at 07:29
  • `public class MyEventSource:EventSource{ void Debug(string formatted, string message, string environment, string member, string path, int line) { WriteEvent(6, formatted, message, environment, member, path, line); } }` something like these – Hasan Emrah Süngü Jul 04 '17 at 07:32
  • I used xml config file for Windows event log writing. we found that the application name does not match with registry source – Jeeva N Jul 04 '17 at 07:44
  • Changed and it was worked. But Still i have doubt that why DataLoader not able to write event log Since i have created Dataloader source in registry – Jeeva N Jul 04 '17 at 07:45
  • I tried with some other source name it is working fine. But when i tried with name "DataLoader" It is not working – Jeeva N Jul 04 '17 at 07:59

0 Answers0