I have implemented log4net
into .NET core 2.0
, to log into a text file. As log4net have a config file, which is having XML configuration
in it. So, I have created a separate file log4net.config
to set its configuration and it is working fine. But I want to set its configuration into appsettings.json
. Is it possible to write the log4net configuration into appsettings.json
.
<appSettings>
<add key="IsLog" value="True" />
<add key="MaxThreads" value="3" />
</appSettings>
<log4net debug="false">
<root>
<level value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</root>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="./logs/logfile.txt" />
<appendToFile value="false" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="-1" />
<maximumFileSize value="50GB" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
</log4net>
this is my XML configuration.
I have found this question in which it is mentioned that log4net don't support Json projects
. Is it possible to write its configuration into appsettings.json
.