bruno-garcia / log4net.ElasticSearch

log4net appender to ElasticSearch
https://bruno-garcia.github.io/log4net.ElasticSearch/
Other
219 stars 92 forks source link

Can't set property in config #135

Closed JenMatlock closed 1 year ago

JenMatlock commented 2 years ago

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:

`

<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" />

`

Any help would be appreciated.

JenMatlock commented 2 years ago

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?

bruno-garcia commented 1 year ago

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

JenMatlock commented 1 year ago

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