You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/03/01 02:15:50 UTC

incubator-geode git commit: Use Logger

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-949-2 5f377fe6d -> 00ab815f2


Use Logger


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/00ab815f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/00ab815f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/00ab815f

Branch: refs/heads/feature/GEODE-949-2
Commit: 00ab815f289184f200cf915ed06459df7a137ca8
Parents: 5f377fe
Author: Kirk Lund <kl...@pdx2-office-dhcp32.eng.vmware.com>
Authored: Mon Feb 29 17:15:46 2016 -0800
Committer: Kirk Lund <kl...@pdx2-office-dhcp32.eng.vmware.com>
Committed: Mon Feb 29 17:15:46 2016 -0800

----------------------------------------------------------------------
 .../java/security/SSLCredentialGenerator.java     |  5 +++++
 .../templates/security/LdapUserAuthenticator.java |  5 ++++-
 .../java/templates/security/PKCSAuthInit.java     |  4 ++++
 .../templates/security/PKCSAuthenticator.java     |  4 ++++
 .../java/templates/security/XmlErrorHandler.java  | 18 +++++++++++-------
 5 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00ab815f/geode-core/src/test/java/security/SSLCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/security/SSLCredentialGenerator.java b/geode-core/src/test/java/security/SSLCredentialGenerator.java
index e610dd9..ae7695f 100755
--- a/geode-core/src/test/java/security/SSLCredentialGenerator.java
+++ b/geode-core/src/test/java/security/SSLCredentialGenerator.java
@@ -18,7 +18,9 @@
  */
 package security;
 
+import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
+import org.apache.logging.log4j.Logger;
 
 import java.io.File;
 import java.io.IOException;
@@ -26,6 +28,7 @@ import java.security.Principal;
 import java.util.Properties;
 
 public class SSLCredentialGenerator extends CredentialGenerator {
+  private static final Logger logger = LogService.getLogger();
 
   private File findTrustedJKS() {
     File ssldir = new File(System.getProperty("JTESTS") + "/ssl");
@@ -48,6 +51,7 @@ public class SSLCredentialGenerator extends CredentialGenerator {
       return props;
     }
     catch (IOException ex) {
+      logger.error("KIRK:SECURITY: ex={}", ex);
       throw new AuthenticationFailedException(
           "SSL: Exception while opening the key store: " + ex.getMessage(), ex);
     }
@@ -64,6 +68,7 @@ public class SSLCredentialGenerator extends CredentialGenerator {
       return props;
     }
     catch (IOException ex) {
+      logger.error("KIRK:SECURITY: ex={}", ex);
       throw new AuthenticationFailedException(
           "SSL: Exception while opening the key store: " + ex.getMessage(), ex);
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00ab815f/geode-core/src/test/java/templates/security/LdapUserAuthenticator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/templates/security/LdapUserAuthenticator.java b/geode-core/src/test/java/templates/security/LdapUserAuthenticator.java
index 63b7a42..59fcfaa 100755
--- a/geode-core/src/test/java/templates/security/LdapUserAuthenticator.java
+++ b/geode-core/src/test/java/templates/security/LdapUserAuthenticator.java
@@ -18,8 +18,10 @@ package templates.security;
 
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
+import org.apache.logging.log4j.Logger;
 
 import java.security.Principal;
 import java.util.Properties;
@@ -32,6 +34,7 @@ import javax.naming.directory.InitialDirContext;
  * @since 5.5
  */
 public class LdapUserAuthenticator implements Authenticator {
+  private static final Logger logger = LogService.getLogger();
 
   private String ldapServer = null;
 
@@ -102,7 +105,7 @@ public class LdapUserAuthenticator implements Authenticator {
       ctx.close();
     }
     catch (Exception e) {
-      e.printStackTrace();
+      logger.error("KIRK:SECURITY: e={}", e);
       throw new AuthenticationFailedException(
           "LdapUserAuthenticator: Failure with provided username, password "
               + "combination for user name: " + userName, e);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00ab815f/geode-core/src/test/java/templates/security/PKCSAuthInit.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/templates/security/PKCSAuthInit.java b/geode-core/src/test/java/templates/security/PKCSAuthInit.java
index 0fbb514..e61feee 100755
--- a/geode-core/src/test/java/templates/security/PKCSAuthInit.java
+++ b/geode-core/src/test/java/templates/security/PKCSAuthInit.java
@@ -18,9 +18,11 @@ package templates.security;
 
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.GemFireSecurityException;
+import org.apache.logging.log4j.Logger;
 
 import java.io.FileInputStream;
 import java.security.Key;
@@ -42,6 +44,7 @@ import java.util.Properties;
  * @since 5.5
  */
 public class PKCSAuthInit implements AuthInitialize {
+  private static final Logger logger = LogService.getLogger();
 
   public static final String KEYSTORE_FILE_PATH = "security-keystorepath";
 
@@ -122,6 +125,7 @@ public class PKCSAuthInit implements AuthInitialize {
       }
     }
     catch (Exception ex) {
+      logger.error("KIRK:SECURITY: ex={}", ex);
       throw new AuthenticationFailedException(
           "PKCSAuthInit: Exception while getting credentials: " + ex, ex);
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00ab815f/geode-core/src/test/java/templates/security/PKCSAuthenticator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/templates/security/PKCSAuthenticator.java b/geode-core/src/test/java/templates/security/PKCSAuthenticator.java
index 83aa5aa..74ed9fa 100755
--- a/geode-core/src/test/java/templates/security/PKCSAuthenticator.java
+++ b/geode-core/src/test/java/templates/security/PKCSAuthenticator.java
@@ -18,9 +18,11 @@ package templates.security;
 
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
 import com.gemstone.gemfire.security.GemFireSecurityException;
+import org.apache.logging.log4j.Logger;
 
 import java.io.FileInputStream;
 import java.security.KeyStore;
@@ -40,6 +42,7 @@ import java.util.Properties;
  * 
  */
 public class PKCSAuthenticator implements Authenticator {
+  private static final Logger logger = LogService.getLogger();
 
   public static final String PUBLIC_KEY_FILE = "security-publickey-filepath";
 
@@ -83,6 +86,7 @@ public class PKCSAuthenticator implements Authenticator {
       }
     }
     catch (Exception e) {
+      logger.error("KIRK:SECURITY: e={}", e);
       throw new AuthenticationFailedException(
           "Exception while getting public keys: " + e.getMessage(), e);
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00ab815f/geode-core/src/test/java/templates/security/XmlErrorHandler.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/templates/security/XmlErrorHandler.java b/geode-core/src/test/java/templates/security/XmlErrorHandler.java
index 7685c28..ab2bf38 100755
--- a/geode-core/src/test/java/templates/security/XmlErrorHandler.java
+++ b/geode-core/src/test/java/templates/security/XmlErrorHandler.java
@@ -17,6 +17,8 @@
 package templates.security;
 
 import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.internal.logging.LogService;
+import org.apache.logging.log4j.Logger;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
@@ -33,14 +35,15 @@ import org.xml.sax.SAXParseException;
  * @since 5.5
  */
 public class XmlErrorHandler implements ErrorHandler {
+  private static final Logger logger = LogService.getLogger();
 
-  private LogWriter logger;
+  private LogWriter logWriter;
 
   private String xmlFileName;
 
-  public XmlErrorHandler(LogWriter logger, String xmlFileName) {
+  public XmlErrorHandler(LogWriter logWriter, String xmlFileName) {
 
-    this.logger = logger;
+    this.logWriter = logWriter;
     this.xmlFileName = xmlFileName;
   }
 
@@ -49,7 +52,7 @@ public class XmlErrorHandler implements ErrorHandler {
    * where the exception occurred.
    */
   public void error(SAXParseException exception) throws SAXException {
-
+    logger.error("KIRK:SECURITY: exception={}", exception);
     throw new SAXParseException("Error while parsing XML at line "
         + exception.getLineNumber() + " column " + exception.getColumnNumber()
         + ": " + exception.getMessage(), null, exception);
@@ -60,7 +63,7 @@ public class XmlErrorHandler implements ErrorHandler {
    * where the exception occurred.
    */
   public void fatalError(SAXParseException exception) throws SAXException {
-
+    logger.error("KIRK:SECURITY: exception={}", exception);
     throw new SAXParseException("Fatal error while parsing XML at line "
         + exception.getLineNumber() + " column " + exception.getColumnNumber()
         + ": " + exception.getMessage(), null, exception);
@@ -71,10 +74,11 @@ public class XmlErrorHandler implements ErrorHandler {
    * filename and the position of exception in the file.
    */
   public void warning(SAXParseException exception) throws SAXException {
-
-    this.logger.warning("Warning while parsing XML [" + this.xmlFileName
+    logger.error("KIRK:SECURITY: exception={}", exception);
+    this.logWriter.warning("Warning while parsing XML [" + this.xmlFileName
         + "] at line " + exception.getLineNumber() + " column "
         + exception.getColumnNumber() + ": " + exception.getMessage());
   }
 
+
 }