From 3ec4a69012c1ca239a5e188bb9826c1114902eaf Mon Sep 17 00:00:00 2001 From: amontano Date: Sat, 14 Oct 2006 07:27:00 +0000 Subject: [PATCH] Added more efficient logging. --- .../tib/scanner/FileSyllableListTree.java | 2 +- .../thdl/tib/scanner/OnLineScannerFilter.java | 26 ++++++++++++------- .../thdl/tib/scanner/RemoteScannerFilter.java | 16 ++++++------ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/source/org/thdl/tib/scanner/FileSyllableListTree.java b/source/org/thdl/tib/scanner/FileSyllableListTree.java index b544601..6e14b02 100644 --- a/source/org/thdl/tib/scanner/FileSyllableListTree.java +++ b/source/org/thdl/tib/scanner/FileSyllableListTree.java @@ -151,7 +151,7 @@ public class FileSyllableListTree implements SyllableListTree { // something is wrong ScannerLogger sl = new ScannerLogger(); - sl.writeLog("Crash\tFileSyllableListTree\t" + "size: " + fileSize + "; bytes: " + Integer.toHexString(pos)); + sl.writeLog("1\tFileSyllableListTree\t" + "size: " + fileSize + "; bytes: " + Integer.toHexString(pos)); // try to open again, but not corrupting the file wordRaf = new RandomAccessFile(archivo + ".wrd", "r"); diff --git a/source/org/thdl/tib/scanner/OnLineScannerFilter.java b/source/org/thdl/tib/scanner/OnLineScannerFilter.java index 9a7cf31..8e61333 100644 --- a/source/org/thdl/tib/scanner/OnLineScannerFilter.java +++ b/source/org/thdl/tib/scanner/OnLineScannerFilter.java @@ -41,6 +41,7 @@ public class OnLineScannerFilter extends HttpServlet private final static String propertyFile = "dictionary"; private final static String dictNameProperty = "onlinescannerfilter.dict-file-name"; private final static String otherLinksProperty = "onlinescannerfilter.links-to-other-stuff"; + private final static String moreLinksProperty = "onlinescannerfilter.links-to-more-stuff"; private final static String clearStr = "Clear"; private final static String buttonStr = "button"; private final static String scriptStr = "script"; @@ -62,12 +63,12 @@ public class OnLineScannerFilter extends HttpServlet } catch (Exception e) { - sl.writeLog("Crash\tOnLineScannerFilter"); + sl.writeLog("1\t1"); sl.writeException(e); } dictionaries = scanner.getDictionaryDescriptions(); - sl.writeLog("Creation\tOnLineScannerFilter"); + sl.writeLog("2\t1"); } synchronized public void doGet(HttpServletRequest request, @@ -89,7 +90,7 @@ public class OnLineScannerFilter extends HttpServlet } catch (Exception e) { - sl.writeLog("Crash\tOnLineScannerFilter"); + sl.writeLog("1\t1"); sl.writeException(e); return; } @@ -140,7 +141,7 @@ public class OnLineScannerFilter extends HttpServlet if (useTHDLBanner) { - out.println(""); + out.println(""); out.println("
"); out.println("
"); out.println("
"); @@ -269,14 +270,22 @@ public class OnLineScannerFilter extends HttpServlet out.println(""); out.println("
"); + try + { + out.println(rb.getString(moreLinksProperty)); + } + catch (MissingResourceException e) + { + // do nothing + } if (parrafo != null) { - sl.writeLog("Translation\tOnLineScannerFilter"); + sl.writeLog("4\t1"); if (ds!=null && !ds.isEmpty()) desglosar(parrafo, out, wantsTibetan); } - else sl.writeLog("Invocation\tOnLineScannerFilter"); + else sl.writeLog("3\t1"); out.println(TibetanScanner.copyrightHTML); if (useTHDLBanner) out.println("
"); @@ -386,7 +395,6 @@ public class OnLineScannerFilter extends HttpServlet if (words == null) return; - pw.println(""); for (j = 0; j < words.length; j++) { @@ -438,7 +446,7 @@ public class OnLineScannerFilter extends HttpServlet pw.println(" "); } } catch (Exception e) { - sl.writeLog("Crash\tOnLineScannerFilter\t" + word.getWylie()); + sl.writeLog("1\t1\t" + word.getWylie()); sl.writeException(e); } @@ -450,7 +458,7 @@ public class OnLineScannerFilter extends HttpServlet { super.destroy(); sl.setUserIP(null); - sl.writeLog("Shutdown\tOnLineScannerFilter"); + sl.writeLog("5\t1"); scanner.destroy(); } diff --git a/source/org/thdl/tib/scanner/RemoteScannerFilter.java b/source/org/thdl/tib/scanner/RemoteScannerFilter.java index 3498834..79aeb63 100644 --- a/source/org/thdl/tib/scanner/RemoteScannerFilter.java +++ b/source/org/thdl/tib/scanner/RemoteScannerFilter.java @@ -50,11 +50,11 @@ public class RemoteScannerFilter extends GenericServlet } catch (Exception e) { - sl.writeLog("Crash\tRemoteScannerFilter"); + sl.writeLog("1\t2"); sl.writeException(e); } ds = scanner.getDictionarySource(); - sl.writeLog("Creation\tRemoteScannerFilter"); + sl.writeLog("Creation\t2"); } public void service(ServletRequest req, ServletResponse res) //throws ServletException, IOException @@ -72,7 +72,7 @@ public class RemoteScannerFilter extends GenericServlet } catch (Exception e) { - sl.writeLog("Crash\tRemoteScannerFilter"); + sl.writeLog("1\t2"); sl.writeException(e); return; } @@ -84,7 +84,7 @@ public class RemoteScannerFilter extends GenericServlet { if (dicts.equals("names")) { - sl.writeLog("Invocation\tRemoteScannerFilter"); + sl.writeLog("3\t2"); dicDescrip = scanner.getDictionaryDescriptions(); if (dicDescrip==null) { @@ -111,7 +111,7 @@ public class RemoteScannerFilter extends GenericServlet } catch (Exception e) { - sl.writeLog("Crash\tRemoteScannerFilter"); + sl.writeLog("1\t2"); sl.writeException(e); return; } @@ -120,7 +120,7 @@ public class RemoteScannerFilter extends GenericServlet /* FIXME: sometimes getDef raises a NullPointerException. In the meantime, I'll just keep it from crashing */ - sl.writeLog("Translation\tRemoteScannerFilter"); + sl.writeLog("4\t2"); try { @@ -144,7 +144,7 @@ public class RemoteScannerFilter extends GenericServlet } catch (Exception e) { - sl.writeLog("Crash\tRemoteScannerFilter\t" + word.getWylie()); + sl.writeLog("1\t2\t" + word.getWylie()); sl.writeException(e); } @@ -156,7 +156,7 @@ public class RemoteScannerFilter extends GenericServlet { super.destroy(); sl.setUserIP(null); - sl.writeLog("Shutdown\tRemoteScannerFilter"); + sl.writeLog("5\t2"); scanner.destroy(); } } \ No newline at end of file