Use new logging shim.

This commit is contained in:
Michael Bayne
2008-05-27 18:40:39 +00:00
parent c16003177d
commit 33e159047d
5 changed files with 16 additions and 18 deletions
@@ -35,7 +35,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import com.samskivert.io.PersistenceException; import com.samskivert.io.PersistenceException;
import com.samskivert.jdbc.depot.annotation.Computed; import com.samskivert.jdbc.depot.annotation.Computed;
@@ -109,7 +108,7 @@ public class DepotMarshaller<T extends PersistentRecord>
try { try {
_schemaVersion = (Integer)field.get(null); _schemaVersion = (Integer)field.get(null);
} catch (Exception e) { } catch (Exception e) {
log.log(Level.WARNING, "Failed to read schema version " + log.warning("Failed to read schema version " +
"[class=" + _pClass + "].", e); "[class=" + _pClass + "].", e);
} }
} }
+1 -2
View File
@@ -20,8 +20,7 @@
package com.samskivert.jdbc.depot; package com.samskivert.jdbc.depot;
import java.util.logging.Level; import com.samskivert.util.Logger;
import java.util.logging.Logger;
/** /**
* Contains a reference to the log object used by this package. * Contains a reference to the log object used by this package.
@@ -31,7 +31,6 @@ import java.sql.Time;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Set; import java.util.Set;
import com.samskivert.Log;
import com.samskivert.jdbc.JDBCUtil; import com.samskivert.jdbc.JDBCUtil;
import com.samskivert.jdbc.depot.FieldMarshaller.BooleanMarshaller; import com.samskivert.jdbc.depot.FieldMarshaller.BooleanMarshaller;
import com.samskivert.jdbc.depot.FieldMarshaller.ByteArrayMarshaller; import com.samskivert.jdbc.depot.FieldMarshaller.ByteArrayMarshaller;
@@ -50,6 +49,8 @@ import com.samskivert.jdbc.depot.expression.ColumnExp;
import com.samskivert.jdbc.depot.expression.EpochSeconds; import com.samskivert.jdbc.depot.expression.EpochSeconds;
import com.samskivert.jdbc.depot.operator.Conditionals.FullTextMatch; import com.samskivert.jdbc.depot.operator.Conditionals.FullTextMatch;
import static com.samskivert.Log.log;
public class MySQLBuilder public class MySQLBuilder
extends SQLBuilder extends SQLBuilder
{ {
@@ -170,7 +171,7 @@ public class MySQLBuilder
Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
try { try {
Log.info("Adding full-text search index: ftsIx_" + fts.name()); log.info("Adding full-text search index: ftsIx_" + fts.name());
stmt.executeUpdate(update.toString()); stmt.executeUpdate(update.toString());
} finally { } finally {
JDBCUtil.close(stmt); JDBCUtil.close(stmt);
@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Connection; import java.sql.Connection;
@@ -162,7 +161,7 @@ public class PersistenceContext
_cache.shutdown(); _cache.shutdown();
} }
} catch (Throwable t) { } catch (Throwable t) {
log.log(Level.WARNING, "Failure shutting down Depot cache.", t); log.warning("Failure shutting down Depot cache.", t);
} }
_conprov.shutdown(); _conprov.shutdown();
} }
@@ -250,15 +249,15 @@ public class PersistenceContext
if (key != null && _cache != null) { if (key != null && _cache != null) {
CacheAdapter.CachedValue<T> cacheHit = cacheLookup(key); CacheAdapter.CachedValue<T> cacheHit = cacheLookup(key);
if (cacheHit != null) { if (cacheHit != null) {
log.fine("cache hit [key=" + key + ", hit=" + cacheHit + "]"); log.debug("cache hit [key=" + key + ", hit=" + cacheHit + "]");
T value = cacheHit.getValue(); T value = cacheHit.getValue();
value = query.transformCacheHit(key, value); value = query.transformCacheHit(key, value);
if (value != null) { if (value != null) {
return value; return value;
} }
log.fine("transformCacheHit returned null; rejecting cached value."); log.debug("transformCacheHit returned null; rejecting cached value.");
} }
log.fine("cache miss [key=" + key + "]"); log.debug("cache miss [key=" + key + "]");
} }
// otherwise, perform the query // otherwise, perform the query
@SuppressWarnings("unchecked") T result = (T) invoke(query, null, true); @SuppressWarnings("unchecked") T result = (T) invoke(query, null, true);
@@ -314,7 +313,7 @@ public class PersistenceContext
Thread.dumpStack(); Thread.dumpStack();
return; return;
} }
log.fine("storing [key=" + key + ", value=" + entry + "]"); log.debug("storing [key=" + key + ", value=" + entry + "]");
CacheAdapter.CacheBin<T> bin = _cache.getCache(key.getCacheId()); CacheAdapter.CacheBin<T> bin = _cache.getCache(key.getCacheId());
CacheAdapter.CachedValue element = bin.lookup(key.getCacheKey()); CacheAdapter.CachedValue element = bin.lookup(key.getCacheKey());
@@ -328,7 +327,7 @@ public class PersistenceContext
Set<CacheListener<?>> listeners = _listenerSets.get(key.getCacheId()); Set<CacheListener<?>> listeners = _listenerSets.get(key.getCacheId());
if (listeners != null && listeners.size() > 0) { if (listeners != null && listeners.size() > 0) {
for (CacheListener<?> listener : listeners) { for (CacheListener<?> listener : listeners) {
log.fine("cascading [listener=" + listener + "]"); log.debug("cascading [listener=" + listener + "]");
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
CacheListener<T> casted = (CacheListener<T>)listener; CacheListener<T> casted = (CacheListener<T>)listener;
casted.entryCached(key, entry, oldEntry); casted.entryCached(key, entry, oldEntry);
@@ -368,7 +367,7 @@ public class PersistenceContext
if (_cache == null) { if (_cache == null) {
return; return;
} }
log.fine("invalidating [cacheId=" + cacheId + ", cacheKey=" + cacheKey + "]"); log.debug("invalidating [cacheId=" + cacheId + ", cacheKey=" + cacheKey + "]");
CacheAdapter.CacheBin<T> bin = _cache.getCache(cacheId); CacheAdapter.CacheBin<T> bin = _cache.getCache(cacheId);
CacheAdapter.CachedValue<T> element = bin.lookup(cacheKey); CacheAdapter.CachedValue<T> element = bin.lookup(cacheKey);
@@ -384,7 +383,7 @@ public class PersistenceContext
if (listeners != null && listeners.size() > 0) { if (listeners != null && listeners.size() > 0) {
CacheKey key = new SimpleCacheKey(cacheId, cacheKey); CacheKey key = new SimpleCacheKey(cacheId, cacheKey);
for (CacheListener<?> listener : listeners) { for (CacheListener<?> listener : listeners) {
log.fine("cascading [listener=" + listener + "]"); log.debug("cascading [listener=" + listener + "]");
@SuppressWarnings("unchecked") CacheListener<T> casted = @SuppressWarnings("unchecked") CacheListener<T> casted =
(CacheListener<T>)listener; (CacheListener<T>)listener;
casted.entryInvalidated(key, oldEntry); casted.entryInvalidated(key, oldEntry);
@@ -393,7 +392,7 @@ public class PersistenceContext
} }
// then evict the keyed entry, if needed // then evict the keyed entry, if needed
log.fine("evicting [cacheKey=" + cacheKey + "]"); log.debug("evicting [cacheKey=" + cacheKey + "]");
bin.remove(cacheKey); bin.remove(cacheKey);
} }
@@ -51,7 +51,7 @@ import com.samskivert.jdbc.depot.operator.Conditionals.FullTextMatch;
import com.samskivert.util.ArrayUtil; import com.samskivert.util.ArrayUtil;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.samskivert.Log; import static com.samskivert.Log.log;
public class PostgreSQLBuilder public class PostgreSQLBuilder
extends SQLBuilder extends SQLBuilder
@@ -178,7 +178,7 @@ public class PostgreSQLBuilder
Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
try { try {
Log.info( log.info(
"Adding full-text search column, index and trigger: " + column + ", " + "Adding full-text search column, index and trigger: " + column + ", " +
index + ", " + trigger); index + ", " + trigger);
liaison.addColumn(conn, table, column, "TSVECTOR", true); liaison.addColumn(conn, table, column, "TSVECTOR", true);