locked
Need to understand Log4Net Configuration section WebForm RRS feed

  • Question

  • User88744855 posted

    i was thinking to use Log4Net for our WebForm application in asp.net. so i checked few article on this but i saw all article not saying about each property regarding configuration.

    so i apologized that i have to paste bit big config section here and looking for some one who can help me to understand each property usage.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <log4net>
        <appender name="DbAppender" type="log4net.Appender.ADONetAppender">
          <bufferSize value="0" />
          <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          <connectionString value="{auto}" />
          <commandText value="INSERT INTO Log4Net ([date],[thread],[level],[logger],[message],[exception]) VALUES
             (@log_date, @thread, @log_level, @logger, @message, @exception)" />
          <parameter>
            <parameterName value="@log_date" />
            <dbType value="DateTime" />
            <layout type="log4net.Layout.RawTimeStampLayout" />
          </parameter>
          <parameter>
            <parameterName value="@thread" />
            <dbType value="String" />
            <size value="255" />
            <layout type="log4net.Layout.PatternLayout">
              <conversionPattern value="%t" />
            </layout>
          </parameter>
          <parameter>
            <parameterName value="@log_level" />
            <dbType value="String" />
            <size value="10" />
            <layout type="log4net.Layout.PatternLayout">
              <conversionPattern value="%p" />
            </layout>
          </parameter>
          <parameter>
            <parameterName value="@logger" />
            <dbType value="String" />
            <size value="1000" />
            <layout type="log4net.Layout.PatternLayout">
              <conversionPattern value="%c" />
            </layout>
          </parameter>
          <parameter>
            <parameterName value="@message" />
            <dbType value="String" />
            <size value="4000" />
            <layout type="log4net.Layout.PatternLayout">
              <conversionPattern value="%m" />
            </layout>
          </parameter>
          <parameter>
            <parameterName value="@exception" />
            <dbType value="String" />
            <size value="4000" />
            <layout type="log4net.Layout.ExceptionLayout" />
          </parameter>
        </appender>
    
        <root>
          <level value="INFO" />
          <appender-ref ref="RollingFileAppender" />
          <appender-ref ref="DbAppender" />
        </root>
      </log4net>
    </configuration>

    please see the above config details and answer each property. 1) why

    <bufferSize value="0" />

    is set to 0 ? when one should set other value to

    bufferSize

    property ?

    2)

    <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

    how do i know what

    PublicKeyToken

    value i need to use.

    3) what is the meaning of connection string auto

    <connectionString value="{auto}" />

    ?

    4)

    what is the meaning of conversionPattern or

    5 what is ExceptionLayout

    <layout type="log4net.Layout.ExceptionLayout" />

    6) what is the meaning of below xml

    <root>
      <level value="INFO" />
      <appender-ref ref="RollingFileAppender" />
      <appender-ref ref="DbAppender" />
    </root>

    what is

    RollingFileAppender

    ? what is

    DbAppender

    ?

    please discuss about my each point & question. thanks

    Saturday, October 18, 2014 11:24 AM

All replies