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

@@ -3,8 +3,6 @@ package com.avaje.ebeaninternal.server.autofetch;
import java.io.File;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.PersistenceException;
@@ -12,12 +10,13 @@ import com.avaje.ebean.config.GlobalProperties;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.server.resource.ResourceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AutoFetchManagerFactory {
private static final Logger logger = Logger.getLogger(AutoFetchManagerFactory.class.getName());
private static final Logger logger = LoggerFactory.getLogger(AutoFetchManagerFactory.class);
public static AutoFetchManager create(SpiEbeanServer server, ServerConfig serverConfig, ResourceManager resourceManager) {
AutoFetchManagerFactory me = new AutoFetchManagerFactory();
@@ -68,7 +67,7 @@ public class AutoFetchManagerFactory {
return profListener;
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error loading autofetch file "+autoFetchFile.getAbsolutePath(), ex);
logger.error("Error loading autofetch file "+autoFetchFile.getAbsolutePath(), ex);
return null;
}
}
@@ -7,7 +7,6 @@ import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import javax.persistence.PersistenceException;
@@ -180,7 +179,7 @@ public class DefaultAutoFetchManager implements AutoFetchManager, Serializable {
} catch (Exception e) {
String msg = "Error serializing autofetch file";
logging.logError(Level.SEVERE, msg, e);
logging.logError(msg, e);
}
}
@@ -304,7 +303,7 @@ public class DefaultAutoFetchManager implements AutoFetchManager, Serializable {
Thread.sleep(waitMillis);
} catch (InterruptedException e) {
String msg = "Error while sleeping after System.gc() request.";
logging.logError(Level.SEVERE, msg, e);
logging.logError(msg, e);
return msg;
}
return updateTunedQueryInfo();
@@ -420,7 +419,7 @@ public class DefaultAutoFetchManager implements AutoFetchManager, Serializable {
// expected after renaming/moving an entity bean
String msg = e.toString()+" updating autoFetch tuned query for " + beanType
+". It isLikely this bean has been renamed or moved";
logging.logError(Level.INFO, msg, null);
logging.logInfo(msg, null);
statisticsMap.remove(statistics.getOrigin().getKey());
}
}
@@ -1,14 +1,15 @@
package com.avaje.ebeaninternal.server.autofetch;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.avaje.ebean.config.AutofetchConfig;
import com.avaje.ebean.config.GlobalProperties;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebeaninternal.server.lib.BackgroundThread;
import com.avaje.ebeaninternal.server.querydefn.OrmQueryDetail;
import com.avaje.ebeaninternal.server.transaction.log.SimpleLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.logging.Level;
/**
* Handles the logging aspects for the DefaultAutoFetchListener.
@@ -19,7 +20,7 @@ import com.avaje.ebeaninternal.server.transaction.log.SimpleLogger;
*/
public class DefaultAutoFetchManagerLogging {
private static final Logger logger = Logger.getLogger(DefaultAutoFetchManagerLogging.class.getName());
private static final Logger logger = LoggerFactory.getLogger(DefaultAutoFetchManagerLogging.class);
private final SimpleLogger fileLogger;
@@ -60,12 +61,27 @@ public class DefaultAutoFetchManagerLogging {
}
}
private void logFile(String msg, Throwable e) {
if (useFileLogger) {
String errMsg = e == null ? "" : e.getMessage();
fileLogger.log("\"Error\",\"" + msg+" "+errMsg+"\",,,,");
}
}
public void logInfo(String msg, Throwable e) {
logFile(msg, e);
logger.info(msg, e);
}
public void logError(String msg, Throwable e) {
logFile(msg, e);
logger.error(msg, e);
}
@Deprecated
public void logError(Level level, String msg, Throwable e) {
if (useFileLogger) {
String errMsg = e == null ? "" : e.getMessage();
fileLogger.log("\"Error\",\"" + msg+" "+errMsg+"\",,,,");
}
logger.log(level, msg, e);
logError(msg, e);
}
public void logToJavaLogger(String msg) {
@@ -79,7 +95,7 @@ public class DefaultAutoFetchManagerLogging {
if (useFileLogger) {
fileLogger.log(msg);
}
logger.fine(msg);
logger.debug(msg);
}
public void logChanged(TunedQueryInfo tunedFetch, OrmQueryDetail newQueryDetail) {
@@ -89,7 +105,7 @@ public class DefaultAutoFetchManagerLogging {
if (useFileLogger) {
fileLogger.log(msg);
} else {
logger.fine(msg);
logger.debug(msg);
}
}
@@ -100,7 +116,7 @@ public class DefaultAutoFetchManagerLogging {
if (useFileLogger) {
fileLogger.log(msg);
} else {
logger.fine(msg);
logger.debug(msg);
}
}
@@ -4,7 +4,6 @@ import java.io.Serializable;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.logging.Logger;
import com.avaje.ebean.bean.NodeUsageCollector;
import com.avaje.ebean.meta.MetaAutoFetchStatistic.NodeUsageStats;
@@ -14,6 +13,8 @@ import com.avaje.ebeaninternal.server.deploy.BeanProperty;
import com.avaje.ebeaninternal.server.deploy.BeanPropertyAssoc;
import com.avaje.ebeaninternal.server.el.ElPropertyValue;
import com.avaje.ebeaninternal.server.query.SplitName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Collects usages statistics for a given node in the object graph.
@@ -22,7 +23,7 @@ public class StatisticsNodeUsage implements Serializable {
private static final long serialVersionUID = -1663951463963779547L;
private static final Logger logger = Logger.getLogger(StatisticsNodeUsage.class.getName());
private static final Logger logger = LoggerFactory.getLogger(StatisticsNodeUsage.class);
private final String monitor = new String();
@@ -59,7 +60,7 @@ public class StatisticsNodeUsage implements Serializable {
ElPropertyValue elGetValue = rootDesc.getElGetValue(path);
if (elGetValue == null){
desc = null;
logger.warning("Autofetch: Can't find join for path["+path+"] for "+rootDesc.getName());
logger.warn("Autofetch: Can't find join for path["+path+"] for "+rootDesc.getName());
} else {
BeanProperty beanProperty = elGetValue.getBeanProperty();
@@ -72,7 +73,7 @@ public class StatisticsNodeUsage implements Serializable {
for (String propName : aggregateUsed) {
BeanProperty beanProp = desc.getBeanPropertyFromPath(propName);
if (beanProp == null){
logger.warning("Autofetch: Can't find property["+propName+"] for "+desc.getName());
logger.warn("Autofetch: Can't find property["+propName+"] for "+desc.getName());
} else {
if (beanProp instanceof BeanPropertyAssoc<?>){