1

Is there a way to use more than one ADONetAppender in the same application. Currently I have one ado appender logging to the "Log" table. I would like to add another ADONetAppender to log to another table in the same application. Searching the google did not return much help.

Please let me know.

thanks

dotnet-practitioner
  • 13,968
  • 36
  • 127
  • 200

2 Answers2

0

Yes, in my Blog post here: http://weblogs.asp.net/stevewellens/archive/2012/01/22/log4net-log-to-a-javascript-console.aspx I use three appenders.

Here is where they get listed:

<logger name="MyLogger">
  <level value="ALL" />
  <appender-ref ref="LogFileAppender"  />
  <appender-ref ref="TraceAppender"  />
  <appender-ref ref="JSConsoleAppender"  />
</logger>

There's more but I'm not going to duplicate the whole post here.

Steve Wellens
  • 20,506
  • 2
  • 28
  • 69
  • I did not understand from your post on how I could use *multiple AdoNetAppenders* within the same application. – dotnet-practitioner Apr 12 '12 at 23:05
  • Go to the definition of your appender in your config file and copy and paste it so you have two copies of the same appender. Then rename one of the copies. Then change it's settings to what you want (obviously you'll want different commandText). Then list both appenders similarly to what I posted (my post actually shows three separate appenders). – Steve Wellens Apr 13 '12 at 01:20
0

Below is the code to use multiple ADO Appender Just copy your ado appender and paste it again in your config file with below changes:

<appender name="CustomAppender" type="log4net.Appender.ADONetAppender">

Name of the appender should be different for Both the appender.

Then add into root tag

<root>
  <appender-ref ref="ADONetAppender"/>
  <appender-ref ref="CustomAppender"/>

Jyoti
  • 1