I have an Azure worker role that I wish to update the logging (the project had existing logging, although I'm not convinced it was ever working). It is set up to use Common.Logging, but with Log4Net. I have set up 2 appenders in Log4Net -- one to ElasticSearch and one to a rolling file -- neither of which are logging any output.
In the worker role's app.config, I have configured log4net, followed by Common.Logging:
...
<log4net>
<appender name="ElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4stash">
<Server>localhost</Server>
<Port>9200</Port>
<IndexName>log_test_%{+yyyy-MM-dd}</IndexName>
<IndexType>LogEvent</IndexType>
<Bulksize>2000</Bulksize>
<BulkIdleTimeout>10000</BulkIdleTimeout>
<IndexAsync>False</IndexAsync>
<ElasticFilters>
<Add>
<Key>My Data Origin</Key>
<Value>Worker Role</Value>
</Add>
</ElasticFilters>
</appender>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="C:\tmp\log4net_rollingfile.log" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level %thread %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="ElasticSearchAppender" />
<appender-ref ref="RollingFile" />
</root>
</log4net>
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">
<arg key="configType" value="INLINE" />
</factoryAdapter>
</logging>
</common>
I would tend to think that something is off in the configuration. However, the RollingFile appender does indeed create c:\tmp\log4net_rollingfile.log, so I'm at a loss to explain why nothing is actually written to the file. Also, no data is sent to ElasticSearch.
Having turned on the Log4Net diagnostics with "log4net.Internal.Debug", I can see that the appenders are getting loaded:
log4net: Adding appender named [ElasticSearchAppender] to logger [root].
log4net: Adding appender named [RollingFile] to logger [root].