Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PatternString no longer works in 3.0.0 (duplicate of #183) #185

Closed
LuckyTil opened this issue Sep 19, 2024 · 4 comments
Closed

PatternString no longer works in 3.0.0 (duplicate of #183) #185

LuckyTil opened this issue Sep 19, 2024 · 4 comments
Milestone

Comments

@LuckyTil
Copy link

  1. .Net 4.8 console app, works fine with log4net 2.0.17
  2. App.Config
  <log4net>
        <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
            <lockingModel type="log4net.Appender.FileAppender+ExclusiveLock" />
            <file type="log4net.Util.PatternString" value="%property{LogFileName}" />
            <encoding value="utf-8" />
            <datePattern value="yyyy-MM-dd'.log'" />
            <staticLogFileName value="false" />
            <appendToFile value="true" />
            <rollingStyle value="Composite" />
            <maxSizeRollBackups value="50" />
            <maximumFileSize value="100MB" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
            </layout>
        </appender>
        <root>
            <level value="ALL" />
            <appender-ref ref="RollingFileAppender" />
        </root>
    </log4net>
  1. On the XmlConfigurator.Configure() call
log4net:WARN Unable to set property [file] on object [log4net.Appender.RollingFileAppender] using value [%property{LogFileName}] (with acceptable conversion types)
log4net:ERROR Could not create Appender [RollingFileAppender] of type [log4net.Appender.RollingFileAppender]. Reported error follows.
System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта.
   в log4net.Appender.RollingFileAppender.ActivateOptions() в D:\Git\apache\logging-log4net\src\log4net\Appender\RollingFileAppender.cs:строка 982
   в log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement) в D:\Git\apache\logging-log4net\src\log4net\Repository\Hierarchy\XmlHierarchyConfigurator.cs:строка 334
log4net:ERROR Appender named [RollingFileAppender] not found.
@FreeAndNil
Copy link
Contributor

Hi @LuckyTil ,
this is issue #183.
It is fixed in the latest preview
https://github.com/apache/logging-log4net/releases/tag/rc%2F3.0.1-preview.2

Please close this issue on success.

Regards.

@LuckyTil
Copy link
Author

LuckyTil commented Sep 19, 2024

Thank You, @FreeAndNil

I will close the issue after the 3.0.1 is released to the regular NuGet repository, and I test my soft.

@FreeAndNil
Copy link
Contributor

Thank You, @FreeAndNil

I will close the issue after the 3.0.1 is released to the regular NuGet repository, and I test my soft.

@LuckyTil it was already released to nuget:
https://www.nuget.org/packages/log4net/3.0.1-preview.2

You just have to check "show preview versions".

@LuckyTil
Copy link
Author

Thank You, @FreeAndNil

Fixed.

@FreeAndNil FreeAndNil changed the title 3.0.0 issue PatternString no longer works in 3.0.0 (duplicate) Sep 20, 2024
@FreeAndNil FreeAndNil added this to the 3.0.1 milestone Sep 20, 2024
@FreeAndNil FreeAndNil changed the title PatternString no longer works in 3.0.0 (duplicate) PatternString no longer works in 3.0.0 (duplicate of #183) Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants