ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject [7/9] git commit: Argus-59
Date Fri, 19 Sep 2014 21:32:58 GMT
Argus-59

Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/3b7c7121
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/3b7c7121
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/3b7c7121

Branch: refs/heads/master
Commit: 3b7c71211a458fe809c3df55ab64ce61db2a3415
Parents: d34e056
Author: rmani <rmani@hortonworks.com>
Authored: Wed Sep 17 14:43:43 2014 -0700
Committer: rmani <rmani@hortonworks.com>
Committed: Wed Sep 17 14:43:43 2014 -0700

----------------------------------------------------------------------
 .../java/com/xasecure/audit/provider/Log4jAuditProvider.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b7c7121/agents-audit/src/main/java/com/xasecure/audit/provider/Log4jAuditProvider.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/Log4jAuditProvider.java
b/agents-audit/src/main/java/com/xasecure/audit/provider/Log4jAuditProvider.java
index e9c7bd4..391053f 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/Log4jAuditProvider.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/Log4jAuditProvider.java
@@ -21,6 +21,8 @@ package com.xasecure.audit.provider;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
 import com.xasecure.audit.model.AuditEventBase;
 
 
@@ -38,8 +40,9 @@ public class Log4jAuditProvider implements AuditProvider {
 	public void log(AuditEventBase event) {
 		if(! AUDITLOG.isInfoEnabled())
 			return;
-
-		AUDITLOG.info(event.toString());
+		Gson gson= new GsonBuilder().setPrettyPrinting().create();
+		String eventAsJson = gson.toJson(event.toString()) ;
+		AUDITLOG.info(eventAsJson);
 	}
 
 	@Override


Mime
View raw message