oguzhankircali
2/11/2018 - 12:14 AM

Log4Net.xml

<?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=”data source=IPAdres;Initial Catalog=VeritabaniAdi;user id=KullaniciAdi;password =Sifre;” />
            <commandText value=”INSERT INTO Log4Net ([date],[thread],[level],[logger],[message],[exception], [CurrentUsername],[IPAddress], [CurrentUrl], [UserAgent]) VALUES
                         (@log_date, @thread , @log_level , @logger , @message , @exception , @CurrentUser , @IPAddress , @CurrentUrl , @UserAgent )” />
            <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>
            <parameter>
                <parameterName value=”@CurrentUser” />
                <dbType value=”String” />
                <size value=”4000″ />
                <layout type=”log4net.Layout.PatternLayout”>
                    <conversionPattern value=”%property{CurrentUser}” />
                </layout>
            </parameter>
            <parameter>
                <parameterName value=”@IPAddress” />
                <dbType value=”String” />
                <size value=”4000″ />
                <layout type=”log4net.Layout.PatternLayout”>
                    <conversionPattern value=”%property{IPAddress}” />
                </layout>
            </parameter>
            <parameter>
                <parameterName value=”@CurrentUrl” />
                <dbType value=”String” />
                <size value=”4000″ />
                <layout type=”log4net.Layout.PatternLayout”>
                    <conversionPattern value=”%property{CurrentUrl}” />
                </layout>
            </parameter>
            <parameter>
                <parameterName value=”@UserAgent” />
                <dbType value=”String” />
                <size value=”4000″ />
                <layout type=”log4net.Layout.PatternLayout”>
                    <conversionPattern value=”%property{UserAgent}” />
                </layout>
            </parameter>
        </appender>
        <root>
            <level value=”INFO” />
            <appender-ref ref=”RollingFileAppender” />
            <appender-ref ref=”DbAppender” />
        </root>
    </log4net>
</configuration>