From 27ba19eac657fd789983ca4345ab49fa545ad844 Mon Sep 17 00:00:00 2001 From: Jon Brisbin Date: Wed, 30 Mar 2011 16:32:53 -0500 Subject: [PATCH] Tweaked the README to cover configuring the collection name using Log4J pattern. --- spring-data-mongodb-log4j/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spring-data-mongodb-log4j/README.md b/spring-data-mongodb-log4j/README.md index 143a9787c..89534a4f8 100644 --- a/spring-data-mongodb-log4j/README.md +++ b/spring-data-mongodb-log4j/README.md @@ -11,21 +11,21 @@ To use it, configure a host, port, (optionally) applicationId, and database prop log4j.appender.stdout.host = localhost log4j.appender.stdout.port = 27017 log4j.appender.stdout.database = logs + log4j.appender.stdout.collectionPattern = %c log4j.appender.stdout.applicationId = my.application log4j.appender.stdout.warnOrHigherWriteConcern = FSYNC_SAFE It will even support properties in your MDC (so long as they're Strings or support .toString()). The collection name is configurable as well. If you don't specify anything, it will use the Category name. -If you want to specify a collection name, you can give it a String.format() string which will be passed the -following parameters: - -1. Calendar.YEAR -2. Calendar.MONTH -3. Calendar.DAY_OF_MONTH -4. Calendar.HOUR_OF_DAY -5. event.getLevel().toString() -6. event.getLogger().getName() +If you want to specify a collection name, you can give it a Log4J pattern layout format string which will have +the following additional MDC variables in the context when the collection name is rendered: + + "year" = Calendar.YEAR + "month" = Calendar.MONTH + 1 + "day" = Calendar.DAY_OF_MONTH + "hour" = Calendar.HOUR_OF_DAY + "applicationId" = configured applicationId An example log entry might look like: