Added more efficient logging.

This commit is contained in:
amontano 2006-10-14 07:27:00 +00:00
parent 47c25159a6
commit 3ec4a69012
3 changed files with 26 additions and 18 deletions

View file

@ -151,7 +151,7 @@ public class FileSyllableListTree implements SyllableListTree
{ {
// something is wrong // something is wrong
ScannerLogger sl = new ScannerLogger(); 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 // try to open again, but not corrupting the file
wordRaf = new RandomAccessFile(archivo + ".wrd", "r"); wordRaf = new RandomAccessFile(archivo + ".wrd", "r");

View file

@ -41,6 +41,7 @@ public class OnLineScannerFilter extends HttpServlet
private final static String propertyFile = "dictionary"; private final static String propertyFile = "dictionary";
private final static String dictNameProperty = "onlinescannerfilter.dict-file-name"; private final static String dictNameProperty = "onlinescannerfilter.dict-file-name";
private final static String otherLinksProperty = "onlinescannerfilter.links-to-other-stuff"; 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 clearStr = "Clear";
private final static String buttonStr = "button"; private final static String buttonStr = "button";
private final static String scriptStr = "script"; private final static String scriptStr = "script";
@ -62,12 +63,12 @@ public class OnLineScannerFilter extends HttpServlet
} }
catch (Exception e) catch (Exception e)
{ {
sl.writeLog("Crash\tOnLineScannerFilter"); sl.writeLog("1\t1");
sl.writeException(e); sl.writeException(e);
} }
dictionaries = scanner.getDictionaryDescriptions(); dictionaries = scanner.getDictionaryDescriptions();
sl.writeLog("Creation\tOnLineScannerFilter"); sl.writeLog("2\t1");
} }
synchronized public void doGet(HttpServletRequest request, synchronized public void doGet(HttpServletRequest request,
@ -89,7 +90,7 @@ public class OnLineScannerFilter extends HttpServlet
} }
catch (Exception e) catch (Exception e)
{ {
sl.writeLog("Crash\tOnLineScannerFilter"); sl.writeLog("1\t1");
sl.writeException(e); sl.writeException(e);
return; return;
} }
@ -140,7 +141,7 @@ public class OnLineScannerFilter extends HttpServlet
if (useTHDLBanner) if (useTHDLBanner)
{ {
out.println("<script type=\"text/javascript\" src=\"/thdl/scripts/banner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"http://www.thdl.org/thdl/scripts/banner.js\"></script>");
out.println("<div id=\"sub_banner\">"); out.println("<div id=\"sub_banner\">");
out.println("<div id=\"search\">"); out.println("<div id=\"search\">");
out.println(" <form method=\"get\" action=\"http://www.google.com/u/thdl\">"); out.println(" <form method=\"get\" action=\"http://www.google.com/u/thdl\">");
@ -269,14 +270,22 @@ public class OnLineScannerFilter extends HttpServlet
out.println("</textarea>"); out.println("</textarea>");
out.println("</form>"); out.println("</form>");
try
{
out.println(rb.getString(moreLinksProperty));
}
catch (MissingResourceException e)
{
// do nothing
}
if (parrafo != null) if (parrafo != null)
{ {
sl.writeLog("Translation\tOnLineScannerFilter"); sl.writeLog("4\t1");
if (ds!=null && !ds.isEmpty()) if (ds!=null && !ds.isEmpty())
desglosar(parrafo, out, wantsTibetan); desglosar(parrafo, out, wantsTibetan);
} }
else sl.writeLog("Invocation\tOnLineScannerFilter"); else sl.writeLog("3\t1");
out.println(TibetanScanner.copyrightHTML); out.println(TibetanScanner.copyrightHTML);
if (useTHDLBanner) out.println("</div><!--END main-->"); if (useTHDLBanner) out.println("</div><!--END main-->");
@ -386,7 +395,6 @@ public class OnLineScannerFilter extends HttpServlet
if (words == null) if (words == null)
return; return;
pw.println("<table border=\"1\" width=\"100%\">"); pw.println("<table border=\"1\" width=\"100%\">");
for (j = 0; j < words.length; j++) { for (j = 0; j < words.length; j++) {
@ -438,7 +446,7 @@ public class OnLineScannerFilter extends HttpServlet
pw.println(" </tr>"); pw.println(" </tr>");
} }
} catch (Exception e) { } catch (Exception e) {
sl.writeLog("Crash\tOnLineScannerFilter\t" + word.getWylie()); sl.writeLog("1\t1\t" + word.getWylie());
sl.writeException(e); sl.writeException(e);
} }
@ -450,7 +458,7 @@ public class OnLineScannerFilter extends HttpServlet
{ {
super.destroy(); super.destroy();
sl.setUserIP(null); sl.setUserIP(null);
sl.writeLog("Shutdown\tOnLineScannerFilter"); sl.writeLog("5\t1");
scanner.destroy(); scanner.destroy();
} }

View file

@ -50,11 +50,11 @@ public class RemoteScannerFilter extends GenericServlet
} }
catch (Exception e) catch (Exception e)
{ {
sl.writeLog("Crash\tRemoteScannerFilter"); sl.writeLog("1\t2");
sl.writeException(e); sl.writeException(e);
} }
ds = scanner.getDictionarySource(); ds = scanner.getDictionarySource();
sl.writeLog("Creation\tRemoteScannerFilter"); sl.writeLog("Creation\t2");
} }
public void service(ServletRequest req, ServletResponse res) //throws ServletException, IOException public void service(ServletRequest req, ServletResponse res) //throws ServletException, IOException
@ -72,7 +72,7 @@ public class RemoteScannerFilter extends GenericServlet
} }
catch (Exception e) catch (Exception e)
{ {
sl.writeLog("Crash\tRemoteScannerFilter"); sl.writeLog("1\t2");
sl.writeException(e); sl.writeException(e);
return; return;
} }
@ -84,7 +84,7 @@ public class RemoteScannerFilter extends GenericServlet
{ {
if (dicts.equals("names")) if (dicts.equals("names"))
{ {
sl.writeLog("Invocation\tRemoteScannerFilter"); sl.writeLog("3\t2");
dicDescrip = scanner.getDictionaryDescriptions(); dicDescrip = scanner.getDictionaryDescriptions();
if (dicDescrip==null) if (dicDescrip==null)
{ {
@ -111,7 +111,7 @@ public class RemoteScannerFilter extends GenericServlet
} }
catch (Exception e) catch (Exception e)
{ {
sl.writeLog("Crash\tRemoteScannerFilter"); sl.writeLog("1\t2");
sl.writeException(e); sl.writeException(e);
return; return;
} }
@ -120,7 +120,7 @@ public class RemoteScannerFilter extends GenericServlet
/* FIXME: sometimes getDef raises a NullPointerException. /* FIXME: sometimes getDef raises a NullPointerException.
In the meantime, I'll just keep it from crashing In the meantime, I'll just keep it from crashing
*/ */
sl.writeLog("Translation\tRemoteScannerFilter"); sl.writeLog("4\t2");
try try
{ {
@ -144,7 +144,7 @@ public class RemoteScannerFilter extends GenericServlet
} }
catch (Exception e) catch (Exception e)
{ {
sl.writeLog("Crash\tRemoteScannerFilter\t" + word.getWylie()); sl.writeLog("1\t2\t" + word.getWylie());
sl.writeException(e); sl.writeException(e);
} }
@ -156,7 +156,7 @@ public class RemoteScannerFilter extends GenericServlet
{ {
super.destroy(); super.destroy();
sl.setUserIP(null); sl.setUserIP(null);
sl.writeLog("Shutdown\tRemoteScannerFilter"); sl.writeLog("5\t2");
scanner.destroy(); scanner.destroy();
} }
} }