-
Notifications
You must be signed in to change notification settings - Fork 327
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
Unable to set property [file] on object [log4net.Appender.FileAppender] #183
Comments
Probably a typo in your config: the parameter name is |
The property name is "file" in log4net, but it would be helpful to see the config file (the whole log4net section). |
I also have this error after upgrading from log4net 2.0.17 to 3.0.0:
As @mariankral said, if I remove type="log4net.Util.PatternString" from the config file the problem disappers. An Internet search shows that there are many config files around using type="log4net.Util.PatternString" this way. Hence I guess this 3.0.0 change will probably break many configurations. Random example (I have no connection to earthsoft): https://help.earthsoft.com/ent_configure-log4net.htm <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="%env{temp}/equislogs/{baseUri}/{process}.log" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="10" />
<param name="MaximumFileSize" value="500KB" />
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d %property{url} %property{ip} [%t] %-5p %c [%x] - %m%n" />
</layout>
</appender> |
@ppkarwasz @FreeAndNil |
@sc-mk, @geirg71 Thanks for reporting the problem. I fixed the regression in #184 Can you please test with https://github.com/apache/logging-log4net/releases/tag/rc%2F3.0.1-preview.2 or https://www.nuget.org/packages/log4net/3.0.1-preview.2 and close the issue? |
Thank you @FreeAndNil I tested with 3.0.1-preview.2, and the problem is solved in my environment. I leave the issue closing to @sc-mk. |
Hi,
We use the following in log4net.config for log4net 2.0.17:
<file type="log4net.Util.PatternString" value="Logs\file_%property{LogName}_%date{yyyyMMddHHmmss}.log" />
I updated log4net to latest version 3.0.0 via NuGet Manager in Visual Studio.
I got the following error:
Message:
TestCleanup method Test.XYZ.TestCleanup threw exception. System.ArgumentException: System.ArgumentException: The parameter should not be null or empty.
Parameter name: fileName.
Stack Trace:
EqtAssert.StringNotNullOrEmpty(String parameter, String parameterName)
TestContextImplementation.AddResultFile(String fileName)
Logger.AttachLogFile(TestContext testContext) line 31
XYZ.TestCleanup() line 51
Standard Error:
log4net:WARN Unable to set property [file] on object [log4net.Appender.FileAppender] using value [Logs\file_%property{LogName}_%date{yyyyMMddHHmmss}.log] (with acceptable conversion types)
log4net:WARN FileAppender: File option not set for appender [GeneralFileAppender].
log4net:WARN FileAppender: Are you using FileAppender instead of ConsoleAppender?
If I delete the type="log4net.Util.PatternString" from log4net.config, the log file will be created.
Otherwise no, it does not create a file.
Can you advise me what is wrong?
This worked for years until I upgraded to version 3.0.0
The text was updated successfully, but these errors were encountered: