diff --git a/apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java
index f010be834db2d04e7e98d0d043dc14d601adc5ab..3ccd355c2dacba5784240a84013bfe2788881887 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java
@@ -44,6 +44,8 @@ public class LogsHelper extends HelperBase {
     }
     ******/
 
+    private final static String NL = System.getProperty("line.separator");
+
     /** formats in reverse order */
     private String formatMessages(List<String> msgs) {
         if (msgs.isEmpty())
@@ -55,6 +57,11 @@ public class LogsHelper extends HelperBase {
         for (int i = msgs.size(); i > 0; i--) { 
             String msg = msgs.get(i - 1);
             msg = msg.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
+            // remove  last \n that LogRecordFormatter added
+            if (msg.endsWith(NL))
+                msg = msg.substring(0, msg.length() - NL.length());
+            // replace \n so that exception stack traces will format correctly and will paste nicely into pastebin
+            msg = msg.replace("\n", "<br>&nbsp;&nbsp;&nbsp;&nbsp;\n");
             buf.append("<li>");
             if (colorize) {
                 String color;