My primary use case for that appender would be posting a message to a Slack webhook. For example, if my team's notification channel for monitoring services and such has a webhook URL, I can POST to that URL with a PatternLayout using the JSON escape of a message laid out like {"message": "%enc{%m}{JSON}"}. So, for a more complete example:
<Appenders> <Http name="slack" url="https://slack.com/blah-blah-blah"> <MarkerFilter marker="SLACK" onMatch="ACCEPT"/> <PatternLayout pattern="{\"message\":\"%enc{%m}{JSON}\"}"/> </Http> </Appenders> Then, I'd use: Marker SLACK = MarkerManager.getMarker("SLACK"); logger.info(SLACK, "Hello, team!"); The use of a marker here makes it so I can specify a log message should go to Slack regardless of which logger name it comes from. A similar use case could be used with the SMTP appender and other networked ones where you only care about urgent log messages. On 23 October 2017 at 22:58, itsg...@gmail.com <itsg...@gmail.com> wrote: > Is there a good example to use the log4j httpappender. I have seen example > for socketappender and tried it. I want to compare between socket appender > and http appender so that we can choose what will be best fit for our > product. > > > > -- > Sent from: http://apache-logging.6191.n7.nabble.com/Log4j-Users-f4.html > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > > -- Matt Sicker <boa...@gmail.com>