Dotnet Core 經過Log4net記錄日誌,並經過ELK日誌系統收集日誌

log4net.config 日誌app

<appender name="ElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4net.ElasticSearch">

<layout type="log4net.Layout.PatternLayout,log4net">

<param name="ConversionPattern" value="%n【輸出時間:%d \[%t\], 級別:%-5p】:%m %n " />

</layout>

<connectionString value="Server=127.0.0.1;Index=log\_test;Port=9200;rolling=false"/>

<lossy value="false" />

<evaluator type="log4net.Core.LevelEvaluator">

<threshold value="ALL" />

</evaluator>

<bufferSize value="1" />

<filter type="log4net.Filter.LevelRangeFilter">

<param name="LevelMin" value="DEBUG" />

<param name="LevelMax" value="WARN" />

</filter>

</appender>
相關文章
相關標籤/搜索