diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index 8298240d..61162e17 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -105,7 +105,7 @@ public final class Application implements Runnable { ThreadGroup threadgroup; // threadlocal variable for the current RequestEvaluator - ThreadLocal currentEvaluator = new ThreadLocal(); + ThreadLocal currentEvaluator = new ThreadLocal(); // Map of requesttrans -> active requestevaluators Hashtable activeRequests; @@ -1462,7 +1462,7 @@ public final class Application implements Runnable { /** * get the app's event log. */ - Log getEventLog() { + public Log getEventLog() { if (eventLog == null) { eventLog = getLogger(eventLogName); // set log level for event log in case it is a helma.util.Logger @@ -1479,7 +1479,7 @@ public final class Application implements Runnable { /** * get the app's access log. */ - Log getAccessLog() { + public Log getAccessLog() { if (accessLog == null) { accessLog = getLogger(accessLogName); } diff --git a/src/helma/framework/core/RequestEvaluator.java b/src/helma/framework/core/RequestEvaluator.java index 6bc2c27e..58a79eea 100644 --- a/src/helma/framework/core/RequestEvaluator.java +++ b/src/helma/framework/core/RequestEvaluator.java @@ -25,6 +25,7 @@ import java.util.*; import org.apache.xmlrpc.XmlRpcRequestProcessor; import org.apache.xmlrpc.XmlRpcServerRequest; +import org.apache.commons.logging.Log; /** * This class does the work for incoming requests. It holds a transactor thread @@ -160,7 +161,10 @@ public final class RequestEvaluator implements Runnable { RequestPath requestPath = new RequestPath(app); String txname = req.getMethod().toLowerCase() + ":" + req.getPath(); - app.logEvent(txname + " starting"); + Log eventLog = app.getEventLog(); + if (eventLog.isDebugEnabled()) { + eventLog.debug(txname + " starting"); + } int tries = 0; boolean done = false; @@ -207,7 +211,7 @@ public final class RequestEvaluator implements Runnable { // Update transaction name in case we're processing an error if (error != null) { - txname = txname + ":error"; + txname = "error:" + txname; } // begin transaction @@ -486,7 +490,7 @@ public final class RequestEvaluator implements Runnable { return; } abortTransaction(); - app.logError(txname + ": " + error, x); + app.logError(txname + " " + error, x); // If the transactor thread has been killed by the invoker thread we don't have to // bother for the error message, just quit. @@ -522,7 +526,7 @@ public final class RequestEvaluator implements Runnable { return; } abortTransaction(); - app.logError(txname + ": " + error, x); + app.logError(txname + " " + error, x); // If the transactor thread has been killed by the invoker thread we don't have to // bother for the error message, just quit. @@ -606,9 +610,7 @@ public final class RequestEvaluator implements Runnable { done = false; error = x; - Transactor tx = Transactor.getInstance(); - txname = tx == null ? "no-txn" : tx.getTransactionName(); - app.logError(txname + ": " + error, x); + app.logError(txname + " " + error, x); if (req.isXmlRpc()) { // if it's an XML-RPC exception immediately generate error response diff --git a/src/helma/objectmodel/db/Transactor.java b/src/helma/objectmodel/db/Transactor.java index b57265f9..f333d6a1 100644 --- a/src/helma/objectmodel/db/Transactor.java +++ b/src/helma/objectmodel/db/Transactor.java @@ -24,6 +24,8 @@ import java.sql.Statement; import java.sql.SQLException; import java.util.*; +import org.apache.commons.logging.Log; + /** * A subclass of thread that keeps track of changed nodes and triggers * changes in the database when a transaction is commited. @@ -326,6 +328,7 @@ public class Transactor { // the set to collect DbMappings to be marked as changed HashSet dirtyDbMappings = new HashSet(); + Log eventLog = nmgr.app.getEventLog(); for (int i = 0; i < dirty.length; i++) { Node node = (Node) dirty[i]; @@ -346,8 +349,10 @@ public class Transactor { } inserted++; - nmgr.app.logEvent("inserted: Node " + node.getPrototype() + "/" + - node.getID()); + if (eventLog.isDebugEnabled()) { + eventLog.debug("inserted node: " + node.getPrototype() + "/" + + node.getID()); + } } else if (nstate == Node.MODIFIED) { // only mark DbMapping as dirty if updateNode returns true if (nmgr.updateNode(nmgr.db, txn, node)) { @@ -363,8 +368,10 @@ public class Transactor { } updated++; - nmgr.app.logEvent("updated: Node " + node.getPrototype() + "/" + - node.getID()); + if (eventLog.isDebugEnabled()) { + eventLog.debug("updated node: " + node.getPrototype() + "/" + + node.getID()); + } } else if (nstate == Node.DELETED) { nmgr.deleteNode(nmgr.db, txn, node); dirtyDbMappings.add(node.getDbMapping()); @@ -377,6 +384,10 @@ public class Transactor { } deleted++; + if (eventLog.isDebugEnabled()) { + eventLog.debug("removed node: " + node.getPrototype() + "/" + + node.getID()); + } } node.clearWriteLock();