Index: src/edu/ucsb/nceas/metacat/MetacatReplication.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetacatReplication.java	(revision 3228)
+++ src/edu/ucsb/nceas/metacat/MetacatReplication.java	(revision 3229)
@@ -579,6 +579,7 @@
   {
     String server = ((String[])params.get("server"))[0]; // the server that
     String docid = ((String[])params.get("docid"))[0]; // sent the document
+    String ipAddress = ((String[])params.get("ipAddress"))[0];
     String dbaction = "UPDATE"; // the default action is UPDATE
     boolean override = false;
     int serverCode = 1;
@@ -653,10 +654,11 @@
       DocumentImplWrapper wrapper = new DocumentImplWrapper(parserBase, false);
       wrapper.writeReplication(dbConn, new StringReader(xmldoc), null, null,
                                dbaction, docid, user, null, homeServer, 
-                               server, createdDate, updatedDate);
-
+                               server, createdDate, updatedDate, ipAddress);
+      
       MetacatReplication.replLog("document " + docid + " added to DB with " +
                                  "action " + dbaction);
+      EventLog.getInstance().log(ipAddress, user, docid, dbaction);
     }//try
     catch(Exception e)
     {
@@ -666,6 +668,7 @@
                                        e.getMessage());
       logMetacat.error("ERROR in MetacatReplication.handleForceReplicate" +
                          "Request(): " + e.getMessage());
+      
 
     }//catch
     finally
@@ -684,6 +687,8 @@
 {
   String server = ((String[])params.get("server"))[0]; // the server that
   String docid = ((String[])params.get("docid"))[0]; // sent the document
+  String user = ((String[])params.get("user"))[0];
+  String ipAddress = ((String[])params.get("ipAddress"))[0];
   try
   {
     MetacatReplication.replLog("force replication delete request from " + server);
@@ -690,8 +695,9 @@
     MetacatReplication.replLog("force replication delete docid " + docid);
     logMetacat.info("Force replication delete request from: "+ server);
     logMetacat.info("Force replication delete docid: "+docid);
-    DocumentImpl.delete(docid, null, null, server);
+    DocumentImpl.delete(docid, null, null, server, ipAddress);
     MetacatReplication.replLog("document " + docid + " was successfully deleted ");
+    EventLog.getInstance().log(ipAddress, user, docid, "delete");
     logMetacat.info("document " + docid + " was successfully deleted ");
   }
   catch(Exception e)
@@ -724,6 +730,7 @@
     String server = ((String[])params.get("server"))[0];
     // the docid should include rev number
     String docid = ((String[])params.get("docid"))[0];
+    String ipAddress = ((String[])params.get("ipAddress"))[0];
     // Make sure there is a docid and server
     if (docid==null || server==null || server.equals(""))
     {
@@ -802,7 +809,7 @@
         //into file system
         DocumentImpl.writeDataFileInReplication(url.openStream(), datafilePath,
                             docName, docType, docid, user,docHomeServer,server, 
-                            DocumentImpl.DOCUMENTTABLE, false, createdDate, updatedDate);
+                            DocumentImpl.DOCUMENTTABLE, false, createdDate, updatedDate, ipAddress);
                             //false means non-timed replication
      }
 
@@ -810,6 +817,7 @@
 
     MetacatReplication.replLog("datafile " + docid + " added to DB with " +
                                  "action " + dbaction);
+    EventLog.getInstance().log(ipAddress, user, docid, dbaction);
     }
     catch(Exception e)
     {
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 3228)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 3229)
@@ -1948,12 +1948,12 @@
                             accNumber = null;
                         }
                         newdocid = documentWrapper.write(dbConn, xml, pub, dtd,
-                                doAction, accNumber, user, groups);
+                                doAction, accNumber, user, groups, request.getRemoteAddr());
                         EventLog.getInstance().log(request.getRemoteAddr(),
                                 user, accNumber, action[0]);
                     } catch (NullPointerException npe) {
                         newdocid = documentWrapper.write(dbConn, xml, pub, dtd,
-                                doAction, null, user, groups);
+                                doAction, null, user, groups, request.getRemoteAddr());
                         EventLog.getInstance().log(request.getRemoteAddr(),
                                 user, "", action[0]);
                     }
