logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwilli...@apache.org
Subject svn commit: r1565889 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java src/changes/changes.xml
Date Sat, 08 Feb 2014 03:10:33 GMT
Author: nickwilliams
Date: Sat Feb  8 03:10:32 2014
New Revision: 1565889

URL: http://svn.apache.org/r1565889
Log:
Fixed LOG4J2-475 by changing the MongoDBConnection to add a MongoDB encoding hook instead
of a decoding hook.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java?rev=1565889&r1=1565888&r2=1565889&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java
Sat Feb  8 03:10:32 2014
@@ -21,6 +21,7 @@ import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.appender.AppenderLoggingException;
 import org.apache.logging.log4j.core.appender.db.nosql.NoSQLConnection;
 import org.apache.logging.log4j.core.appender.db.nosql.NoSQLObject;
+import org.apache.logging.log4j.core.helpers.Strings;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.bson.BSON;
 import org.bson.Transformer;
@@ -41,7 +42,7 @@ public final class MongoDBConnection imp
     private static final Logger LOGGER = StatusLogger.getLogger();
 
     static {
-        BSON.addDecodingHook(Level.class, new Transformer() {
+        BSON.addEncodingHook(Level.class, new Transformer() {
             @Override
             public Object transform(Object o) {
                 if (o instanceof Level) {
@@ -76,7 +77,7 @@ public final class MongoDBConnection imp
     public void insertObject(final NoSQLObject<BasicDBObject> object) {
         try {
             final WriteResult result = this.collection.insert(object.unwrap(), this.writeConcern);
-            if (result.getError() != null && result.getError().length() > 0) {
+            if (Strings.isNotEmpty(result.getError())) {
                 throw new AppenderLoggingException("Failed to write log event to MongoDB
due to error: " +
                         result.getError() + ".");
             }

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1565889&r1=1565888&r2=1565889&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Sat Feb  8 03:10:32 2014
@@ -21,6 +21,9 @@
   </properties>
   <body>
     <release version="2.0-RC1" date="2014-MM-DD" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-475" dev="nickwilliams" type="fix" due-to="Matt Sicker">
+        Changed the MongoDBConnection to add a MongoDB encoding hook instead of a decoding
hook.
+      </action>
       <action issue="LOG4J2-489" dev="nickwilliams" type="fix">
         Fixed the JPAAppender's overuse of transactions by connecting (borrowing from pool)
on new write internal or on
         flush.



Mime
View raw message