log4net.ElasticSearch icon indicating copy to clipboard operation
log4net.ElasticSearch copied to clipboard

Can't set property in config

Open JenMatlock opened this issue 4 years ago • 3 comments
trafficstars

Hi. I'm trying to implement this in a .net 4.5 Windows service. We're already using log4net to log to a db and to a Gelf4Net appender. I've added in log4net.ElasticSearch, but when I run the service I get the following error in the output:

log4net:ERROR XmlHierarchyConfigurator: Cannot find Property [rollingIndexNameDateFormat] to set object on [log4net.ElasticSearch.ElasticSearchAppender]

I can't see any reason for this as that property is present and available in ElasticSearchAppender. I'm using version 2.5.0 with log4net version 2.0.10, and the relevant config section looks like this:

<appender name="ElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4net.ElasticSearch"> <!-- for .NET 40 <appender name="ElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4net.ElasticSearch.Net40">--> <connectionString value="Scheme=https;User=xxx;Pwd=xxx;Server=xxx;Index=ce-log;Port=443;Rolling=true;Bulk=true"/> <lossy value="false" /> <evaluator type="log4net.Core.LevelEvaluator"> <threshold value="DEBUG" /> </evaluator> <rollingIndexNameDateFormat value="yyyy-MM-dd" /> <bufferSize value="100" /> </appender>

Any help would be appreciated.

JenMatlock avatar Sep 27 '21 14:09 JenMatlock

So looks like the problem is that the version in nuget, which we're using, was last updated in Aug 2019 and the rollingIndexNameDateFormat property is more recent. Can someone please update the version in nuget?

JenMatlock avatar Sep 28 '21 10:09 JenMatlock

Could you please try with https://www.nuget.org/packages/log4net.ElasticSearch/2.6.0-preview3 and confirm it works?

bruno-garcia avatar Jul 22 '22 14:07 bruno-garcia

Thanks, @bruno-garcia tested and the rollingIndexNameDateFormat property is now working as expected. Haven't seen any issues.

JenMatlock avatar Sep 02 '22 14:09 JenMatlock