Hi Tomasz,
Here is precisely what I created so far:
* base abstract appender handling MongoDB connectivity [1]
* standard appender [2] + tests [3]
* access appender (tested with Tomcat) [4] + tests [5]
* configuration examples [6]
By quick googling I found several other community implementations: [7], [8], [9]. Looks like my implementation is the only one capable of storing access logs as well, e.g.:
{
"_id" : ObjectId("4d98cc4f7abb95e59279e183"),
"timeStamp" : ISODate("2011-04-03T19:36:47.339Z"),
"server" : "localhost",
"remote" : {
"host" : "0:0:0:0:0:0:0:1",
"user" : "tomcat",
"addr" : "0:0:0:0:0:0:0:1"
},
"request" : {
"uri" : "/manager/images/tomcat.gif",
"protocol" : "HTTP/1.1",
"method" : "GET",
"sessionId" : "1C6357816D9EEFD31F6D9D154D87308A",
"userAgent" : "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.16) Gecko/20110323 Ubuntu/10.10 (maverick) Firefox/3.6.16",
"referer" : "http://localhost:8080/manager/html"
},
"response" : {
"contentLength" : NumberLong(1934),
"statusCode" : 200
}
}
We should now revise all available implementations and build final one based on best ideas from all of them. The only issue I see is integration testing: at least my tests require running MongoDB instance somewhere. This is a major drawback for both continuous integration of Lobgack extensions and for all developers, not necessarily interested in this particular extension.
Christian Trutz - thanks for creating the project structure.
[1]: https://github.com/nurkiewicz/logback/blob/mongodb-appender/logback-core/src/main/java/ch/qos/logback/core/db/mongo/MongoDBAppenderBase.java
[2]: https://github.com/nurkiewicz/logback/blob/mongodb-appender/logback-classic/src/main/java/ch/qos/logback/classic/db/mongo/MongoDBAppender.java
[3]: https://github.com/nurkiewicz/logback/blob/mongodb-appender/logback-classic/src/test/java/ch/qos/logback/classic/db/mongo/MongoDBAppenderTest.java
[4]: https://github.com/nurkiewicz/logback/blob/mongodb-appender/logback-access/src/main/java/ch/qos/logback/access/db/mongo/MongoDBAppender.java
[5]: https://github.com/nurkiewicz/logback/blob/mongodb-appender/logback-access/src/test/java/ch/qos/logback/access/db/mongo/MongoDBAppenderTest.java
[6]: https://github.com/nurkiewicz/logback/tree/mongodb-appender/logback-classic/src/test/input/joran/mongodb
[7]: https://github.com/kofemann/mongo-appender-for-logback
[8]: https://github.com/smilebase/logback-mongodb
[9]: https://github.com/uded/logback-mongodb-appender
On 14.06.2012 14:24, ceki wrote:
Hi Christian,
Tomasz created a jira issue for implementing MongoDBAppender [2]. His
implementation can be found at [3, 4, 5].
I think his impl is worth a look. He seprated connection functionality
into MongoDBAppenderBase (part of logback-core) and ILoggingEvent
specific code into MongoDBAppender (in logback-classic). Moreover, his
code comes with 100% test coverage!
I guess the code could be easily extended to cater for AccessEvent (in
logback-access).
Anyway, let me know what I can do to move this work forward.
[1] https://github.com/qos-ch/logback-extensions
[2] http://jira.qos.ch/browse/LOGBACK-522
[3] https://github.com/nurkiewicz/logback/tree/mongodb-appender
[4] https://github.com/nurkiewicz/logback/commit/858aceb9af74d0
[5] https://github.com/nurkiewicz/logback/commit/f5bff8e43
_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-dev