From 9e05814d9004b985326dc6a5e9be6afbaae16fcc Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 5 Mar 2001 16:07:29 +0000 Subject: [PATCH] Grouped all logging activity around Application, and made Application less dependent on helma.objectmodel.db.Server. --- src/helma/framework/core/Action.java | 8 +- src/helma/framework/core/Application.java | 82 ++++++++++++++----- src/helma/framework/core/ESNode.java | 22 ++--- src/helma/framework/core/FunctionFile.java | 4 +- src/helma/framework/core/HopExtension.java | 12 +-- src/helma/framework/core/Prototype.java | 4 +- .../framework/core/RequestEvaluator.java | 14 ++-- src/helma/framework/core/Skin.java | 8 +- src/helma/framework/core/SkinFile.java | 4 +- src/helma/framework/core/TypeManager.java | 35 ++++---- 10 files changed, 118 insertions(+), 75 deletions(-) diff --git a/src/helma/framework/core/Action.java b/src/helma/framework/core/Action.java index 0b35e313..47582fc9 100644 --- a/src/helma/framework/core/Action.java +++ b/src/helma/framework/core/Action.java @@ -61,7 +61,7 @@ public class Action { String content = new String (cbuf); update (content); } catch (Exception filex) { - IServer.getLogger().log ("*** Error reading action file "+file+": "+filex); + app.logEvent ("*** Error reading action file "+file+": "+filex); } lastmod = fmod; } @@ -69,7 +69,7 @@ public class Action { public void update (String content) throws Exception { - // IServer.getLogger().log ("Reading text template " + name); + // app.logEvent ("Reading text template " + name); functionName = name+"_hop_action"; @@ -145,10 +145,10 @@ public class Action { sl = (ASTStatementList) parser.StatementList(); is.close(); } catch (ParseException x) { - IServer.getLogger().log ("Error parsing file "+app.getName()+":"+prototype.getName()+"/"+file.getName()+": "+x); + app.logEvent ("Error parsing file "+app.getName()+":"+prototype.getName()+"/"+file.getName()+": "+x); throw new EcmaScriptParseException (x, new StringEvaluationSource(fulltext, null)); } catch (Exception x) { - IServer.getLogger().log ("Error parsing file "+app.getName()+":"+prototype.getName()+"/"+file.getName()+": "+x); + app.logEvent ("Error parsing file "+app.getName()+":"+prototype.getName()+"/"+file.getName()+": "+x); throw new RuntimeException (x.getMessage ()); } diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index d0939a74..9331efe1 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -13,7 +13,7 @@ import helma.objectmodel.*; import helma.objectmodel.db.NodeManager; import helma.objectmodel.db.WrappedNodeManager; import helma.xmlrpc.*; -import helma.util.CacheMap; +import helma.util.*; import FESI.Data.*; import FESI.Interpreter.*; import com.sleepycat.db.DbException; @@ -28,7 +28,7 @@ import com.sleepycat.db.DbException; public class Application extends UnicastRemoteObject implements IRemoteApp, Runnable { SystemProperties props; - File appDir, dbDir; + File home, appDir, dbDir; private String name; protected NodeManager nmgr; protected static WebServer xmlrpc; @@ -56,6 +56,9 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn // Map of requesttrans -> active requestevaluators Hashtable activeRequests; + + // Two logs for each application: events and accesses + Logger eventLog, accessLog; protected String templateExtension, scriptExtension, actionExtension, skinExtension; @@ -74,21 +77,27 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn super (); } - public Application (String name, File dbHome, File appHome) throws RemoteException, DbException { + public Application (String name, SystemProperties sysProps, File home) throws RemoteException, DbException, IllegalArgumentException { + + if (name == null || name.trim().length() == 0) + throw new IllegalArgumentException ("Invalid application name: "+name); this.name = name; + this.home = home; threadgroup = new ThreadGroup ("TX-"+name); - appDir = new File (appHome, name); + appDir = new File (home, "apps"); + appDir = new File (appDir, name); if (!appDir.exists()) appDir.mkdirs (); - dbDir = new File (dbHome, name); + dbDir = new File (home, "db"); + dbDir = new File (dbDir, name); if (!dbDir.exists()) dbDir.mkdirs (); File propfile = new File (appDir, "app.properties"); - props = new SystemProperties (propfile.getAbsolutePath (), IServer.sysProps); + props = new SystemProperties (propfile.getAbsolutePath (), sysProps); nmgr = new NodeManager (this, dbDir.getAbsolutePath (), props); @@ -114,7 +123,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn public void start () { eval = new RequestEvaluator (this); - IServer.getLogger().log ("Starting evaluators for "+name); + logEvent ("Starting evaluators for "+name); int maxThreads = 12; try { maxThreads = Integer.parseInt (props.getProperty ("maxThreads")); @@ -131,7 +140,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn typemgr = new TypeManager (this); typemgr.check (); - IServer.getLogger().log ("Started type manager for "+name); + logEvent ("Started type manager for "+name); rootMapping = getDbMapping ("root"); userMapping = getDbMapping ("user"); @@ -146,7 +155,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn worker = new Thread (this, "Worker-"+name); worker.setPriority (Thread.NORM_PRIORITY+2); worker.start (); - IServer.getLogger().log ("session cleanup and scheduler thread started"); + logEvent ("session cleanup and scheduler thread started"); xmlrpc.addHandler (this.name, new XmlRpcInvoker (this)); @@ -364,7 +373,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn users.setNode (uname, unode); return users.getNode (uname, false); } catch (Exception x) { - IServer.getLogger().log ("Error registering User: "+x); + logEvent ("Error registering User: "+x); return null; } } @@ -438,11 +447,42 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn this.baseURI = uri; } + public void logEvent (String msg) { + if (eventLog == null) + eventLog = getLogger (name+"_event"); + eventLog.log (msg); + } + + public void logAccess (String msg) { + if (accessLog == null) + accessLog = getLogger (name+"_access"); + accessLog.log (msg); + } + + public Logger getLogger (String logname) { + Logger log = null; + String logDir = props.getProperty ("logdir"); + if (logDir == null) + logDir = "log"; + try { + File helper = new File (logDir); + if (home != null && !helper.isAbsolute ()) + helper = new File (home, logDir); + logDir = helper.getAbsolutePath (); + log = new Logger (logDir, logname); + } catch (IOException iox) { + System.err.println ("Could not create log "+logname+" for application "+name+": "+iox); + // fallback to System.out + log = new Logger (System.out); + } + return log; + } + public void run () { long cleanupSleep = 60000; // thread sleep interval (fixed) long scheduleSleep = 60000; // interval for scheduler invocation long lastScheduler = 0; - IServer.getLogger().log ("Starting scheduler for "+name); + logEvent ("Starting scheduler for "+name); // as first thing, invoke function onStart in the root object try { eval.invokeFunction ((INode) null, "onStart", new ESValue[0]); @@ -458,12 +498,12 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn try { worker.sleep (cleanupSleep); } catch (InterruptedException x) { - IServer.getLogger().log ("Scheduler for "+name+" interrupted"); + logEvent ("Scheduler for "+name+" interrupted"); worker = null; break; } try { - IServer.getLogger().log ("Cleaning up "+name+": " + sessions.size () + " sessions active"); + logEvent ("Cleaning up "+name+": " + sessions.size () + " sessions active"); long now = System.currentTimeMillis (); Hashtable cloned = (Hashtable) sessions.clone (); for (Enumeration e = cloned.elements (); e.hasMoreElements (); ) { @@ -482,9 +522,9 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn } } - IServer.getLogger().log ("Cleaned up "+name+": " + sessions.size () + " sessions remaining"); + logEvent ("Cleaned up "+name+": " + sessions.size () + " sessions remaining"); } catch (Exception cx) { - IServer.getLogger().log ("Error cleaning up sessions: "+cx); + logEvent ("Error cleaning up sessions: "+cx); cx.printStackTrace (); } @@ -502,10 +542,10 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn else scheduleSleep = ret; } catch (Exception ignore) {} - IServer.getLogger().log ("Called scheduler for "+name+", will sleep for "+scheduleSleep+" millis"); + logEvent ("Called scheduler for "+name+", will sleep for "+scheduleSleep+" millis"); } } - IServer.getLogger().log ("Scheduler for "+name+" exiting"); + logEvent ("Scheduler for "+name+" exiting"); } public void rewireDbMappings () { @@ -514,7 +554,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn DbMapping m = (DbMapping) e.nextElement (); m.rewire (); } catch (Exception x) { - IServer.getLogger().log ("Error rewiring DbMappings: "+x); + logEvent ("Error rewiring DbMappings: "+x); } } } @@ -535,12 +575,12 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, Runn * Periodically called to log thread stats for this application */ public void printThreadStats () { - IServer.getLogger().log ("Thread Stats for "+name+": "+threadgroup.activeCount()+" active"); + logEvent ("Thread Stats for "+name+": "+threadgroup.activeCount()+" active"); Runtime rt = Runtime.getRuntime (); long free = rt.freeMemory (); long total = rt.totalMemory (); - IServer.getLogger().log ("Free memory: "+(free/1024)+" kB"); - IServer.getLogger().log ("Total memory: "+(total/1024)+" kB"); + logEvent ("Free memory: "+(free/1024)+" kB"); + logEvent ("Total memory: "+(total/1024)+" kB"); } /** diff --git a/src/helma/framework/core/ESNode.java b/src/helma/framework/core/ESNode.java index e6429661..8427ab83 100644 --- a/src/helma/framework/core/ESNode.java +++ b/src/helma/framework/core/ESNode.java @@ -45,7 +45,7 @@ public class ESNode extends ObjectPrototype { public ESNode (ESObject prototype, Evaluator evaluator, Object obj, RequestEvaluator eval) { super (prototype, evaluator); - // IServer.getLogger().log ("in ESNode constructor: "+o.getClass ()); + // eval.app.logEvent ("in ESNode constructor: "+o.getClass ()); this.eval = eval; if (obj == null) node = new Node (); @@ -135,7 +135,7 @@ public class ESNode extends ObjectPrototype { node.setContent (p.getContent (), p.getContentType ()); return true; } catch (Exception x) { - IServer.getLogger().log ("error in ESNode.setContent: "+x); + eval.app.logEvent ("error in ESNode.setContent: "+x); } } } @@ -145,7 +145,7 @@ public class ESNode extends ObjectPrototype { node.setContent (i.getContent (), i.getContentType ()); return true; } catch (Exception x) { - IServer.getLogger().log ("error in ESNode.setContent: "+x); + eval.app.logEvent ("error in ESNode.setContent: "+x); } } } @@ -215,12 +215,12 @@ public class ESNode extends ObjectPrototype { * when they go from transient to persistent state. */ protected void rewrap (INode newnode) { - // IServer.getLogger().log ("rewrapping "+this+" from "+node+" to "+newnode); + // eval.app.logEvent ("rewrapping "+this+" from "+node+" to "+newnode); if (newnode == null) throw new RuntimeException ("Non-consistent check-in detected in rewrap ()"); INode oldnode = node; if (oldnode == newnode) { - // IServer.getLogger().log ("loop detected or new peers unchanged in rewrap"); + // eval.app.logEvent ("loop detected or new peers unchanged in rewrap"); return; } // set node and nodeID to new node @@ -232,7 +232,7 @@ public class ESNode extends ObjectPrototype { for (int i=0; i "+esn); + // eval.app.logEvent ("rewrapping node: "+next+" -> "+esn); if (esn != null) { esn.rewrap (newnode.getSubnodeAt (i)); } @@ -316,7 +316,7 @@ public class ESNode extends ObjectPrototype { public void putProperty(String propertyName, ESValue propertyValue, int hash) throws EcmaScriptException { checkNode (); - // IServer.getLogger().log ("put property called: "+propertyName+", "+propertyValue.getClass()); + // eval.app.logEvent ("put property called: "+propertyName+", "+propertyValue.getClass()); if ("lastmodified".equalsIgnoreCase (propertyName) || "created".equalsIgnoreCase (propertyName) || "contentlength".equalsIgnoreCase (propertyName) || "cache".equalsIgnoreCase (propertyName)) throw new EcmaScriptException ("Can't modify read-only property \""+propertyName+"\"."); @@ -347,9 +347,9 @@ public class ESNode extends ObjectPrototype { INode newnode = node.getNode (propertyName, false); esn.rewrap (newnode); } - // IServer.getLogger().log ("*** spent "+(System.currentTimeMillis () - now)+" ms to set property "+propertyName); + // eval.app.logEvent ("*** spent "+(System.currentTimeMillis () - now)+" ms to set property "+propertyName); } else { - // IServer.getLogger().log ("got "+propertyValue.getClass ()); + // eval.app.logEvent ("got "+propertyValue.getClass ()); // A persistent node can't store anything other than the types above, so throw an exception // throw new EcmaScriptException ("Can't set a JavaScript Object or Array as property of "+node); node.setJavaObject (propertyName, propertyValue.toJavaObject ()); @@ -358,7 +358,7 @@ public class ESNode extends ObjectPrototype { public boolean deleteProperty(String propertyName, int hash) throws EcmaScriptException { checkNode (); - // IServer.getLogger().log ("delete property called: "+propertyName); + // eval.app.logEvent ("delete property called: "+propertyName); if (node.get (propertyName, false) != null) { node.unset (propertyName); return true; @@ -386,7 +386,7 @@ public class ESNode extends ObjectPrototype { public ESValue getProperty(String propertyName, int hash) throws EcmaScriptException { checkNode (); - // IServer.getLogger().log ("get property called: "+propertyName); + // eval.app.logEvent ("get property called: "+propertyName); ESValue retval = super.getProperty (propertyName, hash); if (! (retval instanceof ESUndefined)) return retval; diff --git a/src/helma/framework/core/FunctionFile.java b/src/helma/framework/core/FunctionFile.java index 32337bb9..0ba94e9c 100644 --- a/src/helma/framework/core/FunctionFile.java +++ b/src/helma/framework/core/FunctionFile.java @@ -64,9 +64,9 @@ public class FunctionFile { ObjectPrototype op = reval.getPrototype (prototype.getName()); reval.evaluator.evaluate(fr, op, es, false); } catch (IOException e) { - IServer.getLogger().log ("Error parsing function file "+app.getName()+":"+prototype.getName()+"/"+file.getName()+": "+e); + app.logEvent ("Error parsing function file "+app.getName()+":"+prototype.getName()+"/"+file.getName()+": "+e); } catch (EcmaScriptException e) { - IServer.getLogger().log ("Error parsing function file "+app.getName()+":"+prototype.getName()+"/"+file.getName()+": "+e); + app.logEvent ("Error parsing function file "+app.getName()+":"+prototype.getName()+"/"+file.getName()+": "+e); } finally { if (fr!=null) { try { diff --git a/src/helma/framework/core/HopExtension.java b/src/helma/framework/core/HopExtension.java index 5cc8e18e..06bd6b65 100644 --- a/src/helma/framework/core/HopExtension.java +++ b/src/helma/framework/core/HopExtension.java @@ -567,7 +567,7 @@ public class HopExtension { String str = arguments[0].toString (); Skin skin = (Skin) app.skincache.get (str); if (skin == null) { - skin = new Skin (str); + skin = new Skin (str, app); app.skincache.put (str, skin); } return new ESWrapper (skin, evaluator); @@ -584,7 +584,7 @@ public class HopExtension { public ESValue callFunction (ESObject thisObject, ESValue[] arguments) throws EcmaScriptException { if (arguments.length != 1 || ESNull.theNull.equals (arguments[0])) throw new EcmaScriptException ("createSkin must be called with one String argument!"); - return new ESWrapper (new Skin (arguments[0].toString()), evaluator); + return new ESWrapper (new Skin (arguments[0].toString(), app), evaluator); } } @@ -782,7 +782,7 @@ public class HopExtension { return new ESString (age.toString ()); } catch (Exception e) { - IServer.getLogger().log ("Error formatting date: "+e); + app.logEvent ("Error formatting date: "+e); e.printStackTrace (); return new ESString (""); } @@ -889,7 +889,7 @@ public class HopExtension { parser.parse (new InputSource ((Reader) p)); return ESLoader.normalizeObject (parser.getDocument(), evaluator); } catch (Exception noluck) { - IServer.getLogger().log ("Error creating XML document: "+noluck); + app.logEvent ("Error creating XML document: "+noluck); } return ESNull.theNull; } @@ -918,7 +918,7 @@ public class HopExtension { parser.parse (new InputSource ((Reader) p)); return ESLoader.normalizeObject (parser.getDocument(), evaluator); } catch (Exception noluck) { - IServer.getLogger().log ("Error creating HTML document: "+noluck); + app.logEvent ("Error creating HTML document: "+noluck); } return ESNull.theNull; } @@ -936,7 +936,7 @@ public class HopExtension { org.jdom.input.DOMBuilder builder = new org.jdom.input.DOMBuilder (); return ESLoader.normalizeObject (builder.build (doc), evaluator); } catch (Exception noluck) { - IServer.getLogger().log ("Error wrapping JDOM document: "+noluck); + app.logEvent ("Error wrapping JDOM document: "+noluck); } return ESNull.theNull; } diff --git a/src/helma/framework/core/Prototype.java b/src/helma/framework/core/Prototype.java index d3af6d62..4bd2b8cb 100644 --- a/src/helma/framework/core/Prototype.java +++ b/src/helma/framework/core/Prototype.java @@ -35,7 +35,7 @@ public class Prototype { public Prototype (File codeDir, Application app) { - IServer.getLogger().log ("Constructing Prototype "+app.getName()+"/"+codeDir.getName ()); + app.logEvent ("Constructing Prototype "+app.getName()+"/"+codeDir.getName ()); this.codeDir = codeDir; this.app = app; @@ -117,7 +117,7 @@ public class Prototype { app.typemgr.updatePrototype (this.name, codeDir, this); // TypeManager.broadcaster.broadcast ("Finished update for prototype "+name+" @ "+new Date ()+"

"); } catch (Exception x) { - IServer.getLogger().log ("Error building function protos in prototype: "+x); + app.logEvent ("Error building function protos in prototype: "+x); // TypeManager.broadcaster.broadcast ("Error updating prototype "+name+" in application "+app.getName()+":
"+x.getMessage ()+"

"); } retval = true; diff --git a/src/helma/framework/core/RequestEvaluator.java b/src/helma/framework/core/RequestEvaluator.java index 233c7932..6e84ffa5 100644 --- a/src/helma/framework/core/RequestEvaluator.java +++ b/src/helma/framework/core/RequestEvaluator.java @@ -135,7 +135,7 @@ public class RequestEvaluator implements Runnable { try { do { - // IServer.getLogger().log ("got request "+reqtype); + // app.logEvent ("got request "+reqtype); switch (reqtype) { case HTTP: @@ -339,7 +339,7 @@ public class RequestEvaluator implements Runnable { abortTransaction (false); - IServer.getLogger().log ("### Exception in "+app.getName()+"/"+req.path+": "+x); + app.logEvent ("### Exception in "+app.getName()+"/"+req.path+": "+x); // Dump the profiling data to System.err if (app.debug) { ((Transactor) Thread.currentThread ()).timer.dump (System.err); @@ -465,7 +465,7 @@ public class RequestEvaluator implements Runnable { String msg = wrong.getMessage (); if (msg == null || msg.length () == 0) msg = wrong.toString (); - IServer.getLogger().log ("Error executing "+funcdesc+": "+msg); + app.logEvent ("Error executing "+funcdesc+": "+msg); this.exception = new Exception (msg); } break; @@ -538,7 +538,7 @@ public class RequestEvaluator implements Runnable { checkThread (); wait (app.requestTimeout); if (reqtype != NONE) { - IServer.getLogger().log ("Stopping Thread for Request "+app.getName()+"/"+req.path); + app.logEvent ("Stopping Thread for Request "+app.getName()+"/"+req.path); stopThread (); res.reset (); res.write ("Error in application '"+app.getName()+"':

Request timed out.
"); @@ -641,7 +641,7 @@ public class RequestEvaluator implements Runnable { * notify. */ public synchronized void stopThread () { - IServer.getLogger().log ("Stopping Thread "+rtx); + app.logEvent ("Stopping Thread "+rtx); Transactor t = rtx; evaluator.thread = null; rtx = null; @@ -665,7 +665,7 @@ public class RequestEvaluator implements Runnable { throw new ApplicationStoppedException (); if (rtx == null || !rtx.isAlive()) { - // IServer.getLogger().log ("Starting Thread"); + // app.logEvent ("Starting Thread"); rtx = new Transactor (this, app.threadgroup, app.nmgr); evaluator.thread = rtx; rtx.start (); @@ -737,7 +737,7 @@ public class RequestEvaluator implements Runnable { esn = new ESNode (op, evaluator, n, this); objectcache.put (n, esn); - // IServer.getLogger().log ("Wrapper for "+n+" created"); + // app.logEvent ("Wrapper for "+n+" created"); } return esn; diff --git a/src/helma/framework/core/Skin.java b/src/helma/framework/core/Skin.java index bda48aed..252a9c15 100644 --- a/src/helma/framework/core/Skin.java +++ b/src/helma/framework/core/Skin.java @@ -20,8 +20,10 @@ import helma.objectmodel.IServer; public class Skin { Object[] parts; + Application app; - public Skin (String content) { + public Skin (String content, Application app) { + this.app = app; parse (content); } @@ -232,12 +234,12 @@ public class Skin { } else { String msg = "[HopMacro unhandled: "+handler+"."+name+"]"; reval.res.write (" "+msg+" "); - IServer.getLogger().log (msg); + app.logEvent (msg); } } catch (Exception x) { String msg = "[HopMacro error: "+x+"]"; reval.res.write (" "+msg+" "); - IServer.getLogger().log (msg); + app.logEvent (msg); } } diff --git a/src/helma/framework/core/SkinFile.java b/src/helma/framework/core/SkinFile.java index 2a3f8f8a..7b0b9267 100644 --- a/src/helma/framework/core/SkinFile.java +++ b/src/helma/framework/core/SkinFile.java @@ -49,9 +49,9 @@ public class SkinFile { char c[] = new char[(int) file.length()]; reader.read (c); reader.close(); - skin = new Skin (new String (c)); + skin = new Skin (new String (c), app); } catch (IOException x) { - IServer.getLogger().log ("Error reading Skin "+file+": "+x); + app.logEvent ("Error reading Skin "+file+": "+x); } lastmod = file.lastModified (); diff --git a/src/helma/framework/core/TypeManager.java b/src/helma/framework/core/TypeManager.java index 0735b11b..5d35540f 100644 --- a/src/helma/framework/core/TypeManager.java +++ b/src/helma/framework/core/TypeManager.java @@ -5,8 +5,6 @@ package helma.framework.core; import helma.objectmodel.*; import helma.util.*; -import FESI.Exceptions.*; -import FESI.Data.*; import java.util.*; import java.io.*; @@ -50,6 +48,9 @@ public class TypeManager implements Runnable { if (!f.exists()) f.mkdir (); f = new File (appDir, "global"); + if (!f.exists()) + f.mkdir (); + f = new File (appDir, "hopobject"); if (!f.exists()) f.mkdir (); prototypes = new Hashtable (); @@ -70,7 +71,7 @@ public class TypeManager implements Runnable { Prototype proto = getPrototype (list[i]); if (proto != null) { // check if existing prototype needs update - // IServer.getLogger().log (protoDir.lastModified ()); + // app.logEvent (protoDir.lastModified ()); updatePrototype (list[i], protoDir, proto); } else { // create new prototype @@ -86,7 +87,7 @@ public class TypeManager implements Runnable { } } catch (Exception ignore) { - IServer.getLogger().log (this+": "+ignore); + app.logEvent (this+": "+ignore); } if (rewire) { @@ -94,7 +95,7 @@ public class TypeManager implements Runnable { app.rewireDbMappings (); rewire = false; } - // IServer.getLogger().log (" ...done @ "+ (System.currentTimeMillis () - now)+ "--- "+idleSeconds); + // app.logEvent (" ...done @ "+ (System.currentTimeMillis () - now)+ "--- "+idleSeconds); } @@ -139,7 +140,7 @@ public class TypeManager implements Runnable { long sleeptime = 1500 + Math.min (idleSeconds*30, 3500); typechecker.sleep (sleeptime); } catch (InterruptedException x) { - // IServer.getLogger().log ("Typechecker interrupted"); + // app.logEvent ("Typechecker interrupted"); break; } check (); @@ -148,7 +149,7 @@ public class TypeManager implements Runnable { public void registerPrototype (String name, File dir, Prototype proto) { - // IServer.getLogger().log ("registering prototype "+name); + // app.logEvent ("registering prototype "+name); // show the type checker thread that there has been type activity idleSeconds = 0; @@ -173,7 +174,7 @@ public class TypeManager implements Runnable { Template t = new Template (tmpfile, tmpname, proto); ntemp.put (tmpname, t); } catch (Throwable x) { - IServer.getLogger().log ("Error creating prototype: "+x); + app.logEvent ("Error creating prototype: "+x); } } else if (list[i].endsWith (app.scriptExtension) && tmpfile.length () > 0) { @@ -181,7 +182,7 @@ public class TypeManager implements Runnable { FunctionFile ff = new FunctionFile (tmpfile, tmpname, proto); nfunc.put (tmpname, ff); } catch (Throwable x) { - IServer.getLogger().log ("Error creating prototype: "+x); + app.logEvent ("Error creating prototype: "+x); } } else if (list[i].endsWith (app.actionExtension) && tmpfile.length () > 0) { @@ -189,14 +190,14 @@ public class TypeManager implements Runnable { Action af = new Action (tmpfile, tmpname, proto); nact.put (tmpname, af); } catch (Throwable x) { - IServer.getLogger().log ("Error creating prototype: "+x); + app.logEvent ("Error creating prototype: "+x); } } else if (list[i].endsWith (app.skinExtension)) { try { SkinFile sf = new SkinFile (tmpfile, tmpname, proto); nskins.put (tmpname, sf); } catch (Throwable x) { - IServer.getLogger().log ("Error creating prototype: "+x); + app.logEvent ("Error creating prototype: "+x); } } } @@ -216,7 +217,7 @@ public class TypeManager implements Runnable { public void updatePrototype (String name, File dir, Prototype proto) { - // IServer.getLogger().log ("updating prototype "+name); + // app.logEvent ("updating prototype "+name); String list[] = dir.list(); Hashtable ntemp = new Hashtable (); @@ -243,7 +244,7 @@ public class TypeManager implements Runnable { idleSeconds = 0; } } catch (Throwable x) { - IServer.getLogger().log ("Error updating prototype: "+x); + app.logEvent ("Error updating prototype: "+x); } ntemp.put (tmpname, t); @@ -258,7 +259,7 @@ public class TypeManager implements Runnable { idleSeconds = 0; } } catch (Throwable x) { - IServer.getLogger().log ("Error updating prototype: "+x); + app.logEvent ("Error updating prototype: "+x); } nfunc.put (tmpname, ff); @@ -273,7 +274,7 @@ public class TypeManager implements Runnable { idleSeconds = 0; } } catch (Throwable x) { - IServer.getLogger().log ("Error updating prototype: "+x); + app.logEvent ("Error updating prototype: "+x); } nact.put (tmpname, af); @@ -288,7 +289,7 @@ public class TypeManager implements Runnable { idleSeconds = 0; } } catch (Throwable x) { - IServer.getLogger().log ("Error updating prototype: "+x); + app.logEvent ("Error updating prototype: "+x); } nskins.put (tmpname, sf); @@ -299,7 +300,7 @@ public class TypeManager implements Runnable { rewire = true; } } catch (Exception ignore) { - IServer.getLogger().log ("Error updating db mapping for type "+name+": "+ignore); + app.logEvent ("Error updating db mapping for type "+name+": "+ignore); } } }