I need to get my Java application writing logging to a Graylog2 server. The application uses a log4j configuration. Several things I have tried to get the logging writing to the Graylog2 server, the things I got working was sending a test message directly to the server, as shown here (first example).
Yet, when I write an appender and attach it to the root logger, I always get this error message the first time a log event is to be fired:
log4j:ERROR Could not send GELF message
Nothing then happens on the Graylog2 server side.
The appender I try to get working:
<appender name="graylog2" class="org.graylog2.log.GelfAppender">
<param name="graylogHost" value="127.0.0.1"/>
<param name="originHost" value="my.machine.example.com"/>
<param name="extractStacktrace" value="true"/>
<param name="addExtendedInformation" value="true"/>
<param name="facility" value="gelf-java"/>
<param name="Threshold" value="INFO"/>
<param name="additionalFields" value="{'environment': 'DEV', 'application': 'MyAPP'}"/>
</appender>
Does anyone have an idea how to get this running?
Any help is highly appreciated!