The RabbitMQ GELF appender is a customer appender for the log4net logging framework which publishes log messages onto RabbitMQ message bus using the GELF (json) format.
https://nuget.org/packages/rabbitmq.log4net.gelf.appender/
sample config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />
</configSections>
<log4net>
<appender name="rabbitmq.gelf.appender" type="rabbitmq.log4net.gelf.appender.GelfRabbitMqAppender, rabbitmq.log4net.gelf.appender">
<HostName value="localhost" />
<VirtualHost value="/" />
<Port value="5672" />
<Exchange value="log4net.gelf.appender" />
<Username value="guest" />
<Password value="guest" />
<Facility value="sample-application" />
</appender>
<root>
<level value="ERROR" />
<appender-ref ref="rabbitmq.gelf.appender" />
</root>
</log4net>
</configuration>
https://github.com/Graylog2/graylog2-docs/wiki/GELF
Sending your log messages onto a message bus (RabbitMQ) means they can be picked up easily and processed by a variety of consumers.
In particular it's handy with a log aggregator like LogStash. Just configure the RabbitMQ input and use Kibana to search the ElasticSearch database of your logs.
- If logger logs an
Exception
tge GELF message is populated with additional information:_ExceptionType
,_ExceptionStackTrace
,_InnerExceptionType
,_InnerExceptionMessage
- The same happens when an exception object is provided when logging a message
- More information from the LoggingEvent is populated in the GELF message:
_ThreadName
and_Domain
- The
full_message
is only populated from a string when the original string is too long forshort_message
- When the Message Formatters don't populate
short_message
it's populated with the type of the logged object
- A property called
message
(case insensitive) in a logged object is mapped to GELFshort_message
- Explicit Client Properties for RabbitMQ connections make it easier to identify connected appenders
- You can specify
Facility
for the GELF message in the appender config file