@@ -2262,7 +2262,7 @@
 
                 try {
                     // null means notify server is null
-                    DocumentImpl.delete(docid[0], user, groups, null);
+                    DocumentImpl.delete(docid[0], user, groups, null, request.getRemoteAddr());
                     EventLog.getInstance().log(request.getRemoteAddr(),
                                                user, docid[0], "delete");
                     response.setContentType("text/xml");
@@ -2956,7 +2956,7 @@
                         // original command,
                         // not get force replication info from another metacat
                         ForceReplicationHandler frh = new ForceReplicationHandler(
-                                docid, "insert", false, null);
+                                docid, "insert", false, null, username, request.getRemoteAddr());
 
                         // set content type and other response header fields
                         // first
Index: src/edu/ucsb/nceas/metacat/DocumentImpl.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 3228)
+++ src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 3229)
@@ -537,7 +537,7 @@
     public static void writeDataFileInReplication(InputStream input,
             String filePath, String docname, String doctype, String accnum,
             String user, String docHomeServer, String notificationServer, 
-            String tableName, boolean timedReplication, String createDate, String updateDate)
+            String tableName, boolean timedReplication, String createDate, String updateDate, String ipAddress)
             throws SQLException, AccessionNumberException, Exception
     {
         int serverCode = -2;
@@ -595,7 +595,7 @@
         if (!timedReplication)
         {
           ForceReplicationHandler forceReplication = new ForceReplicationHandler(
-                accnum, false, notificationServer);
+                accnum, false, notificationServer, user, ipAddress);
         }
     }
     
@@ -2236,7 +2236,7 @@
 
     public static String write(DBConnection conn, Reader xml, String pub,
             Reader dtd, String action, String docid, String user,
-            String[] groups, String ruleBase, boolean needValidation)
+            String[] groups, String ruleBase, boolean needValidation, String ipAddress)
             throws Exception
     {
         //this method will be called in handleUpdateOrInsert method
@@ -2244,7 +2244,7 @@
         // get server location for this doc
         int serverLocation = getServerLocationNumber(docid);
         return write(conn, xml, pub, dtd, action, docid, user, groups,
-                serverLocation, false, ruleBase, needValidation);
+                serverLocation, false, ruleBase, needValidation, ipAddress);
     }
 
     /**
@@ -2280,7 +2280,7 @@
     public static String write(DBConnection conn, Reader xml, String pub,
             Reader dtd, String action, String accnum, String user,
             String[] groups, int serverCode, boolean override, String ruleBase,
-            boolean needValidation) throws Exception
+            boolean needValidation, String ipAddress) throws Exception
     {
         // NEW - WHEN CLIENT ALWAYS PROVIDE ACCESSION NUMBER INCLUDING REV IN IT
         //MetaCatUtil util = new MetaCatUtil();
@@ -2365,7 +2365,7 @@
 
                 // Force replication the docid
                 ForceReplicationHandler frh = new ForceReplicationHandler(
-                        accnum, true, null);
+                        accnum, true, null, user, ipAddress);
                 return (accnum);
 
             }
@@ -2464,7 +2464,7 @@
         // other servers true mean it is xml document null is because no
         // metacat notify the force replication.
         ForceReplicationHandler frh = new ForceReplicationHandler(accnum,
-                action, true, null);
+                action, true, null, user, ipAddress);
 
         logMetacat.info("Conn Usage count after writting: "
                 + conn.getUsageCount());
@@ -2511,7 +2511,7 @@
             String pub, Reader dtd, String action, String accnum, String user,
             String[] groups, String homeServer, String notifyServer,
             String ruleBase, boolean needValidation, String tableName, 
-            boolean timedReplication, String createDate, String updateDate) throws Exception
+            boolean timedReplication, String createDate, String updateDate, String ipAddress) throws Exception
     {
         long rootId;
         String docType = null;
@@ -2642,7 +2642,7 @@
         if (!timedReplication)
         {
           ForceReplicationHandler forceReplication = new ForceReplicationHandler(
-                accnum, action, true, notifyServer);
+                accnum, action, true, notifyServer, user, ipAddress);
         }
         return (accnum);
     }
@@ -2778,7 +2778,7 @@
      * @param docid
      *            the ID of the document to be deleted from the database
      */
