Use helma.[appname].sql.log as SQL log file by default,

configurable by sqlLog entry in app.properties.
This commit is contained in:
hns 2005-03-07 15:10:44 +00:00
parent 156ad8f721
commit d66c3965d4

View file

@ -26,6 +26,9 @@ import java.math.BigDecimal;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* The NodeManager is responsible for fetching Nodes from the internal or * The NodeManager is responsible for fetching Nodes from the internal or
* external data sources, caching them in a least-recently-used Hashtable, * external data sources, caching them in a least-recently-used Hashtable,
@ -39,6 +42,7 @@ public final class NodeManager {
protected IDGenerator idgen; protected IDGenerator idgen;
private long idBaseValue = 1L; private long idBaseValue = 1L;
private boolean logSql; private boolean logSql;
private Log sqlLog = null;
protected boolean logReplication; protected boolean logReplication;
private ArrayList listeners = new ArrayList(); private ArrayList listeners = new ArrayList();
@ -2038,7 +2042,13 @@ public final class NodeManager {
private void logSqlStatement(String type, String table, private void logSqlStatement(String type, String table,
long logTimeStart, long logTimeStop, String statement) { long logTimeStart, long logTimeStop, String statement) {
app.logEvent(new StringBuffer().append(type) // init sql-log if necessary
if (sqlLog == null) {
String sqlLogName = app.getProperty("sqlLog", "helma."+app.getName()+".sql");
sqlLog = LogFactory.getLog(sqlLogName);
}
sqlLog.info(new StringBuffer().append(type)
.append(" ") .append(" ")
.append(table) .append(table)
.append(" ") .append(" ")