This is an Logback appender for writing logs to the Mongo database.
- Extend the
ch.qos.logback.core.UnsynchronizedAppenderBase
class - connect to Mongo instance
- Fetch logs from
LoggingEvent
- write logs to Mongo document
Download the Maven project and directly run it.
The MongoDB properties's names are specified in application.properties
.
If you don't use Spring, in the logback-spring.xml, you can remove all springProperty
tags and hard code your host
, port
,and etc in the appender's list.