From 5cc90f060caace93c0bf041d3cc37208f425f623 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 14 Mar 2013 21:56:48 -0400 Subject: [PATCH] Fix the logger to treat newlines better, hopefully. Closes #199 --- .../mods/fml/relauncher/FMLRelaunchLog.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/common/cpw/mods/fml/relauncher/FMLRelaunchLog.java b/common/cpw/mods/fml/relauncher/FMLRelaunchLog.java index d8d2075afd..cd3785875f 100644 --- a/common/cpw/mods/fml/relauncher/FMLRelaunchLog.java +++ b/common/cpw/mods/fml/relauncher/FMLRelaunchLog.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -110,15 +110,17 @@ public class FMLRelaunchLog super.reset(); currentMessage.append(record.replace(FMLLogFormatter.LINE_SEPARATOR, "\n")); - if (currentMessage.lastIndexOf("\n")>=0) + // Are we longer than just the line separator? + int lastIdx = -1; + int idx = currentMessage.indexOf("\n",lastIdx+1); + while (idx > 0) + { + log.log(Level.INFO, currentMessage.substring(lastIdx+1,idx)); + lastIdx = idx; + idx = currentMessage.indexOf("\n",lastIdx+1); + } + if (lastIdx >= 0) { - // Are we longer than just the line separator? - if (currentMessage.length()>1) - { - // Trim the line separator - currentMessage.setLength(currentMessage.length()-1); - log.log(Level.INFO, currentMessage.toString()); - } currentMessage.setLength(0); } }