Wren CallowayBackplane Journal

Log4Net RabbitMQ Appender: Wiring .NET Logs to a Broker

Log4Net RabbitMQ Appender setup for .NET apps: the three third-party appenders, the XML config, durable queues and broker outages.

Wren Calloway

Log4Net RabbitMQ Appender wiring is still somebody else’s job: the Apache log4net release notes for 3.5.0, published October 1, 2026, document 18 appenders and not one of them speaks AMQP. Three small GitHub projects fill that gap, the oldest dated September 5, 2011, and the choice turns on whether the consumer at the far end wants rendered text or GELF. Each of them holds a broker connection and a flush thread inside the application process, so a broker outage arrives as a logging problem first.

The search and alerting tier behind that broker is described in enterprise logging with Graylog2 and NEsper. RabbitMQ 4.3.6, released September 14, 2026, is the current server release, and its release notes require Erlang 27.0 or newer. The official .NET client library is RabbitMQ.Client 7.2.2, published on NuGet for .NET 8 and .NET Standard 2.0.

Which Log4Net RabbitMQ Appender Fits Your Log Format?

Three Log4Net RabbitMQ Appender projects fill the gap log4net leaves, and they differ mainly in what they put on the wire.

Project First commit Payload Notes as of October 2026
gimmi/Log4Rabbit 2012-06-22 rendered layout text 57 commits, 10 stars, flushes every 5 seconds
hancengiz/rabbitmq.log4net.gelf.appender 2013-03-04 GELF NuGet 0.2.5, targets .NET Framework 4.5
mickdelaney/log4net.RabbitMQ 2011-09-05 topic-routed text 5 stars, 18 forks

Star counts and first-commit dates come from GitHub, and the package version and target framework from the NuGet gallery, as of October 2026. The Graylog 7.1 documentation describes GELF as “a log format that avoids the shortcomings of classic plain syslog”, which is the argument for the second row when Graylog reads the queue, and Graylog 7.1.10 shipped October 7, 2026. log4net 2.x has been end of life since September 12, 2024, with 2.0.17 as its last release, so new work belongs on the 3.x line (Apache log4net versioning page).

What Log4Net RabbitMQ Appender Configuration Looks Like

Log4Net RabbitMQ Appender configuration is ordinary log4net XML, and every Log4Rabbit setting already has a default, from port 5672 to a 5 second flush interval (Log4Rabbit README).

<appender name="RabbitMQAppender" type="log4net.Appender.RabbitMQAppender, Log4Rabbit">
  <HostName value="localhost" />
  <VirtualHost value="/" />
  <UserName value="guest" />
  <Password value="guest" />
  <RequestedHeartbeat value="0" />
  <Port value="5672" />
  <Exchange value="logs" />
  <RoutingKey value="checkout.info" />
  <FlushInterval value="5" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date %-5level %logger - %message%newline" />
  </layout>
</appender>

The layout pattern is what a text consumer receives, and the GELF appender ignores it in favour of its own JSON document. Logging to a database is still worth running alongside the broker as the local copy when the records matter more than the search. Exception text is usually the reason a record has to leave the box at all, and the handling around it is covered in C# exception handling best practice.

Will Log4Net RabbitMQ Messages Survive a Broker Restart?

Log4Net RabbitMQ messages survive a broker restart only when they are published as persistent and bound to a replicated queue, and quorum queues are the Raft-backed option RabbitMQ recommends.

The RabbitMQ 4.1 quorum queue documentation says it “should be considered the default choice when needing a replicated, highly available queue”. Two settings carry the durability:

  1. Declare the consumer queue durable and create it as a quorum queue, the type the RabbitMQ 4.1 documentation recommends for replicated, highly available queues.
  2. Keep the binding key to a single trailing #, because RabbitMQ 4.3.5, released August 17, 2026, allows at most two multi-segment wildcards in a topic binding key.

What Happens to Log4Net RabbitMQ Appends When the Broker Is Down?

Log4Net RabbitMQ Appender events are dropped rather than queued forever, and the 3.5.0 release notes bound that queue at 500 messages with 5 seconds of waiting for room.

RemoteSyslogAppender received that queue in 3.5.0, and the same release cut the default filter match timeout from 1000 milliseconds to 50, which matters when a slow pattern runs on the thread that logs. Buffering is not free either: the log4net 3.4.0 release notes, dated August 21, 2026, measured a fully fixed buffered event at about 193 microseconds before an identity caching fix and 17.5 microseconds after it.

Adding a RollingFileAppender to the same root logger turns a broker outage into lag in Graylog rather than a gap in the records. Ship that change the way a Jenkins and NAnt build pipeline ships anything else, one host and one restart window at a time.

Log4Net RabbitMQ Appender FAQ

Does log4net include a Log4Net RabbitMQ Appender?

No. The Apache log4net release notes for 3.5.0, dated October 1, 2026, document 18 appenders and none of them speak AMQP, so the appender has to come from a third-party project such as Log4Rabbit.

Which RabbitMQ version should a Log4Net RabbitMQ Appender publish to?

RabbitMQ 4.3.6, released September 14, 2026, is the current server release, and its release notes require Erlang 27.0 or newer. The matching client library is RabbitMQ.Client 7.2.2 on NuGet.

What happens to Log4Net RabbitMQ Appender events when the broker is down?

Events wait in the appender buffer and are dropped once it fills. log4net gave RemoteSyslogAppender the same discipline in 3.5.0: 500 messages held and 5 seconds of waiting for room. Keep a RollingFileAppender beside it as the local copy.

Should a Log4Net RabbitMQ Appender send GELF or plain text?

Send GELF when Graylog reads the queue, because the Graylog 7.1 documentation calls it “a log format that avoids the shortcomings of classic plain syslog”. Send rendered text when your own consumer parses the layout pattern.

#log4net#RabbitMQ#GELF#Graylog#appenders

Related articles