Reputation: 13733
I've found the following project (https://github.com/antonsamarsky/log4net.Raven) that enabled a log4net appender to RavenDb.
I've imported the nuget package and configured my App.config file like this:
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<connectionStrings>
<add name="RavenLogs" connectionString="Url = http://localhost:8080; DefaultDatabase=MyLog"/>
</connectionStrings>
<log4net>
<appender name="RavenAppender" type="log4net.Raven.RavenAppender, log4net.Raven">
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="INFO" />
<levelMax value="FATAL" />
</filter>
<connectionString value="RavenLogs"/>
<maxNumberOfRequestsPerSession value="100"/>
<bufferSize value="50" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="ERROR" />
</evaluator>
</appender>
</log4net>
<root>
<level value="INFO" />
<appender-ref ref="RavenAppender" />
</root>
there wasn't any documentation other than importing the nuget and the configuration on GitGub. When I run my program I don't get any errors, but I don't see anything on RavenDb server either.
I've even tried creating MyLog database myself on RavenDb, in case the appender doesn't automatically creates it - still nothing.
Anyone knows how to use this appender?
Upvotes: 0
Views: 271
Reputation: 14972
You have a LevelEvaluator
in your configuration, which will only trigger if the log event has a level equal to or over the configured level. Does an error even occur in the program?
When setting up log4net, set up a simple FileAppender
alongside your working configuration, this way you can easily see what data you should/want to be seeing in your true logs. For all you know you forgot to configure the log4net framework and the FileAppender
will act as an easy way to see if there is a problem. Remove filters and evaluators from your RavenDB appender, and add them back after checking if everything works
Jeroen's comment about setting up the internal debugger is another way to do it but may not be necessary for configuration problems.
Upvotes: 1