Set log level to "starting" message to DEBUG. Set log level for "inserted node" message and consorts to DEBUG. Fix and improve error log messages. Make Log accessors in Application public.
This commit is contained in:
parent
f1dd9c6f37
commit
2c2f95253f
3 changed files with 27 additions and 14 deletions
|
@ -105,7 +105,7 @@ public final class Application implements Runnable {
|
|||
ThreadGroup threadgroup;
|
||||
|
||||
// threadlocal variable for the current RequestEvaluator
|
||||
ThreadLocal currentEvaluator = new ThreadLocal();
|
||||
ThreadLocal<RequestEvaluator> currentEvaluator = new ThreadLocal<RequestEvaluator>();
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() + "/" +
|
||||
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() + "/" +
|
||||
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();
|
||||
|
|
Loading…
Add table
Reference in a new issue