-    public static void delete(String accnum, String user, String[] groups, String notifyServer)
+    public static void delete(String accnum, String user, String[] groups, String notifyServer, String ipAddress)
             throws Exception
     {
 
@@ -2926,6 +2926,9 @@
 
             conn.commit();
             conn.setAutoCommit(true);
+            //add force delete replcation document here.
+            ForceReplicationHandler frh = new ForceReplicationHandler(
+                             accnum, ForceReplicationHandler.DELETE, isXML, notifyServer, user, ipAddress);
 
         } catch (Exception e) {
             logMetacat.error("error in DocumentImpl.delete: "
@@ -2944,9 +2947,7 @@
                 DBConnectionPool.returnDBConnection(conn, serialNumber);
             }
         }
-       // add force delete replcation document here.
-       ForceReplicationHandler frh = new ForceReplicationHandler(
-                        accnum, ForceReplicationHandler.DELETE, isXML, notifyServer);
+       
 
     }
 
@@ -3646,7 +3647,7 @@
                     xmldoc.toXml(new PrintWriter(System.out), null, null, true);
                 }
             } else if (action.equals("DELETE")) {
-                DocumentImpl.delete(docid, null, null,null);
+                DocumentImpl.delete(docid, null, null,null, null);
                 //System.out.println("Document deleted: " + docid);
             } else {
                 /*
Index: src/edu/ucsb/nceas/metacat/DocumentImplWrapper.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImplWrapper.java	(revision 3228)
+++ src/edu/ucsb/nceas/metacat/DocumentImplWrapper.java	(revision 3229)
@@ -66,11 +66,11 @@
   }//Constructor
 
   public String write(DBConnection conn,Reader xml,String pub,Reader dtd,
-                      String action, String docid, String user, String[] groups)
+                      String action, String docid, String user, String[] groups, String ipAddress)
                       throws Exception
   {
     return DocumentImpl.write(conn, xml, pub, dtd, action, docid, user, 
-                              groups, ruleBase, needValidation);
+                              groups, ruleBase, needValidation, ipAddress);
   }
   
   public String writeReplication(DBConnection conn, Reader xml, 
@@ -78,7 +78,7 @@
                                         String accnum, String user,
                                         String[] groups,String homeServer, 
                                         String notifyServer, String createDate,
-                                        String updateDate)
+                                        String updateDate, String ipAddress)
                                         throws Exception
   {
     //we don't need to check validation in replciation
@@ -89,7 +89,7 @@
                                         accnum, user, groups, homeServer, 
                                         notifyServer, ruleBase, false, 
                                         DocumentImpl.DOCUMENTTABLE, false, 
-                                        createDate, updateDate);
+                                        createDate, updateDate, ipAddress);
                                         // last false means is not timed replication
                          
   }
@@ -116,7 +116,7 @@
           String accnum, String user,
           String[] groups,String homeServer, 
           String notifyServer, String tableName, 
-          boolean timedReplication, String createDate, String updateDate)
+          boolean timedReplication, String createDate, String updateDate, String ipAddress)
           throws Exception
   {
    //we don't need to check validation in replciation
@@ -124,6 +124,6 @@
    return DocumentImpl.writeReplication(conn, xml, pub, dtd, action, 
           accnum, user, groups, homeServer, 
           notifyServer, ruleBase, false, tableName, 
-          timedReplication, createDate, updateDate);
+          timedReplication, createDate, updateDate, ipAddress);
   }
 }//DocumentImple
Index: src/edu/ucsb/nceas/metacat/ReplicationHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ReplicationHandler.java	(revision 3228)
+++ src/edu/ucsb/nceas/metacat/ReplicationHandler.java	(revision 3229)
@@ -67,6 +67,7 @@
   private static int DOCERRORNUMBER  = 1;
   private static int REVINSERTNUMBER = 1;
   private static int REVERRORNUMBER  = 1;
+  private String ipAddress = "192.186.1.1";
   public ReplicationHandler()
   {
     //this.out = o;
@@ -358,7 +359,7 @@
                               docHomeServer,
                               remoteserver, tableName, true,// true is for time replication 
                               createdDate,
-                              updatedDate);
+                              updatedDate, ipAddress);
       logMetacat.info("Successfully replicated doc " + accNumber);
       if (tableName.equals(DocumentImpl.DOCUMENTTABLE))
       {
@@ -471,7 +472,7 @@
                                                 tableName,
                                                 true, //true means timed replication
                                                 createdDate,
-                                                updatedDate);
+                                                updatedDate,ipAddress);
                                          
         logMetacat.info("Successfully to write datafile " + accNumber);
         /*MetacatReplication.replLog("wrote datafile " + accNumber + " from " +
@@ -550,7 +551,7 @@
          //so we just add one for it. This rev number is no sence.
          String accnum=docId+util.getOption("accNumSeparator")+"1";
          //System.out.println("accnum: "+accnum);
-         DocumentImpl.delete(accnum, null, null, notifyServer);
+         DocumentImpl.delete(accnum, null, null, notifyServer, ipAddress);
          logMetacat.info("Successfully deleted doc " + docId);
          MetacatReplication.replLog("Doc " + docId + " deleted");
       }
Index: src/edu/ucsb/nceas/metacat/ForceReplicationHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ForceReplicationHandler.java	(revision 3228)
+++ src/edu/ucsb/nceas/metacat/ForceReplicationHandler.java	(revision 3229)
@@ -54,6 +54,8 @@
   private String action;
   private boolean xmlDocument;
   private boolean dbactionFlag = true;
+  private String user = null;
+  private String ipAddress = null;
   private ReplicationServerList serverLists = null;//Serverlist
   private int homeServerCode = 0; // home server code for the docid
   // When a metacat A got forcereplication
@@ -80,11 +82,13 @@
    * don't want A to notify B again. B is nofitification of A.
    */
   public ForceReplicationHandler(String docid, String action, boolean xml,
-                                                   String myNotificationServer)
+                                                   String myNotificationServer, String user, String ipAddress)
   {
     this.docid = docid;
     this.action = action;
     this.xmlDocument =xml;
+    this.user = user;
+    this.ipAddress = ipAddress;
     // Build a severLists from xml_replication table
     this.serverLists = new ReplicationServerList();
     // Get sever code for this docid
@@ -114,10 +118,12 @@
    * Use this constructor when the action is implied.
    */
   public ForceReplicationHandler(String docid, boolean xml,
-                                                String myNotificationServer )
+                                                String myNotificationServer, String user, String ipAddress)
   {
     this.docid = docid;
     this.xmlDocument = xml;
+    this.user = user;
+    this.ipAddress = ipAddress;
     dbactionFlag = false;
     // Build a severLists from xml_replication table
     this.serverLists = new ReplicationServerList();
@@ -199,13 +205,13 @@
                                  "?action=forcereplicate&server=" +
                                   util.getLocalReplicationServerName()+
                                  "&docid=" + docid + "&dbaction=" +
-                                  action);
+                                  action+"&ipAddress="+ipAddress);
                 //over write the url for delete
                 if (action != null && action.equals(DELETE))
                 {
                   comeAndGetIt = new URL("https://" + server + "?action=" +
                                    MetacatReplication.FORCEREPLICATEDELETE +
-                                  "&docid=" + docid +"&server="+ util.getLocalReplicationServerName());
+                                  "&docid=" + docid +"&server="+ util.getLocalReplicationServerName()+"&user="+user+"&ipAddress="+ipAddress);
 
                 }
               }//if servercode==1
