in src/main/java/org/apache/log4j/receivers/db/DBReceiverJob.java [63:151]
public void execute() {
Connection connection = null;
try {
connection = parentDBReceiver.connectionSource.getConnection();
PreparedStatement statement = connection.prepareStatement(sqlSelect);
statement.setLong(1, lastId);
ResultSet rs = statement.executeQuery();
//rs.beforeFirst();
while (rs.next()) {
Logger logger = null;
long timeStamp = 0L;
String level = null;
String threadName = null;
Object message = null;
String ndc = null;
String className = null;
String methodName = null;
String fileName = null;
String lineNumber = null;
Hashtable properties = new Hashtable();
//event.setSequenceNumber(rs.getLong(1));
timeStamp = rs.getLong(2);
message = rs.getString(3);
logger = Logger.getLogger(rs.getString(4));
level = rs.getString(5);
Level levelImpl = Level.toLevel(level.trim());
ndc = rs.getString(6);
threadName = rs.getString(7);
short mask = rs.getShort(8);
fileName = rs.getString(9);
className = rs.getString(10);
methodName = rs.getString(11);
lineNumber = rs.getString(12).trim();
LocationInfo locationInfo = null;
if (fileName.equals(LocationInfo.NA)) {
locationInfo = LocationInfo.NA_LOCATION_INFO;
} else {
locationInfo = new LocationInfo(fileName, className,
methodName, lineNumber);
}
long id = rs.getLong(13);
//LogLog.info("Received event with id=" + id);
lastId = id;
ThrowableInformation throwableInfo = null;
if ((mask & DBHelper.EXCEPTION_EXISTS) != 0) {
throwableInfo = getException(connection, id);
}
LoggingEvent event = new LoggingEvent(logger.getName(),
logger, timeStamp, levelImpl, message,
threadName,
throwableInfo,
ndc,
locationInfo,
properties);
// Scott asked for this info to be
event.setProperty("log4jid", Long.toString(id));
if ((mask & DBHelper.PROPERTIES_EXIST) != 0) {
getProperties(connection, id, event);
}
if (!parentDBReceiver.isPaused()) {
parentDBReceiver.doPost(event);
}
} // while
statement.close();
statement = null;
} catch (SQLException sqle) {
getLogger().error("Problem receiving events", sqle);
} finally {
closeConnection(connection);
}
}