migrate from JUL to SLF4j

This commit is contained in:
Richard Vowles committed 2013-04-11 21:53:25 +12:00
1 parent 4ce891eb43
commit 0a951165e5
108 files changed
+688 -631

No files matched your search

@@ -2,8 +2,6 @@ package com.avaje.ebeaninternal.server.loadcontext;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.avaje.ebean.bean.BeanLoader;
import com.avaje.ebean.bean.EntityBean;
@@ -17,6 +15,8 @@ import com.avaje.ebeaninternal.api.SpiQuery;
import com.avaje.ebeaninternal.server.core.OrmQueryRequest;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.avaje.ebeaninternal.server.querydefn.OrmQueryProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Default implementation of LoadBeanContext.
@@ -24,7 +24,7 @@ import com.avaje.ebeaninternal.server.querydefn.OrmQueryProperties;
*/
public class DLoadBeanContext implements LoadBeanContext, BeanLoader {
private static final Logger logger = Logger.getLogger(DLoadBeanContext.class.getName());
private static final Logger logger = LoggerFactory.getLogger(DLoadBeanContext.class);
protected final DLoadContext parent;
@@ -129,8 +129,8 @@ public class DLoadBeanContext implements LoadBeanContext, BeanLoader {
}
// we loaded the bean from cache
weakList.removeEntry(position);
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "Loading path:" + fullPath + " - bean loaded from L2 cache, position[" + position + "]");
if (logger.isTraceEnabled()) {
logger.trace("Loading path:" + fullPath + " - bean loaded from L2 cache, position[" + position + "]");
}
return true;
}
@@ -160,7 +160,7 @@ public class DLoadBeanContext implements LoadBeanContext, BeanLoader {
try {
batch = weakList.getLoadBatch(position, batchSize);
} catch (IllegalStateException e) {
logger.log(Level.SEVERE, "type["+desc.getFullName()+"] fullPath[" + fullPath + "] batchSize["+batchSize+"]", e);
logger.error("type[" + desc.getFullName() + "] fullPath[" + fullPath + "] batchSize[" + batchSize + "]", e);
}
if (hitCache && batchSize > 1) {
@@ -169,14 +169,14 @@ public class DLoadBeanContext implements LoadBeanContext, BeanLoader {
batch = loadBeanCheckBatch(batch);
}
if (logger.isLoggable(Level.FINER)) {
if (logger.isTraceEnabled()) {
for (int i = 0; i < batch.size(); i++) {
EntityBeanIntercept entityBeanIntercept = batch.get(i);
EntityBean owner = entityBeanIntercept.getOwner();
Object id = desc.getId(owner);
logger.finer("LoadBean type["+owner.getClass().getName()+"] fullPath["+fullPath+"] id["+id+"] batchIndex["+i+"] beanLoaderIndex["+entityBeanIntercept.getBeanLoaderIndex()+"]");
logger.trace("LoadBean type["+owner.getClass().getName()+"] fullPath["+fullPath+"] id["+id+"] batchIndex["+i+"] beanLoaderIndex["+entityBeanIntercept.getBeanLoaderIndex()+"]");
}
}
@@ -204,8 +204,8 @@ public class DLoadBeanContext implements LoadBeanContext, BeanLoader {
actualLoadBatch.add(batchToCheck.get(i));
} else {
loadedFromCache++;
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "Loading path:" + fullPath + " - bean loaded from L2 cache(batch)");
if (logger.isTraceEnabled()) {
logger.trace( "Loading path:" + fullPath + " - bean loaded from L2 cache(batch)");
}
}
}
@@ -231,16 +231,16 @@ public class DLoadBeanContext implements LoadBeanContext, BeanLoader {
List<EntityBeanIntercept> batch = weakList.getNextBatch(requestedBatchSize);
if (batch.size() == 0) {
// there are no beans to load
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "Loading path:" + fullPath + " - no more beans to load");
if (logger.isTraceEnabled()) {
logger.trace("Loading path:" + fullPath + " - no more beans to load");
}
return;
}
boolean loadCache = false;
LoadBeanRequest req = new LoadBeanRequest(this, batch, parentRequest.getTransaction(), requestedBatchSize, false, null, loadCache);
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "Loading path:" + fullPath + " - secondary query batch load [" + batch.size() + "] beans");
if (logger.isTraceEnabled()) {
logger.trace("Loading path:" + fullPath + " - secondary query batch load [" + batch.size() + "] beans");
}
parent.getEbeanServer().loadBean(req);
@@ -1,13 +1,14 @@
package com.avaje.ebeaninternal.server.loadcontext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DLoadHardList<T> implements DLoadList<T> {
private static final Logger logger = Logger.getLogger(DLoadHardList.class.getName());
private static final Logger logger = LoggerFactory.getLogger(DLoadHardList.class);
protected final ArrayList<T> list = new ArrayList<T>();
@@ -29,7 +30,7 @@ public class DLoadHardList<T> implements DLoadList<T> {
synchronized (this) {
T object = list.get(position);
if (object == null) {
logger.log(Level.WARNING, "removeEntry found no Object for position[" + position + "]");
logger.warn("removeEntry found no Object for position[" + position + "]");
} else {
// just set the entry to null
list.set(position, null);
@@ -1,14 +1,15 @@
package com.avaje.ebeaninternal.server.loadcontext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DLoadWeakList<T> implements DLoadList<T> {
private static final Logger logger = Logger.getLogger(DLoadWeakList.class.getName());
private static final Logger logger = LoggerFactory.getLogger(DLoadWeakList.class);
protected final ArrayList<WeakReference<T>> list = new ArrayList<WeakReference<T>>();
@@ -30,13 +31,13 @@ public class DLoadWeakList<T> implements DLoadList<T> {
synchronized (this) {
WeakReference<T> wref = list.get(position);
if (wref == null) {
logger.log(Level.WARNING, "removeEntry found no WeakReference for position[" + position + "]");
logger.warn("removeEntry found no WeakReference for position[" + position + "]");
} else {
// just set the entry to null
list.set(position, null);
T object = wref.get();
if (object == null) {
logger.log(Level.WARNING, "removeEntry found no Object held by WeakReference for position[" + position + "]");
logger.warn("removeEntry found no Object held by WeakReference for position[" + position + "]");
}
}
if (position == removedFromTop) {
@@ -98,7 +99,7 @@ public class DLoadWeakList<T> implements DLoadList<T> {
if (wref != null) {
T object = wref.get();
if (object == null) {
logger.log(Level.WARNING, "Bean is null from weak reference");
logger.warn("Bean is null from weak reference");
} else {
found = true;
batch.add(object);