From 1f7c1fd2c948512e3aedb6406fc49092b0acc8f6 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Tue, 10 Apr 2012 13:38:27 +0000 Subject: [PATCH] Removing logging, which is no longer needed. --- .../logic/modifiers/LoggingThreadLocal.java | 103 +++++++++--------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/modifiers/LoggingThreadLocal.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/modifiers/LoggingThreadLocal.java index 0a6400bf2..977999e31 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/modifiers/LoggingThreadLocal.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/modifiers/LoggingThreadLocal.java @@ -1,77 +1,72 @@ package com.gempukku.lotro.logic.modifiers; -import com.gempukku.lotro.common.ApplicationRoot; import com.gempukku.lotro.game.PhysicalCard; import org.apache.log4j.Logger; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; - public class LoggingThreadLocal { private static final Logger LOG = Logger.getLogger(LoggingThreadLocal.class); - private static ThreadLocal _logLocal = new ThreadLocal(); - private static ThreadLocal _start = new ThreadLocal(); - private static ThreadLocal _level = new ThreadLocal(); - - private static FileOutputStream _fos = null; +// private static ThreadLocal _logLocal = new ThreadLocal(); +// private static ThreadLocal _start = new ThreadLocal(); +// private static ThreadLocal _level = new ThreadLocal(); +// +// private static FileOutputStream _fos = null; private static synchronized void initializeOutputStream() { - if (_fos == null) { - try { - _fos = new FileOutputStream(new File(ApplicationRoot.getRoot(), "longActions.txt")); - } catch (IOException exp) { - throw new RuntimeException(exp); - } - } +// if (_fos == null) { +// try { +// _fos = new FileOutputStream(new File(ApplicationRoot.getRoot(), "longActions.txt")); +// } catch (IOException exp) { +// throw new RuntimeException(exp); +// } +// } } public static void start() { - if (_fos == null) - initializeOutputStream(); - - _logLocal.set(new StringBuilder()); - _start.set(System.currentTimeMillis()); - _level.set(0); +// if (_fos == null) +// initializeOutputStream(); +// +// _logLocal.set(new StringBuilder()); +// _start.set(System.currentTimeMillis()); +// _level.set(0); } public static void logMethodStart(PhysicalCard card, String desc) { - StringBuilder builder = _logLocal.get(); - if (builder != null) { - int level = _level.get(); - for (int i = 0; i < level; i++) - builder.append("\t"); - builder.append(desc); - if (card != null) - builder.append(" ").append(card.getBlueprintId()); - builder.append("\r\n"); - _level.set(level + 1); - } +// StringBuilder builder = _logLocal.get(); +// if (builder != null) { +// int level = _level.get(); +// for (int i = 0; i < level; i++) +// builder.append("\t"); +// builder.append(desc); +// if (card != null) +// builder.append(" ").append(card.getBlueprintId()); +// builder.append("\r\n"); +// _level.set(level + 1); +// } } public static void logMethodEnd() { - StringBuilder builder = _logLocal.get(); - if (builder != null) { - _level.set(_level.get() - 1); - } +// StringBuilder builder = _logLocal.get(); +// if (builder != null) { +// _level.set(_level.get() - 1); +// } } public static void stop(boolean writeOperation) { - long start = _start.get(); - long time = System.currentTimeMillis() - start; - if (time > 100) { - String str = "Processing took (" + writeOperation + ") " + time + "ms: \n" + _logLocal.get().toString(); - try { - synchronized (_fos) { - _fos.write(str.getBytes()); - _fos.flush(); - } - } catch (IOException exp) { - throw new RuntimeException(exp); - } - } - _start.set(null); - _logLocal.set(null); - _level.set(null); +// long start = _start.get(); +// long time = System.currentTimeMillis() - start; +// if (time > 100) { +// String str = "Processing took (" + writeOperation + ") " + time + "ms: \n" + _logLocal.get().toString(); +// try { +// synchronized (_fos) { +// _fos.write(str.getBytes()); +// _fos.flush(); +// } +// } catch (IOException exp) { +// throw new RuntimeException(exp); +// } +// } +// _start.set(null); +// _logLocal.set(null); +// _level.set(null); } }