I have a REST API which I want to communicate with using my Logback Appender. The REST API in itself is secured by OAuth as a result of which any request needs to be attached with the OAuth token. Is it possible to write a custom appender which can do this. I'm extremely new to Logback and have no idea how to write a custom appender.
For example, the URL to obtain token is http://example.com/obtain-token
and the API to push logs is http://example.com/addLogs
I would really appreciate if someone can give me a dummy code on how to go about this
Logback has the implementation of server appender, you can do it like this:
Be aware that the Logger and some other classes are in
ch.qos.logback.classic
package. You can check the document about appenders in detail.