MicroKnights.Log4NetAdoNetAppender 1.0.0

There is a newer version of this package available.
See the version list below for details.
Install-Package MicroKnights.Log4NetAdoNetAppender -Version 1.0.0
dotnet add package MicroKnights.Log4NetAdoNetAppender --version 1.0.0
<PackageReference Include="MicroKnights.Log4NetAdoNetAppender" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MicroKnights.Log4NetAdoNetAppender --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MicroKnights.Log4NetAdoNetAppender, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MicroKnights.Log4NetAdoNetAppender as a Cake Addin
#addin nuget:?package=MicroKnights.Log4NetAdoNetAppender&version=1.0.0

// Install MicroKnights.Log4NetAdoNetAppender as a Cake Tool
#tool nuget:?package=MicroKnights.Log4NetAdoNetAppender&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Log4NetAdoNetAppender

.Net Standard 1.3 AdoNetAppender

A late night fix since it do not exists for .net core for some odd reason. This project will only exists until the official logging.apache.org project is releasing their own AdoNetAppender within the log4net package.

How to setup

You log4net.config AdoNetAppender configuration

<log4net>
  <appender name="AdoNetAppender" type="MicroKnights.Logging.AdoNetAppender, MicroKnights.Log4NetAdoNetAppender">
    <bufferSize value="1" />
    <connectionType value="System.Data.SqlClient.SqlConnection,System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" />
    <connectionStringName value="log4net" />
    <connectionStringFile value="connectionstrings.json" />
    <commandText value="INSERT INTO Log ([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="%thread" />
        </layout>
    </parameter>
    <parameter>
        <parameterName value="@log_level" />
        <dbType value="String" />
        <size value="50" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%level" />
        </layout>
    </parameter>
    <parameter>
        <parameterName value="@logger" />
        <dbType value="String" />
        <size value="255" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%logger" />
        </layout>
    </parameter>
    <parameter>
        <parameterName value="@message" />
        <dbType value="String" />
        <size value="4000" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%message" />
        </layout>
    </parameter>
    <parameter>
        <parameterName value="@exception" />
        <dbType value="String" />
        <size value="2000" />
        <layout type="log4net.Layout.ExceptionLayout" />
    </parameter>
  </appender>

With 2 changes, you are up and running in your .net core project.

First you must change/replace the type and assembly name, from this:

<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">

to this:

<appender name="AdoNetAppender" type="MicroKnights.Logging.AdoNetAppender, MicroKnights.Log4NetAdoNetAppender">

Secondly you must specify the configurationfile where your connectionstrings are defined. A new property in the configuration is added - called ConnectionStringFile. It will then locate the connectionstring by using ConnectionStringName.

NuGet Package

PM> Install-Package MicroKnights.Log4NetAdoNetAppender

NuGet packages (5)

Showing the top 5 NuGet packages that depend on MicroKnights.Log4NetAdoNetAppender:

Package Downloads
MicroKnights.Log4NetHelper

Set ConnectionString manually, Enable internal Debugging, Show configuration messages

DotStat.Common

DotStatServices common libraries

NPlatform.Infrastructure

2021/10/18 ServiceConfig 增加主从库连接配置 2021/10/11 修改配置获取的BUG 2021/9/29 配置扩展方法的调整,改为 服务配置、redis配置、授权配置3个节点 2021/9/28 Not Platform 基础设施, 支持 .net core 3.1\5.0 用于定义一些通用工具类、通用的常量、配置约定、等。

Apsiyon

Apsiyon framework is a helpful framework that creates your .Net projects in the simplest way, does cross cutting concerns for you and helps you to write code faster in your projects.

UtilityStore

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on MicroKnights.Log4NetAdoNetAppender:

Repository Stars
engindemirog/NetCoreBackend
Version Downloads Last updated
2.2.1-alpha.2 84 9/13/2021
2.2.1-alpha.1 3,834 9/8/2020
2.2.0 187,779 7/26/2020
2.2.0-alpha2 305 7/20/2020
2.2.0-alpha1 241 7/20/2020
2.1.2 63,397 5/12/2020
2.1.0 9,502 4/1/2020
2.0.1 82,093 11/22/2019
2.0.0 3,057 11/16/2019
1.0.2 177,484 5/2/2018
1.0.1 7,298 2/25/2018
1.0.1-alpha 547 2/25/2018
1.0.0 2,443 2/10/2018