log4net.jt 2.0.8

There is a newer version of this package available.
See the version list below for details.

Requires NuGet 2.0.8 or higher.

dotnet add package log4net.jt --version 2.0.8                
NuGet\Install-Package log4net.jt -Version 2.0.8                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="log4net.jt" Version="2.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add log4net.jt --version 2.0.8                
#r "nuget: log4net.jt, 2.0.8"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install log4net.jt as a Cake Addin
#addin nuget:?package=log4net.jt&version=2.0.8

// Install log4net.jt as a Cake Tool
#tool nuget:?package=log4net.jt&version=2.0.8                

log4net 的扩展,支持mongodb,Elasticsearch,支持自定义文件名

----------------------------------

配置文件:log4net.config

<?xml version="1.0" encoding="utf-8" ?>
<log4net debug="false">

 <appender name='ElastAppender' type='log4net.Appender.ElastAppender'>
   <connectionString value='http://127.0.0.1:9200@log4net@3600' />
   <bufferSize value="1" />
   <filter type="log4net.Filter.LevelRangeFilter">
     <levelMin value="Debug" />
     <levelMax value="FATAL" />
   </filter>
 </appender>

 <appender name='MongoDBAppender' type='log4net.Appender.MongoDBAppender'>
   <connectionString value='mongodb://log4net1:pass!#123@127.0.0.1:27017/log4net' />
   <bufferSize value="1" />
   <filter type="log4net.Filter.LevelRangeFilter">
     <levelMin value="Debug" />
     <levelMax value="FATAL" />
   </filter>
 </appender>

 <root>
   <priority value="ALL" />
   <!--<appender-ref ref='ElastAppender' />-->
   <appender-ref ref='MongoDBAppender' />
   <appender-ref ref='FileAppender' />
 </root>

 <logger name="MongoDBLogger" additivity="false">
   <appender-ref ref="MongoDBAppender"  />
 </logger>
 <logger name="FileLogger" additivity="true">
   <appender-ref ref="FileAppender"  />
 </logger>
</log4net>


----------------------------------

配置文件: Web.config

<appSettings>
 <add key="appid" value="100005"/>
<appSettings>

----------------------------------


log4net.ILog log = log4net.LogManager.GetLogger(repository.Name, "NETCorelog4net");


string FilePath = System.IO.Directory.GetCurrentDirectory() + "\\文件夹a\\自定义文件.txt";
string FilePath1 = System.IO.Directory.GetCurrentDirectory() + "\\文件夹b\\自定义文件b.txt";

log.Info("11111111111111");

log.File(FilePath).Info("22222222222222");

log.File(FilePath).Method("方法名(Main3)").InfoFormat("33333333333333333333333");

log.Method("方法名(Main4)").Info("4444444444444444444444");

log.Info("55555555");

log1.File(FilePath1).Info("6666");

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.8.32 1,172 2/24/2023
2.0.8.31 1,177 2/23/2023
2.0.8.30 1,343 9/28/2022
2.0.8.29 1,228 11/12/2021
2.0.8.28 1,526 12/13/2019
2.0.8.27 1,473 12/5/2019
2.0.8.26 1,434 12/4/2019
2.0.8.25 1,490 12/4/2019
2.0.8.24 1,342 11/28/2019
2.0.8.23 1,491 11/26/2019
2.0.8.22 1,350 11/19/2019
2.0.8.21 1,547 11/18/2019
2.0.8.20 1,593 11/4/2019
2.0.8.19 1,467 10/10/2019
2.0.8.18 1,563 10/9/2019
2.0.8.17 1,491 10/8/2019
2.0.8.16 1,450 10/3/2019
2.0.8.15 1,314 10/3/2019
2.0.8.14 1,387 10/2/2019
2.0.8.13 1,341 10/2/2019
2.0.8.12 1,265 10/2/2019
2.0.8.11 2,504 9/30/2019
2.0.8 2,336 9/30/2019