[
https://issues.apache.org/jira/browse/LOG4NET-594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16461483#comment-16461483
]
Dominik Psenner commented on LOG4NET-594:
-----------------------------------------
I can imagine that dotnet core simply ignores Log4Net.config. As far as I know,
the configuration loading mechanisms work differently in that environment.
Please try to debug the issue, at the moment you're the expert that has the
most experience and it would take significantly longer if others would attempt
to do that work.
> repository.GetAppenders() returns log4net.Appender.IAppender[0]
> ---------------------------------------------------------------
>
> Key: LOG4NET-594
> URL: https://issues.apache.org/jira/browse/LOG4NET-594
> Project: Log4net
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.0.8
> Environment: Windows PowerShell Console
> Reporter: Rajesh Balakrishnan
> Priority: Blocker
> Labels: windows
> Fix For: 2.0.8
>
> Attachments: Log4Net.config
>
>
> Hi,
> We are migrating our code base into .Net standard to support both Windows
> PowerShell console and PowerShell core. We are using log4net 2.0.8 as third
> party reference with log4Net.config file. There is no build issue with this.
> But, we have observed "repository.GetAppenders()" returns
> log4net.Appender.IAppender[0] in Windows PowerShell Console whereas the same
> is working as expected in PowerShell Core Console. In Windows PowerShell
> console, It looks like it is not reading the appenders confoguration from
> log4net.config.
> +*Code:*+
> log4net.Repository.ILoggerRepository repository =
> log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Logger.Repository;
> var appenders = repository.GetAppenders();
> +*Here is log4net.config:*+
> <configuration>
> <configSections>
> <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
> </configSections>
> <log4net>
> <appender name="FileAppender" type="log4net.Appender.FileAppender">
> <file value="FileLog.txt"/>
> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
> <appendToFile value="true"/>
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%date [%thread] [%logger] %level -
> %message%newline%exception"/>
> </layout>
> </appender>
> <appender name="RollingFileAppender"
> type="log4net.Appender.RollingFileAppender">
> <file value="%date.log"/>
> <PreserveLogFileNameExtension value="true" />
> <appendToFile value="true"/>
> <rollingStyle value="Size"/>
> <maximumFileSize value="10MB"/>
> <maxSizeRollBackups value="5"/>
> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%date %stacktrace %level -
> %message%newline%exception"/>
> </layout>
> </appender>
> <root>
> <level value="DEBUG"/>
> <appender-ref ref="RollingFileAppender"/>
> </root>
> </log4net>
> <startup>
> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
> </startup>
> </configuration>
>
> Please let us confirm is it a bug in log4net or something we need to correct
> from our end.
> Thank you:)
>
> *Regards,*
> Rajesh Balakrishnan
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)