tags:

views:

24

answers:

2

Hello, How to config EventLogAppender for write only events from my app. Because, currently I have next configuration:

    var elAppender = new EventLogAppender
                         {
                             ApplicationName = "My App",
                             LogName = "My Log",
                             Layout = new PatternLayout(default_format),
                             Threshold = Level.Error
                         };
    elAppender.ActivateOptions();

and in My Log present all messages from the all applications like Application, bu I need events only from My App. Thank you.

A: 

You could create a filtered view within Event Viewer. This way, you don't need to change your application.

Daniel Dyson
Ok, and how can I to do this? I create LoggerMatchFilter and assign filter.LoggerToMatch = name of my log; But My Log this is not another File in the system this copy of Application file. And system can write to my log all system application events. How can I create EventLogAppender as different file?
jitm
A: 

I found solution :),

I recreated my appender without spaces in the name and everything worked :) the code like this:

var elAppender = new EventLogAppender
                         {
                             ApplicationName = **"MyApp"**,
                             LogName = **"MyLog"**,
                             Layout = new PatternLayout(default_format),
                             Threshold = Level.Error
                         };
    elAppender.ActivateOptions();
jitm