你们能演示一下如何在 MongoDB 的 Log4j2 (2.0-beta8) 中使用 NoSQLAppender 吗?
我正在使用 Scala(尽管我认为它不相关)。
我拥有的 Java Mongo DB 驱动程序是 2.11.2
Appender 抛出以下异常
2013-07-31 18:19:27,831 ERROR An exception occurred processing Appender databaseAppender java.lang.IllegalArgumentException: can't serialize class org.apache.logging.log4j.Level
at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:270)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120)
at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)
at com.mongodb.OutMessage.putObject(OutMessage.java:289)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:239)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:204)
at com.mongodb.DBCollection.insert(DBCollection.java:148)
at com.mongodb.DBCollection.insert(DBCollection.java:91)
at org.apache.logging.log4j.core.appender.db.nosql.mongo.MongoDBConnection.insertObject(MongoDBConnection.java:61)