@@ -222,13 +228,13 @@
                                  "?action=forcereplicate&server=" +
                                  util.getLocalReplicationServerName() +
                                  "&docid=" + docid + "&dbaction=" +
-                                  action);
+                                  action+"&ipAddress="+ipAddress);
                 //over write the url for delete
                if (action != null && action.equals(DELETE))
                {
                   comeAndGetIt = new URL("https://" + server + "?action=" +
                             MetacatReplication.FORCEREPLICATEDELETE +
-                           "&docid=" + docid+"&server="+ util.getLocalReplicationServerName());
+                           "&docid=" + docid+"&server="+ util.getLocalReplicationServerName()+"&user="+user+"&ipAddress="+ipAddress);
 
                 }
               }//else
@@ -246,13 +252,13 @@
                                  "?action=forcereplicatedatafile&server=" +
                                  util.getLocalReplicationServerName() +
                                  "&docid=" + docid + "&dbaction=" +
-                                  action);
+                                  action+"&ipAddress="+ipAddress);
                 //over write the url for delete
                if (action != null && action.equals(DELETE))
                {
                  comeAndGetIt = new URL("https://" + server + "?action=" +
                                  MetacatReplication.FORCEREPLICATEDELETE +
-                                 "&docid=" + docid +"&server="+ util.getLocalReplicationServerName());
+                                 "&docid=" + docid +"&server="+ util.getLocalReplicationServerName()+"&user="+user+"&ipAddress="+ipAddress);
 
                }
 
