diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c
index c22be09e3..c5c5f66d9 100644
--- a/src/conn/conn_log.c
+++ b/src/conn/conn_log.c
@@ -802,6 +802,9 @@ restart:
                  */
                 if (slot->slot_start_lsn.l.offset != slot->slot_last_offset)
                     slot->slot_start_lsn.l.offset = (uint32_t)slot->slot_last_offset;
+                log->last_wrlsn = *slot;
+                log->last_wrlsnp = slot;
+                log->last_wrlsni = written[i].slot_index;
                 log->write_start_lsn = slot->slot_start_lsn;
                 log->write_lsn = slot->slot_end_lsn;
                 __wt_cond_signal(session, log->log_write_cond);
diff --git a/src/include/log.h b/src/include/log.h
index 26dbdc51d..e94f70086 100644
--- a/src/include/log.h
+++ b/src/include/log.h
@@ -295,6 +295,12 @@ struct __wt_log {
 #ifdef HAVE_DIAGNOSTIC
     uint64_t write_calls; /* Calls to log_write */
 #endif
+    WT_LOGSLOT last_rel;
+    WT_LOGSLOT *last_relp;
+    uint32_t last_reli;
+    WT_LOGSLOT last_wrlsn;
+    WT_LOGSLOT *last_wrlsnp;
+    uint32_t last_wrlsni;
 
 /* AUTOMATIC FLAG VALUE GENERATION START */
 #define WT_LOG_FORCE_NEWFILE 0x1u   /* Force switch to new log file */
diff --git a/src/include/session.h b/src/include/session.h
index 355cc5f13..817c459ff 100644
--- a/src/include/session.h
+++ b/src/include/session.h
@@ -66,6 +66,20 @@ struct __wt_session_impl {
     uint64_t cache_wait_us;        /* Wait time for cache for current operation */
     uint64_t operation_start_us;   /* Operation start */
     uint64_t operation_timeout_us; /* Maximum operation period before rollback */
+    uint64_t log_clock1;
+    uint64_t log_clock2;
+    uint64_t log_clock3;
+    uint64_t log_early1;
+    uint64_t log_early2;
+    uint64_t log_write1;
+    uint64_t log_write2;
+    WT_LSN log_end1;
+    WT_LSN log_end2;
+    WT_LSN log_end3;
+    WT_LSN early_lsn1;
+    WT_LSN early_lsn2;
+    WT_LSN write_lsn1;
+    WT_LSN write_lsn2;
 
     WT_DATA_HANDLE *dhandle; /* Current data handle */
 
diff --git a/src/log/log.c b/src/log/log.c
index 69b807eab..65d145e00 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -152,6 +152,8 @@ __log_wait_for_earlier_slot(WT_SESSION_IMPL *session, WT_LOGSLOT *slot)
     log = conn->log;
     yield_count = 0;
 
+    session->log_early1 = __wt_clock(session);
+    session->early_lsn1 = log->write_lsn;
     while (__wt_log_cmp(&log->write_lsn, &slot->slot_release_lsn) != 0) {
         /*
          * If we're on a locked path and the write LSN is not advancing, unlock in case an earlier
@@ -172,6 +174,8 @@ __log_wait_for_earlier_slot(WT_SESSION_IMPL *session, WT_LOGSLOT *slot)
         if (F_ISSET(session, WT_SESSION_LOCKED_SLOT))
             __wt_spin_lock(session, &log->log_slot_lock);
     }
+    session->log_early2 = __wt_clock(session);
+    session->early_lsn2 = log->write_lsn;
 }
 
 /*
@@ -1864,6 +1868,14 @@ __log_check_partial_write(WT_SESSION_IMPL *session, WT_ITEM *buf, uint32_t recle
     return (reclen > 0 && rec[reclen - 1] == 0);
 }
 
+#define MAXDBG 16
+uint64_t dbgi;
+struct {
+    uintmax_t tid;
+    uint64_t i;
+    WT_LSN lsn;
+} dbg[MAXDBG];
+
 /*
  * __wt_log_release --
  *     Release a log slot.
@@ -1874,8 +1886,8 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep)
     WT_CONNECTION_IMPL *conn;
     WT_DECL_RET;
     WT_LOG *log;
-    WT_LSN sync_lsn;
-    uint64_t fsync_duration_usecs, time_start, time_stop;
+    WT_LSN save_lsn, save_lsn2, sync_lsn;
+    uint64_t fsync_duration_usecs, time_start, time_stop, x, x1;
     int64_t release_buffered, release_bytes;
     bool locked;
 
@@ -1930,10 +1942,30 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep)
     WT_STAT_CONN_INCR(session, log_release_write_lsn);
     __log_wait_for_earlier_slot(session, slot);
 
+    x = __wt_atomic_add64(&dbgi, 1);
+    log->last_rel = *slot;
+    log->last_relp = slot;
+    log->last_reli = slot - &log->slot_pool[0];
+    session->log_clock1 = __wt_clock(session);
     log->write_start_lsn = slot->slot_start_lsn;
-    log->write_lsn = slot->slot_end_lsn;
+    session->log_clock2 = __wt_clock(session);
+    save_lsn2 = log->write_lsn = slot->slot_end_lsn;
+    session->log_clock3 = __wt_clock(session);
+    WT_READ_BARRIER();
+    session->log_end3 = session->log_end2;
+    session->log_end2 = session->log_end1;
+    session->log_end1 = save_lsn = slot->slot_end_lsn;
+    x1 = x % MAXDBG;
+    __wt_thread_id(&dbg[x1].tid);
+    dbg[x1].lsn = save_lsn;
+    dbg[x1].i = slot - &log->slot_pool[0];
 
     WT_ASSERT(session, slot != log->active_slot);
+    session->log_write1 = __wt_clock(session);
+    session->write_lsn1 = log->write_lsn;
+    WT_ASSERT(session, __wt_log_cmp(&save_lsn, &log->write_lsn) <= 0);
+    session->log_write2 = __wt_clock(session);
+    session->write_lsn2 = log->write_lsn;
     __wt_cond_signal(session, log->log_write_cond);
     F_CLR(slot, WT_SLOT_FLUSH);
 
@@ -2584,9 +2616,11 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, ui
     WT_CONNECTION_IMPL *conn;
     WT_DECL_RET;
     WT_LOG *log;
+    WT_LOGSLOT saveslot;
     WT_LOG_RECORD *logrec;
     WT_LSN lsn;
-    WT_MYSLOT myslot;
+    WT_MYSLOT myslot, myslot2;
+    uint64_t count, start, now;
     int64_t release_size;
     uint32_t fill_size, force, rdup_len;
     bool free_slot;
@@ -2673,6 +2707,7 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, ui
         ret = __wt_log_slot_switch(session, &myslot, true, false, NULL);
     if (ret == 0)
         ret = __wt_log_fill(session, &myslot, false, record, &lsn);
+    saveslot = *(myslot.slot);
     release_size = __wt_log_slot_release(&myslot, (int64_t)rdup_len);
     /*
      * If we get an error we still need to do proper accounting in the slot fields. XXX On error we
@@ -2682,6 +2717,7 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, ui
         myslot.slot->slot_error = ret;
     WT_ASSERT(session, ret == 0);
     if (WT_LOG_SLOT_DONE(release_size)) {
+        myslot2 = myslot;
         WT_ERR(__wt_log_release(session, myslot.slot, &free_slot));
         if (free_slot)
             __wt_log_slot_free(session, myslot.slot);
@@ -2699,8 +2735,25 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, ui
     }
     if (LF_ISSET(WT_LOG_FLUSH)) {
         /* Wait for our writes to reach the OS */
-        while (__wt_log_cmp(&log->write_lsn, &lsn) <= 0 && myslot.slot->slot_error == 0)
+        count = 0;
+        start = __wt_clock(session);
+        while (__wt_log_cmp(&log->write_lsn, &lsn) <= 0 && myslot.slot->slot_error == 0) {
             __wt_cond_wait(session, log->log_write_cond, 10000, NULL);
+            count++;
+#if 0
+            if (__wt_log_cmp(&log->write_start_lsn, &myslot.slot->slot_start_lsn) == 0) {
+                if (__wt_log_cmp(&log->write_lsn, &log->write_start_lsn) == 0) {
+                    __wt_errx(session, "LOG_WRITE: Lost write_lsn");
+                    abort();
+                }
+            }
+#endif
+            now = __wt_clock(session);
+            if (WT_CLOCKDIFF_SEC(now, start) > 10) {
+                __wt_errx(session, "LOG_WRITE: Waited for more than 10 seconds");
+                abort();
+            }
+        }
     } else if (LF_ISSET(WT_LOG_FSYNC)) {
         /* Wait for our writes to reach disk */
         while (__wt_log_cmp(&log->sync_lsn, &lsn) <= 0 && myslot.slot->slot_error == 0)
