DATAMONGO-1715 - Remove spring-data-mongodb-log4j module.
We no longer support spring-data-mongodb-log4j hence removing the code entirely. Original pull request: #471.
This commit is contained in:
committed by
Mark Paluch
parent
9f22195330
commit
09f8dc6843
@@ -33,7 +33,6 @@ include::{spring-data-commons-docs}/auditing.adoc[]
|
||||
include::reference/mongo-auditing.adoc[]
|
||||
include::reference/mapping.adoc[]
|
||||
include::reference/cross-store.adoc[]
|
||||
include::reference/logging.adoc[]
|
||||
include::reference/jmx.adoc[]
|
||||
include::reference/mongo-3.adoc[]
|
||||
:leveloffset: -1
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
[[mongo.logging]]
|
||||
= Logging support
|
||||
|
||||
An appender for Log4j is provided in the maven module "spring-data-mongodb-log4j". Note, there is no dependency on other Spring Mongo modules, only the MongoDB driver.
|
||||
|
||||
[[mongodb:logging-configuration]]
|
||||
== MongoDB Log4j Configuration
|
||||
|
||||
Here is an example configuration
|
||||
|
||||
[source]
|
||||
----
|
||||
log4j.rootCategory=INFO, mongo
|
||||
|
||||
log4j.appender.mongo=org.springframework.data.document.mongodb.log4j.MongoLog4jAppender
|
||||
log4j.appender.mongo.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.mongo.layout.ConversionPattern=%d %p [%c] - <%m>%n
|
||||
log4j.appender.mongo.host = localhost
|
||||
log4j.appender.mongo.port = 27017
|
||||
log4j.appender.mongo.database = logs
|
||||
log4j.appender.mongo.collectionPattern = %X{year}%X{month}
|
||||
log4j.appender.mongo.applicationId = my.application
|
||||
log4j.appender.mongo.warnOrHigherWriteConcern = FSYNC_SAFE
|
||||
|
||||
log4j.category.org.apache.activemq=ERROR
|
||||
log4j.category.org.springframework.batch=DEBUG
|
||||
log4j.category.org.springframework.data.document.mongodb=DEBUG
|
||||
log4j.category.org.springframework.transaction=INFO
|
||||
----
|
||||
|
||||
The important configuration to look at aside from host and port is the database and `collectionPattern`. The variables `year`, `month`, `day` and `hour` are available for you to use in forming a collection name. This is to support the common convention of grouping log information in a collection that corresponds to a specific time period, for example a collection per day.
|
||||
|
||||
There is also an `applicationId` which is put into the stored message. The document stored from logging as the following keys: `level`, `name`, `applicationId`, `timestamp`, `properties`, `traceback`, and `message`.
|
||||
|
||||
[[mongodb:logging-configuration:authentication]]
|
||||
=== Using authentication
|
||||
|
||||
The MongoDB Log4j appender can be configured to use username/password authentication.
|
||||
Authentication is performed using the specified database. A different `authenticationDatabase` can be specified to override the default behavior.
|
||||
|
||||
[source]
|
||||
----
|
||||
# ...
|
||||
log4j.appender.mongo.username = admin
|
||||
log4j.appender.mongo.password = test
|
||||
log4j.appender.mongo.authenticationDatabase = logs
|
||||
# ...
|
||||
----
|
||||
|
||||
NOTE: Authentication failures lead to exceptions during logging and are propagated to the caller of the logging method.
|
||||
@@ -13,7 +13,6 @@ The MongoDB support contains a wide range of features which are summarized below
|
||||
* Automatic implementation of Repository interfaces including support for custom finder methods.
|
||||
* QueryDSL integration to support type-safe queries.
|
||||
* Cross-store persistence - support for JPA Entities with fields transparently persisted/retrieved using MongoDB
|
||||
* Log4j log appender
|
||||
* GeoSpatial integration
|
||||
|
||||
For most tasks you will find yourself using `MongoTemplate` or the Repository support that both leverage the rich mapping functionality. `MongoTemplate` is the place to look for accessing functionality such as incrementing counters or ad-hoc CRUD operations. `MongoTemplate` also provides callback methods so that it is easy for you to get a hold of the low level API artifacts such as `com.mongo.DB` to communicate directly with MongoDB. The goal with naming conventions on various API artifacts is to copy those in the base MongoDB Java driver so you can easily map your existing knowledge onto the Spring APIs.
|
||||
|
||||
Reference in New Issue
Block a user