@@ -270,13 +276,13 @@
                                  "?action=forcereplicatedatafile&server=" +
                                  util.getLocalReplicationServerName() +
                                  "&docid=" + docid + "&dbaction=" +
-                                  action);
+                                  action+"&ipAddress="+ipAddress);
                 //over write the url for delete
                if (action != null && action.equals(DELETE))
                {
                   comeAndGetIt = new URL("https://" + server + "?action=" +
                          MetacatReplication.FORCEREPLICATEDELETE +
-                        "&docid=" + docid+"&server="+ util.getLocalReplicationServerName());
+                        "&docid=" + docid+"&server="+ util.getLocalReplicationServerName()+"&user="+user+"&ipAddress="+ipAddress);
 
                }
 
@@ -297,7 +303,7 @@
                 comeAndGetIt = new URL("https://" + server +
                                  "?action=forcereplicate&server=" +
                                  util.getLocalReplicationServerName()+
-                                 "&docid=" + docid);
+                                 "&docid=" + docid+"&ipAddress="+ipAddress);
 
               }//if homeserver ==1
               else if (replicationServer.getHub()||
@@ -310,7 +316,7 @@
                 comeAndGetIt = new URL("https://" + server +
                                  "?action=forcereplicate&server=" +
                                  util.getLocalReplicationServerName() +
-                                 "&docid=" + docid);
+                                 "&docid=" + docid+"&ipAddress="+ipAddress);
 
               }//else if
 
@@ -324,7 +330,7 @@
                 comeAndGetIt = new URL("https://" + server +
                                  "?action=forcereplicatedatafile&server=" +
                                  util.getLocalReplicationServerName() +
-                                 "&docid=" + docid);
+                                 "&docid=" + docid+"&ipAddress="+ipAddress);
               }//if
               else if (replicationServer.getHub()||
                           server.equals(MetacatReplication.
@@ -336,7 +342,7 @@
                 comeAndGetIt = new URL("https://" + server +
                                  "?action=forcereplicatedatafile&server=" +
                                  util.getLocalReplicationServerName() +
-                                 "&docid=" + docid);
+                                 "&docid=" + docid+"&ipAddress="+ipAddress);
 
               }//else
             }//else if
