Multiple Listeners

Topics: Logging Application Block
Nov 10, 2008 at 9:22 PM
Edited Nov 10, 2008 at 9:23 PM

            I am very beginner using enterprise library. I am preparing sample application using logging application block. I am able to configure and write events to flat file. Now i am developing sample application to write inforation into data base using logging application block. I want to write the information into event log when  data base insertion fails. So i created two listeners, one for data base second for event log.

            Now the problem how i can refer the particular listner in my code.
              Ex:  where i need to mention in code write informqation into event log or data base.....

Can you please help me on this? Really appreciate if any sample code...

Nov 11, 2008 at 12:06 AM
You just need to specify the category.  For example, if you're FlatFile TraceListener is under the General category, your log entry should have something like this:

LogEntry entry = new LogEntry();

and if the Database TraceListener is under the Audit category:

LogEntry entry = new LogEntry();

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
Nov 11, 2008 at 3:21 PM
Hi Sarah,

              Thank you very much for your quick response and  explanation. My issue is i want to write the log information into data base with category "General". I want to write into event log with category "General"  when an error whilw inserting log information into data base. Inthis case my category is same. I am sure, i missing something. Can you please advice me on this?

Thanks in advance
Nov 12, 2008 at 1:09 AM
See this thread...

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.