mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
Use AppLog and System.Logger for logging rather than slf4j-api
The avaje-applog-slf4j dependency means this is still using slf4j-api for implementation. Remove that dependency and service load the desired implementation.
This commit is contained in:
1 parent
d145e6494d
commit
a23f241fff
108 files changed
+668
-758
No files matched your search
@@ -1,13 +1,12 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.avaje.applog.AppLog;
|
||||
|
||||
/**
|
||||
* Common loggers used in ebean-core.
|
||||
*/
|
||||
public final class CoreLog {
|
||||
|
||||
public static final Logger log = LoggerFactory.getLogger("io.ebean.core");
|
||||
public static final Logger internal = LoggerFactory.getLogger("io.ebean.internal");
|
||||
public static final System.Logger log = AppLog.getLogger("io.ebean.core");
|
||||
public static final System.Logger internal = AppLog.getLogger("io.ebean.internal");
|
||||
}
|
||||
@@ -7,17 +7,18 @@ import io.ebeaninternal.server.core.BindPadding;
|
||||
import io.ebeaninternal.server.core.OrmQueryRequest;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Request for loading Associated Many Beans.
|
||||
*/
|
||||
public final class LoadManyRequest extends LoadRequest {
|
||||
|
||||
private static final Logger log = CoreLog.log;
|
||||
private static final System.Logger log = CoreLog.log;
|
||||
|
||||
private final List<BeanCollection<?>> batch;
|
||||
private final LoadManyBuffer loadContext;
|
||||
@@ -113,10 +114,10 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
// in the +query or +lazy load due to no rows (predicates)
|
||||
for (BeanCollection<?> bc : batch) {
|
||||
if (bc.checkEmptyLazyLoad()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
Object parentId = desc.getId(ownerBean);
|
||||
log.debug("BeanCollection after lazy load was empty. type:" + ownerBean.getClass().getName() + " id:" + parentId + " owner:" + ownerBean);
|
||||
log.log(DEBUG, "BeanCollection after lazy load was empty. type:" + ownerBean.getClass().getName() + " id:" + parentId + " owner:" + ownerBean);
|
||||
}
|
||||
} else if (loadCache && many.isUseCache()) {
|
||||
desc.cacheManyPropPut(many, bc, desc.getId(bc.getOwnerBean()));
|
||||
|
||||
+6
-6
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.annotation.Cache;
|
||||
import io.ebean.annotation.CacheBeanTuning;
|
||||
import io.ebean.annotation.CacheQueryTuning;
|
||||
@@ -7,9 +8,8 @@ import io.ebean.cache.*;
|
||||
import io.ebean.config.CurrentTenantProvider;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebean.util.AnnotationUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
@@ -20,7 +20,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
final class DefaultCacheHolder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.cache.ALL");
|
||||
private static final System.Logger log = AppLog.getLogger("io.ebean.cache.ALL");
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final ConcurrentHashMap<String, ServerCache> allCaches = new ConcurrentHashMap<>();
|
||||
@@ -89,7 +89,7 @@ final class DefaultCacheHolder {
|
||||
}
|
||||
|
||||
void clearAll() {
|
||||
log.debug("clearAll");
|
||||
log.log(Level.DEBUG, "clearAll");
|
||||
for (ServerCache serverCache : allCaches.values()) {
|
||||
serverCache.clear();
|
||||
}
|
||||
@@ -97,7 +97,7 @@ final class DefaultCacheHolder {
|
||||
|
||||
|
||||
public void clear(String name) {
|
||||
log.debug("clear {}", name);
|
||||
log.log(Level.DEBUG, "clear {0}", name);
|
||||
clearIfExists(key(name, ServerCacheType.QUERY));
|
||||
clearIfExists(key(name, ServerCacheType.BEAN));
|
||||
clearIfExists(key(name, ServerCacheType.NATURAL_KEY));
|
||||
@@ -112,7 +112,7 @@ final class DefaultCacheHolder {
|
||||
private void clearIfExists(String fullKey) {
|
||||
ServerCache cache = allCaches.get(fullKey);
|
||||
if (cache != null) {
|
||||
log.trace("clear cache {}", fullKey);
|
||||
log.log(Level.TRACE, "clear cache {0}", fullKey);
|
||||
cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,15 +1,15 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.cache.ServerCache;
|
||||
import io.ebean.cache.ServerCacheStatistics;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebean.metric.CountMetric;
|
||||
import io.ebean.metric.MetricFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -25,7 +25,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public class DefaultServerCache implements ServerCache {
|
||||
|
||||
protected static final Logger logger = LoggerFactory.getLogger(DefaultServerCache.class);
|
||||
protected static final System.Logger logger = AppLog.getLogger(DefaultServerCache.class);
|
||||
|
||||
/**
|
||||
* Compare by last access time (for LRU eviction).
|
||||
@@ -287,13 +287,13 @@ public class DefaultServerCache implements ServerCache {
|
||||
evictCount.add(trimmedByGC);
|
||||
evictCount.add(trimmedByTTL);
|
||||
evictCount.add(trimmedByLRU);
|
||||
if (logger.isTraceEnabled()) {
|
||||
if (logger.isLoggable(Level.TRACE)) {
|
||||
long exeMicros = TimeUnit.MICROSECONDS.convert(System.nanoTime() - startNanos, TimeUnit.NANOSECONDS);
|
||||
logger.trace("Executed trim of cache {} in [{}]millis idle[{}] timeToLive[{}] accessTime[{}] gc[{}]",
|
||||
logger.log(Level.TRACE, "Executed trim of cache {0} in [{1}]millis idle[{2}] timeToLive[{3}] accessTime[{4}] gc[{5}]",
|
||||
name, exeMicros, trimmedByIdle, trimmedByTTL, trimmedByLRU, trimmedByGC);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.warn("Error during trim of DefaultServerCache [" + name + "]. Cache might be bigger than desired.", e);
|
||||
logger.log(Level.WARNING, "Error during trim of DefaultServerCache [" + name + "]. Cache might be bigger than desired.", e);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
|
||||
+7
-7
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.cache.ServerCache;
|
||||
import io.ebean.cache.ServerCacheRegion;
|
||||
import io.ebean.cache.ServerCacheType;
|
||||
@@ -7,9 +8,8 @@ import io.ebean.meta.MetricVisitor;
|
||||
import io.ebeaninternal.api.SpiCacheRegion;
|
||||
import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import io.ebeaninternal.server.deploy.DCacheRegion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ import java.util.*;
|
||||
*/
|
||||
public final class DefaultServerCacheManager implements SpiCacheManager {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.cache.REGION");
|
||||
private static final System.Logger log = AppLog.getLogger("io.ebean.cache.REGION");
|
||||
|
||||
private final Map<String, SpiCacheRegion> regionMap = new HashMap<>();
|
||||
private final ClusterManager clusterManager;
|
||||
@@ -65,23 +65,23 @@ public final class DefaultServerCacheManager implements SpiCacheManager {
|
||||
enabled.add(region.name());
|
||||
if (!region.isEnabled()) {
|
||||
region.setEnabled(true);
|
||||
log.debug("Cache region[{}] enabled", region.name());
|
||||
log.log(Level.DEBUG, "Cache region[{0}] enabled", region.name());
|
||||
}
|
||||
} else {
|
||||
disabled.add(region.name());
|
||||
if (region.isEnabled()) {
|
||||
region.setEnabled(false);
|
||||
log.debug("Cache region[{}] disabled", region.name());
|
||||
log.log(Level.DEBUG, "Cache region[{0}] disabled", region.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("Cache regions enabled:{} disabled:{}", enabled, disabled);
|
||||
log.log(Level.INFO, "Cache regions enabled:{0} disabled:{1}", enabled, disabled);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllRegionsEnabled(boolean enabled) {
|
||||
log.debug("All cache regions enabled[{}]", enabled);
|
||||
log.log(Level.DEBUG, "All cache regions enabled[{0}]", enabled);
|
||||
for (SpiCacheRegion region : regionMap.values()) {
|
||||
region.setEnabled(enabled);
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.changelog;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.event.changelog.BeanChange;
|
||||
import io.ebean.event.changelog.ChangeLogListener;
|
||||
import io.ebean.event.changelog.ChangeSet;
|
||||
@@ -7,10 +8,9 @@ import io.ebean.event.changelog.ChangeType;
|
||||
import io.ebean.plugin.Plugin;
|
||||
import io.ebean.plugin.SpiServer;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
|
||||
/**
|
||||
* The named logger we send the change set payload to. Can be externally configured as desired.
|
||||
*/
|
||||
private static final Logger changeLog = LoggerFactory.getLogger("io.ebean.ChangeLog");
|
||||
private static final System.Logger changeLog = AppLog.getLogger("io.ebean.ChangeLog");
|
||||
|
||||
/**
|
||||
* Used to build the JSON.
|
||||
@@ -65,9 +65,9 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
|
||||
try {
|
||||
StringWriter writer = new StringWriter(getBufferSize(beanChange));
|
||||
jsonBuilder.writeBeanJson(writer, beanChange, changeSet);
|
||||
changeLog.info(writer.toString());
|
||||
changeLog.log(Level.INFO, writer.toString());
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.error("Exception logging beanChange " + beanChange, e);
|
||||
CoreLog.log.log(Level.ERROR, "Exception logging beanChange " + beanChange, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.ebeaninternal.server.cluster;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.config.ContainerConfig;
|
||||
import io.ebeaninternal.server.transaction.RemoteTransactionEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public class ClusterManager implements ServerLookup {
|
||||
|
||||
private static final Logger clusterLogger = LoggerFactory.getLogger("io.ebean.Cluster");
|
||||
private static final System.Logger clusterLogger = AppLog.getLogger("io.ebean.Cluster");
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
@@ -112,8 +112,8 @@ public class ClusterManager implements ServerLookup {
|
||||
*/
|
||||
public void broadcast(RemoteTransactionEvent event) {
|
||||
if (broadcast != null) {
|
||||
if (clusterLogger.isDebugEnabled()) {
|
||||
clusterLogger.debug("sending: {}", event);
|
||||
if (clusterLogger.isLoggable(Level.DEBUG)) {
|
||||
clusterLogger.log(Level.DEBUG, "sending: {0}", event);
|
||||
}
|
||||
broadcast.broadcast(event);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
/**
|
||||
* Base class for find and persist requests.
|
||||
*/
|
||||
@@ -61,7 +63,7 @@ public abstract class BeanRequest {
|
||||
// Just log this and carry on. A previous exception has been
|
||||
// thrown and if this rollback throws exception it likely means
|
||||
// that the connection is broken (and the dataSource and db will cleanup)
|
||||
CoreLog.log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.ebeaninternal.api.DbOffline;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
@@ -38,7 +39,7 @@ public class DatabasePlatformFactory {
|
||||
try {
|
||||
String offlinePlatform = DbOffline.getPlatform();
|
||||
if (offlinePlatform != null) {
|
||||
CoreLog.log.info("offline platform [{}]", offlinePlatform);
|
||||
CoreLog.log.log(Level.INFO, "offline platform [{0}]", offlinePlatform);
|
||||
return byDatabaseName(offlinePlatform);
|
||||
}
|
||||
if (config.getDatabasePlatformName() != null) {
|
||||
@@ -87,7 +88,7 @@ public class DatabasePlatformFactory {
|
||||
String dbProductName = metaData.getDatabaseProductName().toLowerCase();
|
||||
final int majorVersion = metaData.getDatabaseMajorVersion();
|
||||
final int minorVersion = metaData.getDatabaseMinorVersion();
|
||||
CoreLog.log.debug("platform for productName[{}] version[{}.{}]", dbProductName, majorVersion, minorVersion);
|
||||
CoreLog.log.log(Level.DEBUG, "platform for productName[{0}] version[{1}.{2}]", dbProductName, majorVersion, minorVersion);
|
||||
for (DatabasePlatformProvider provider : providers) {
|
||||
if (provider.matchByProductName(dbProductName)) {
|
||||
return provider.create(majorVersion, minorVersion, metaData, connection);
|
||||
|
||||
@@ -12,9 +12,9 @@ import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Set;
|
||||
*/
|
||||
final class DefaultBeanLoader {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final DefaultServer server;
|
||||
private final boolean onIterateUseExtraTxn;
|
||||
@@ -108,8 +108,8 @@ final class DefaultBeanLoader {
|
||||
server.findOne(query, null);
|
||||
if (beanCollection != null) {
|
||||
if (beanCollection.checkEmptyLazyLoad()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
|
||||
}
|
||||
} else if (useManyIdCache) {
|
||||
parentDesc.cacheManyPropPut(many, beanCollection, parentId);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.config.*;
|
||||
import io.ebean.config.EntityClassRegister;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.event.ShutdownManager;
|
||||
import io.ebean.service.SpiContainer;
|
||||
@@ -13,9 +12,9 @@ import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClassPathSearch;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.executor.DefaultBackgroundExecutor;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@@ -28,7 +27,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public final class DefaultContainer implements SpiContainer {
|
||||
|
||||
private static final Logger log = CoreLog.log;
|
||||
private static final System.Logger log = CoreLog.log;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final ClusterManager clusterManager;
|
||||
@@ -108,7 +107,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
startServer(online, server);
|
||||
}
|
||||
DbOffline.reset();
|
||||
log.info("Started database[{}] platform[{}] in {}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
|
||||
log.log(Level.INFO, "Started database[{0}] platform[{1}] in {2}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
|
||||
return server;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
@@ -137,7 +136,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
private void checkMissingModulePathProvides() {
|
||||
URL servicesFile = ClassLoader.getSystemResource("META-INF/services/io.ebean.config.EntityClassRegister");
|
||||
if (servicesFile != null) {
|
||||
log.error("module-info.java is probably missing 'provides io.ebean.config.EntityClassRegister with EbeanEntityRegister' clause. EntityClassRegister exists but was not service loaded.");
|
||||
log.log(Level.ERROR, "module-info.java is probably missing 'provides io.ebean.config.EntityClassRegister with EbeanEntityRegister' clause. EntityClassRegister exists but was not service loaded.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +200,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
DatabasePlatform platform = config.getDatabasePlatform();
|
||||
if (platform == null) {
|
||||
if (config.getTenantMode().isDynamicDataSource()) {
|
||||
throw new IllegalStateException("DatabasePlatform must be explicitly set on DatabaseConfig for TenantMode "+config.getTenantMode());
|
||||
throw new IllegalStateException("DatabasePlatform must be explicitly set on DatabaseConfig for TenantMode " + config.getTenantMode());
|
||||
}
|
||||
// automatically determine the platform
|
||||
platform = new DatabasePlatformFactory().create(config);
|
||||
@@ -215,7 +214,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
*/
|
||||
private void setDataSource(DatabaseConfig config) {
|
||||
if (isOfflineMode(config)) {
|
||||
log.debug("... DbOffline using platform [{}]", DbOffline.getPlatform());
|
||||
log.log(Level.DEBUG, "... DbOffline using platform [{0}]", DbOffline.getPlatform());
|
||||
} else {
|
||||
InitDataSource.init(config);
|
||||
}
|
||||
@@ -251,7 +250,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
}
|
||||
try (Connection connection = config.getDataSource().getConnection()) {
|
||||
if (connection.getAutoCommit()) {
|
||||
log.warn("DataSource [{}] has autoCommit defaulting to true!", config.getName());
|
||||
log.log(Level.WARNING, "DataSource [{0}] has autoCommit defaulting to true!", config.getName());
|
||||
}
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.config.QueryPlanCapture;
|
||||
import io.ebean.config.QueryPlanListener;
|
||||
import io.ebean.meta.MetaQueryPlan;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
final class DefaultQueryPlanListener implements QueryPlanListener {
|
||||
|
||||
static final QueryPlanListener INSTANT = new DefaultQueryPlanListener();
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.QUERYPLAN");
|
||||
private static final System.Logger log = AppLog.getLogger("io.ebean.QUERYPLAN");
|
||||
|
||||
@Override
|
||||
public void process(QueryPlanCapture capture) {
|
||||
// better to log this in JSON form?
|
||||
String dbName = capture.database().name();
|
||||
for (MetaQueryPlan plan : capture.plans()) {
|
||||
log.info("queryPlan db:{} label:{} queryTimeMicros:{} loc:{} sql:{} bind:{} plan:{}",
|
||||
log.log(INFO, "queryPlan db:{0} label:{1} queryTimeMicros:{2} loc:{3} sql:{4} bind:{5} plan:{6}",
|
||||
dbName, plan.label(), plan.queryTimeMicros(), plan.profileLocation(),
|
||||
plan.sql(), plan.bind(), plan.plan());
|
||||
}
|
||||
|
||||
@@ -2,49 +2,11 @@ package io.ebeaninternal.server.core;
|
||||
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.AutoTune;
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.BeanState;
|
||||
import io.ebean.CallableSql;
|
||||
import io.ebean.DocumentStore;
|
||||
import io.ebean.DtoQuery;
|
||||
import io.ebean.ExpressionFactory;
|
||||
import io.ebean.ExpressionList;
|
||||
import io.ebean.ExtendedServer;
|
||||
import io.ebean.Filter;
|
||||
import io.ebean.FutureIds;
|
||||
import io.ebean.FutureList;
|
||||
import io.ebean.FutureRowCount;
|
||||
import io.ebean.MergeOptions;
|
||||
import io.ebean.MergeOptionsBuilder;
|
||||
import io.ebean.PagedList;
|
||||
import io.ebean.PersistenceContextScope;
|
||||
import io.ebean.ProfileLocation;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.QueryIterator;
|
||||
import io.ebean.RowConsumer;
|
||||
import io.ebean.RowMapper;
|
||||
import io.ebean.ScriptRunner;
|
||||
import io.ebean.SqlQuery;
|
||||
import io.ebean.SqlRow;
|
||||
import io.ebean.SqlUpdate;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.TransactionCallback;
|
||||
import io.ebean.TxScope;
|
||||
import io.ebean.Update;
|
||||
import io.ebean.UpdateQuery;
|
||||
import io.ebean.ValuePair;
|
||||
import io.ebean.Version;
|
||||
import io.ebean.*;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.annotation.TxIsolation;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanLoader;
|
||||
import io.ebean.bean.CallOrigin;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.bean.*;
|
||||
import io.ebean.bean.PersistenceContext.WithOption;
|
||||
import io.ebean.bean.SingleBeanLoader;
|
||||
import io.ebean.cache.ServerCacheManager;
|
||||
import io.ebean.common.CopyOnFirstWriteList;
|
||||
import io.ebean.config.*;
|
||||
@@ -53,11 +15,7 @@ import io.ebean.event.BeanPersistController;
|
||||
import io.ebean.event.ShutdownManager;
|
||||
import io.ebean.event.readaudit.ReadAuditLogger;
|
||||
import io.ebean.event.readaudit.ReadAuditPrepare;
|
||||
import io.ebean.meta.MetaInfoManager;
|
||||
import io.ebean.meta.MetaQueryPlan;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebean.meta.QueryPlanInit;
|
||||
import io.ebean.meta.QueryPlanRequest;
|
||||
import io.ebean.meta.*;
|
||||
import io.ebean.migration.auto.AutoMigrationRunner;
|
||||
import io.ebean.plugin.BeanType;
|
||||
import io.ebean.plugin.Plugin;
|
||||
@@ -78,21 +36,8 @@ import io.ebeaninternal.server.dto.DtoBeanDescriptor;
|
||||
import io.ebeaninternal.server.dto.DtoBeanManager;
|
||||
import io.ebeaninternal.server.el.ElFilter;
|
||||
import io.ebeaninternal.server.grammer.EqlParser;
|
||||
import io.ebeaninternal.server.query.CQuery;
|
||||
import io.ebeaninternal.server.query.CQueryEngine;
|
||||
import io.ebeaninternal.server.query.CallableQueryCount;
|
||||
import io.ebeaninternal.server.query.CallableQueryIds;
|
||||
import io.ebeaninternal.server.query.CallableQueryList;
|
||||
import io.ebeaninternal.server.query.DtoQueryEngine;
|
||||
import io.ebeaninternal.server.query.LimitOffsetPagedList;
|
||||
import io.ebeaninternal.server.query.QueryFutureIds;
|
||||
import io.ebeaninternal.server.query.QueryFutureList;
|
||||
import io.ebeaninternal.server.query.QueryFutureRowCount;
|
||||
import io.ebeaninternal.server.querydefn.DefaultDtoQuery;
|
||||
import io.ebeaninternal.server.querydefn.DefaultOrmQuery;
|
||||
import io.ebeaninternal.server.querydefn.DefaultOrmUpdate;
|
||||
import io.ebeaninternal.server.querydefn.DefaultRelationalQuery;
|
||||
import io.ebeaninternal.server.querydefn.DefaultUpdateQuery;
|
||||
import io.ebeaninternal.server.query.*;
|
||||
import io.ebeaninternal.server.querydefn.*;
|
||||
import io.ebeaninternal.server.rawsql.SpiRawSql;
|
||||
import io.ebeaninternal.server.text.csv.TCsvReader;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
@@ -101,12 +46,12 @@ import io.ebeaninternal.server.transaction.TransactionManager;
|
||||
import io.ebeaninternal.util.ParamTypeHelper;
|
||||
import io.ebeaninternal.util.ParamTypeHelper.TypeInfo;
|
||||
import io.ebeanservice.docstore.api.DocStoreIntegration;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@@ -129,7 +74,7 @@ import static java.util.stream.StreamSupport.stream;
|
||||
@NonNullApi
|
||||
public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final DatabaseConfig config;
|
||||
@@ -386,7 +331,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
if (config.isQueryPlanCapture()) {
|
||||
long secs = config.getQueryPlanCapturePeriodSecs();
|
||||
if (secs > 10) {
|
||||
log.info("capture query plan enabled, every {}secs", secs);
|
||||
log.log(Level.INFO, "capture query plan enabled, every {0}secs", secs);
|
||||
backgroundExecutor.scheduleWithFixedDelay(this::collectQueryPlans, secs, secs, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
@@ -434,7 +379,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
* Shutdown the services like threads and DataSource.
|
||||
*/
|
||||
private void shutdownInternal(boolean shutdownDataSource, boolean deregisterDriver) {
|
||||
log.trace("shutting down instance {}", serverName);
|
||||
log.log(Level.TRACE, "shutting down instance {0}", serverName);
|
||||
if (shutdown) {
|
||||
// already shutdown
|
||||
return;
|
||||
@@ -463,7 +408,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try {
|
||||
plugin.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.error("Error when shutting down plugin", e);
|
||||
log.log(Level.ERROR, "Error when shutting down plugin", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2038,7 +1983,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
return desc(bean.getClass()).getId(eb);
|
||||
}
|
||||
|
||||
private <T> BeanDescriptor<T> desc(Class<T> beanClass) {
|
||||
private <T> BeanDescriptor<T> desc(Class<T> beanClass) {
|
||||
BeanDescriptor<T> desc = descriptorManager.descriptor(beanClass);
|
||||
if (desc == null) {
|
||||
throw new PersistenceException(beanClass.getName() + " is NOT an Entity Bean registered with this server?");
|
||||
@@ -2130,7 +2075,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try {
|
||||
serverCacheManager.clearLocal(Class.forName(cache));
|
||||
} catch (Exception e) {
|
||||
log.error("Error clearing local cache for type " + cache, e);
|
||||
log.log(Level.ERROR, "Error clearing local cache for type " + cache, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.bean.ObjectGraphNode;
|
||||
import io.ebean.config.SlowQueryEvent;
|
||||
import io.ebean.config.SlowQueryListener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* Default slow query listener implementation that logs a warning message.
|
||||
*/
|
||||
final class DefaultSlowQueryListener implements SlowQueryListener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.SlowQuery");
|
||||
private static final System.Logger log = AppLog.getLogger("io.ebean.SlowQuery");
|
||||
|
||||
@Override
|
||||
public void process(SlowQueryEvent event) {
|
||||
@@ -20,6 +21,6 @@ final class DefaultSlowQueryListener implements SlowQueryListener {
|
||||
if (node != null) {
|
||||
firstStack = node.getOriginQueryPoint().getTopElement();
|
||||
}
|
||||
log.warn("Slow query warning - millis:{} rows:{} caller[{}] sql[{}]", event.getTimeMillis(), event.getRowCount(), firstStack, event.getSql());
|
||||
log.log(WARNING, "Slow query warning - millis:{0} rows:{1} caller[{2}] sql[{3}]", event.getTimeMillis(), event.getRowCount(), firstStack, event.getSql());
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import io.ebeaninternal.xmapping.api.XmapDto;
|
||||
import io.ebeaninternal.xmapping.api.XmapEbean;
|
||||
import io.ebeaninternal.xmapping.api.XmapRawSql;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -55,7 +56,7 @@ final class InternalConfigXmlMap {
|
||||
try {
|
||||
dtoClass = Class.forName(dto.getClazz(), false, classLoader);
|
||||
} catch (Exception e) {
|
||||
CoreLog.internal.error("Could not load dto bean class " + dto.getClazz() + " for ebean xml entry");
|
||||
CoreLog.internal.log(Level.ERROR, "Could not load dto bean class " + dto.getClazz() + " for ebean xml entry");
|
||||
return;
|
||||
}
|
||||
DtoNamedQueries namedQueries = dtoNamedQueries.computeIfAbsent(dtoClass, aClass -> new DtoNamedQueries());
|
||||
|
||||
@@ -56,8 +56,8 @@ import io.ebeanservice.docstore.api.DocStoreFactory;
|
||||
import io.ebeanservice.docstore.api.DocStoreIntegration;
|
||||
import io.ebeanservice.docstore.api.DocStoreUpdateProcessor;
|
||||
import io.ebeanservice.docstore.none.NoneDocStoreFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ import java.util.*;
|
||||
*/
|
||||
public final class InternalConfiguration {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final TableModState tableModState;
|
||||
private final boolean online;
|
||||
@@ -246,7 +246,7 @@ public final class InternalConfiguration {
|
||||
*/
|
||||
ReadAuditLogger getReadAuditLogger() {
|
||||
ReadAuditLogger found = bootupClasses.getReadAuditLogger();
|
||||
return plugin(found != null ? found : jacksonCorePresent? new DefaultReadAuditLogger(): null);
|
||||
return plugin(found != null ? found : jacksonCorePresent ? new DefaultReadAuditLogger() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -433,7 +433,7 @@ public final class InternalConfiguration {
|
||||
externalTransactionManager = new JtaTransactionManager();
|
||||
}
|
||||
if (externalTransactionManager != null) {
|
||||
log.info("Using Transaction Manager [" + externalTransactionManager.getClass() + "]");
|
||||
log.log(Level.INFO, "Using Transaction Manager {0}", externalTransactionManager.getClass());
|
||||
return new ExternalTransactionScopeManager(externalTransactionManager);
|
||||
} else {
|
||||
return new DefaultTransactionScopeManager();
|
||||
@@ -523,7 +523,7 @@ public final class InternalConfiguration {
|
||||
if (iterator.hasNext()) {
|
||||
// use the cacheFactory (via classpath service loader)
|
||||
plugin = iterator.next();
|
||||
log.debug("using ServerCacheFactory {}", plugin.getClass());
|
||||
log.log(Level.DEBUG, "using ServerCacheFactory {0}", plugin.getClass());
|
||||
} else {
|
||||
// use the built in default l2 caching which is local cache based
|
||||
localL2Caching = true;
|
||||
@@ -605,6 +605,7 @@ public final class InternalConfiguration {
|
||||
|
||||
private static class NoopDdl implements SpiDdlGenerator {
|
||||
private final boolean ddlRun;
|
||||
|
||||
NoopDdl(boolean ddlRun) {
|
||||
this.ddlRun = ddlRun;
|
||||
}
|
||||
@@ -612,7 +613,7 @@ public final class InternalConfiguration {
|
||||
@Override
|
||||
public void execute(boolean online) {
|
||||
if (online && ddlRun) {
|
||||
CoreLog.log.error("Configured to run DDL but ebean-ddl-generator is not in the classpath (or ebean-test in the test classpath?)");
|
||||
CoreLog.log.log(Level.ERROR, "Configured to run DDL but ebean-ddl-generator is not in the classpath (or ebean-test in the test classpath?)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Wraps the objects involved in executing a Query.
|
||||
*/
|
||||
@@ -244,7 +246,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
// Just log this and carry on. A previous exception has been
|
||||
// thrown and if this rollback throws exception it likely means
|
||||
// that the connection is broken (and the dataSource and db will cleanup)
|
||||
CoreLog.log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
CoreLog.log.log(ERROR, "Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -4,8 +4,8 @@ import io.avaje.classpath.scanner.ClassPathScanner;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.ClassPathScanners;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class BootupClassPathSearch {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final List<String> packages;
|
||||
private final List<ClassPathScanner> scanners;
|
||||
@@ -42,7 +42,6 @@ public class BootupClassPathSearch {
|
||||
* Search the classPath for the classes we are interested in.
|
||||
*/
|
||||
private BootupClasses getBootupClasses() {
|
||||
|
||||
try {
|
||||
BootupClasses bc = new BootupClasses();
|
||||
|
||||
@@ -59,7 +58,7 @@ public class BootupClassPathSearch {
|
||||
}
|
||||
|
||||
long searchTime = System.currentTimeMillis() - st;
|
||||
log.debug("Classpath search entities[{}] searchTime[{}] in packages[{}]", bc.getEntities().size(), searchTime, packages);
|
||||
log.log(Level.DEBUG, "Classpath search entities[{0}] searchTime[{1}] in packages[{2}]", bc.getEntities().size(), searchTime, packages);
|
||||
return bc;
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -13,12 +13,12 @@ import io.ebean.event.readaudit.ReadAuditLogger;
|
||||
import io.ebean.event.readaudit.ReadAuditPrepare;
|
||||
import io.ebean.util.AnnotationUtil;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
@@ -31,7 +31,7 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
public class BootupClasses implements Predicate<Class<?>> {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final List<Class<?>> embeddableList = new ArrayList<>();
|
||||
private final List<Class<?>> entityList = new ArrayList<>();
|
||||
@@ -205,13 +205,13 @@ public class BootupClasses implements Predicate<Class<?>> {
|
||||
try {
|
||||
return cls.getConstructor().newInstance();
|
||||
} catch (NoSuchMethodException e) {
|
||||
log.debug("Ignore/expected - no default constructor: " +e.getMessage());
|
||||
log.log(Level.DEBUG, "Ignore/expected - no default constructor: " + e.getMessage());
|
||||
return null;
|
||||
|
||||
} catch (Exception e) {
|
||||
if (logOnException) {
|
||||
// not expected but we log and carry on
|
||||
log.error("Error creating " + cls, e);
|
||||
log.log(Level.ERROR, "Error creating " + cls, e);
|
||||
return null;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -3,10 +3,10 @@ package io.ebeaninternal.server.core.bootup;
|
||||
import io.ebean.util.StringHelper;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.util.UrlHelper;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
@@ -20,7 +20,7 @@ import java.util.jar.Manifest;
|
||||
*/
|
||||
class ManifestReader {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final Set<String> packageSet = new HashSet<>();
|
||||
private final ClassLoader classLoader;
|
||||
@@ -55,7 +55,6 @@ class ManifestReader {
|
||||
* Read all the specific manifest files and return the set of packages containing type query beans.
|
||||
*/
|
||||
private Set<String> read(ClassLoader classLoader, String resourcePath) {
|
||||
|
||||
try {
|
||||
Enumeration<URL> resources = classLoader.getResources(resourcePath);
|
||||
while (resources.hasMoreElements()) {
|
||||
@@ -64,7 +63,7 @@ class ManifestReader {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.warn("Error reading " + resourcePath + " manifest resources", e);
|
||||
log.log(Level.WARNING, "Error reading " + resourcePath + " manifest resources", e);
|
||||
}
|
||||
return packageSet;
|
||||
}
|
||||
@@ -73,7 +72,6 @@ class ManifestReader {
|
||||
* Read the entity packages from the manifest.
|
||||
*/
|
||||
private void read(Manifest manifest) throws IOException {
|
||||
|
||||
Attributes attributes = manifest.getMainAttributes();
|
||||
String agentOnlyUse = attributes.getValue("agent-use-only");
|
||||
if (agentOnlyUse == null || !"true".equalsIgnoreCase(agentOnlyUse.trim())) {
|
||||
|
||||
@@ -54,11 +54,11 @@ import io.ebeanservice.docstore.api.DocStoreUpdates;
|
||||
import io.ebeanservice.docstore.api.mapping.DocMappingBuilder;
|
||||
import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
|
||||
import io.ebeanservice.docstore.api.mapping.DocumentMapping;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
@@ -74,7 +74,7 @@ import static io.ebeaninternal.server.persist.DmlUtil.isNullOrZero;
|
||||
*/
|
||||
public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
public enum EntityType {
|
||||
ORM, EMBEDDED, VIEW, SQL, DOC
|
||||
@@ -494,9 +494,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* as they are used to get the imported and exported properties.
|
||||
*/
|
||||
void initialiseId(BeanDescriptorInitContext initContext) {
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("BeanDescriptor initialise " + fullName);
|
||||
}
|
||||
if (draftable) {
|
||||
initContext.addDraft(baseTable, draftTable);
|
||||
}
|
||||
@@ -795,7 +792,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
changeJson.flush();
|
||||
return beanChange(ChangeType.UPDATE, request.beanId(), changeJson.newJson(), changeJson.oldJson());
|
||||
} catch (RuntimeException e) {
|
||||
log.error("Failed to write ChangeLog entry for update", e);
|
||||
log.log(Level.ERROR, "Failed to write ChangeLog entry for update", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -811,7 +808,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
jsonWriter.flush();
|
||||
return beanChange(ChangeType.INSERT, request.beanId(), writer.toString(), null);
|
||||
} catch (IOException e) {
|
||||
log.error("Failed to write ChangeLog entry for insert", e);
|
||||
log.log(Level.ERROR, "Failed to write ChangeLog entry for insert", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2291,11 +2288,11 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
private ElComparator<T> createPropertyComparator(SortByClause.Property sortProp) {
|
||||
ElPropertyValue elGetValue = elGetValue(sortProp.getName());
|
||||
if (elGetValue == null) {
|
||||
log.error("Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
|
||||
log.log(Level.ERROR, "Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
|
||||
return new ElComparatorNoop<>();
|
||||
}
|
||||
if (elGetValue.isAssocMany()) {
|
||||
log.error("Sort property [" + sortProp + "] in " + beanType + " is a many-property. Cannot sort.");
|
||||
log.log(Level.ERROR, "Sort property [" + sortProp + "] in " + beanType + " is a many-property. Cannot sort.");
|
||||
return new ElComparatorNoop<>();
|
||||
}
|
||||
Boolean nullsHigh = sortProp.getNullsHigh();
|
||||
@@ -2771,7 +2768,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
public void markAsDeleted(EntityBean bean) {
|
||||
if (softDeleteProperty == null) {
|
||||
Object id = getId(bean);
|
||||
log.info("(Lazy) loading unsuccessful for type:{} id:{} - expecting when bean has been deleted", name(), id);
|
||||
log.log(Level.INFO, "(Lazy) loading unsuccessful for type:{0} id:{1} - expecting when bean has been deleted", name(), id);
|
||||
bean._ebean_getIntercept().setLazyLoadFailure(id);
|
||||
} else {
|
||||
softDeleteValue(bean);
|
||||
|
||||
+73
-73
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
@@ -13,10 +14,9 @@ import io.ebeaninternal.server.core.CacheOptions;
|
||||
import io.ebeaninternal.server.core.PersistRequest;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -26,12 +26,12 @@ import java.util.*;
|
||||
*/
|
||||
final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private static final Logger queryLog = LoggerFactory.getLogger("io.ebean.cache.QUERY");
|
||||
private static final Logger beanLog = LoggerFactory.getLogger("io.ebean.cache.BEAN");
|
||||
private static final Logger manyLog = LoggerFactory.getLogger("io.ebean.cache.COLL");
|
||||
private static final Logger natLog = LoggerFactory.getLogger("io.ebean.cache.NATKEY");
|
||||
private static final System.Logger queryLog = AppLog.getLogger("io.ebean.cache.QUERY");
|
||||
private static final System.Logger beanLog = AppLog.getLogger("io.ebean.cache.BEAN");
|
||||
private static final System.Logger manyLog = AppLog.getLogger("io.ebean.cache.COLL");
|
||||
private static final System.Logger natLog = AppLog.getLogger("io.ebean.cache.NATKEY");
|
||||
|
||||
private final BeanDescriptor<T> desc;
|
||||
private final SpiCacheManager cacheManager;
|
||||
@@ -104,10 +104,10 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
void deriveNotifyFlags() {
|
||||
cacheNotifyOnAll = (invalidateQueryCache || beanCache != null || queryCache != null);
|
||||
cacheNotifyOnDelete = !cacheNotifyOnAll && isNotifyOnDeletes();
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
if (cacheNotifyOnAll || cacheNotifyOnDelete) {
|
||||
String notifyMode = cacheNotifyOnAll ? "All" : "Delete";
|
||||
log.debug("l2 caching on {} - beanCaching:{} queryCaching:{} notifyMode:{} ",
|
||||
log.log(Level.DEBUG, "l2 caching on {0} - beanCaching:{1} queryCaching:{2} notifyMode:{3} ",
|
||||
desc.fullName(), isBeanCaching(), isQueryCaching(), notifyMode);
|
||||
}
|
||||
}
|
||||
@@ -178,8 +178,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
*/
|
||||
void queryCacheClear() {
|
||||
if (queryCache != null) {
|
||||
if (queryLog.isDebugEnabled()) {
|
||||
queryLog.debug(" CLEAR {}", cacheName);
|
||||
if (queryLog.isLoggable(Level.DEBUG)) {
|
||||
queryLog.log(Level.DEBUG, " CLEAR {0}", cacheName);
|
||||
}
|
||||
queryCache.clear();
|
||||
}
|
||||
@@ -202,11 +202,11 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
throw new IllegalStateException("No query cache enabled on " + desc + ". Need explicit @Cache(enableQueryCache=true)");
|
||||
}
|
||||
Object queryResult = queryCache.get(id);
|
||||
if (queryLog.isDebugEnabled()) {
|
||||
if (queryLog.isLoggable(Level.DEBUG)) {
|
||||
if (queryResult == null) {
|
||||
queryLog.debug(" GET {}({}) - cache miss", cacheName, id);
|
||||
queryLog.log(Level.DEBUG, " GET {0}({1}) - cache miss", cacheName, id);
|
||||
} else {
|
||||
queryLog.debug(" GET {}({}) - hit", cacheName, id);
|
||||
queryLog.log(Level.DEBUG, " GET {0}({1}) - hit", cacheName, id);
|
||||
}
|
||||
}
|
||||
return queryResult;
|
||||
@@ -219,8 +219,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
if (queryCache == null) {
|
||||
throw new IllegalStateException("No query cache enabled on " + desc + ". Need explicit @Cache(enableQueryCache=true)");
|
||||
}
|
||||
if (queryLog.isDebugEnabled()) {
|
||||
queryLog.debug(" PUT {}({})", cacheName, id);
|
||||
if (queryLog.isLoggable(Level.DEBUG)) {
|
||||
queryLog.log(Level.DEBUG, " PUT {0}({1})", cacheName, id);
|
||||
}
|
||||
queryCache.put(id, entry);
|
||||
}
|
||||
@@ -228,16 +228,16 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
void manyPropRemove(String propertyName, Object parentId) {
|
||||
ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, propertyName);
|
||||
if (manyLog.isTraceEnabled()) {
|
||||
manyLog.trace(" REMOVE {}({}).{}", cacheName, parentId, propertyName);
|
||||
if (manyLog.isLoggable(Level.TRACE)) {
|
||||
manyLog.log(Level.TRACE, " REMOVE {0}({1}).{2}", cacheName, parentId, propertyName);
|
||||
}
|
||||
collectionIdsCache.remove(parentId);
|
||||
}
|
||||
|
||||
void manyPropClear(String propertyName) {
|
||||
ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, propertyName);
|
||||
if (manyLog.isDebugEnabled()) {
|
||||
manyLog.debug(" CLEAR {}(*).{} ", cacheName, propertyName);
|
||||
if (manyLog.isLoggable(Level.DEBUG)) {
|
||||
manyLog.log(Level.DEBUG, " CLEAR {0}(*).{1} ", cacheName, propertyName);
|
||||
}
|
||||
collectionIdsCache.clear();
|
||||
}
|
||||
@@ -249,11 +249,11 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, propertyName);
|
||||
CachedManyIds entry = (CachedManyIds) collectionIdsCache.get(parentId);
|
||||
if (entry == null) {
|
||||
if (manyLog.isTraceEnabled()) {
|
||||
manyLog.trace(" GET {}({}).{} - cache miss", cacheName, parentId, propertyName);
|
||||
if (manyLog.isLoggable(Level.TRACE)) {
|
||||
manyLog.log(Level.TRACE, " GET {0}({1}).{2} - cache miss", cacheName, parentId, propertyName);
|
||||
}
|
||||
} else if (manyLog.isDebugEnabled()) {
|
||||
manyLog.debug(" GET {}({}).{} - hit", cacheName, parentId, propertyName);
|
||||
} else if (manyLog.isLoggable(Level.DEBUG)) {
|
||||
manyLog.log(Level.DEBUG, " GET {0}({1}).{2} - hit", cacheName, parentId, propertyName);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
@@ -303,12 +303,12 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
changes.put(many.name(), asJson);
|
||||
|
||||
CachedBeanData newData = data.update(changes, data.getVersion());
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" UPDATE {}({}) changes:{}", cacheName, parentId, changes);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " UPDATE {0}({1}) changes:{2}", cacheName, parentId, changes);
|
||||
}
|
||||
beanCache.put(parentId, newData);
|
||||
} catch (IOException e) {
|
||||
log.error("Error updating L2 cache", e);
|
||||
log.log(Level.ERROR, "Error updating L2 cache", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -321,8 +321,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
void cachePutManyIds(Object parentId, String manyName, CachedManyIds entry) {
|
||||
ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, manyName);
|
||||
if (manyLog.isDebugEnabled()) {
|
||||
manyLog.debug(" PUT {}({}).{} - ids:{}", cacheName, parentId, manyName, entry);
|
||||
if (manyLog.isLoggable(Level.DEBUG)) {
|
||||
manyLog.log(Level.DEBUG, " PUT {0}({1}).{2} - ids:{3}", cacheName, parentId, manyName, entry);
|
||||
}
|
||||
collectionIdsCache.put(parentId, entry);
|
||||
}
|
||||
@@ -353,8 +353,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
return new BeanCacheResult<>();
|
||||
}
|
||||
Map<Object, Object> beanDataMap = beanCache.getAll(keys);
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" MGET {}({}) - hits:{}", cacheName, ids, beanDataMap.keySet());
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " MGET {0}({1}) - hits:{2}", cacheName, ids, beanDataMap.keySet());
|
||||
}
|
||||
BeanCacheResult<T> result = new BeanCacheResult<>();
|
||||
for (Map.Entry<Object, Object> entry : beanDataMap.entrySet()) {
|
||||
@@ -375,8 +375,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
// naturalKey -> Id map
|
||||
Map<Object, Object> naturalKeyMap = naturalKeyCache.getAll(keys);
|
||||
if (natLog.isTraceEnabled()) {
|
||||
natLog.trace(" MLOOKUP {}({}) - hits:{}", cacheName, keys, naturalKeyMap);
|
||||
if (natLog.isLoggable(Level.TRACE)) {
|
||||
natLog.log(Level.TRACE, " MLOOKUP {0}({1}) - hits:{2}", cacheName, keys, naturalKeyMap);
|
||||
}
|
||||
|
||||
BeanCacheResult<T> result = new BeanCacheResult<>();
|
||||
@@ -392,8 +392,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
Set<Object> ids = new HashSet<>(naturalKeyMap.values());
|
||||
Map<Object, Object> beanDataMap = beanCache.getAll(ids);
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" MGET {}({}) - hits:{}", cacheName, ids, beanDataMap.keySet());
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " MGET {0}({1}) - hits:{2}", cacheName, ids, beanDataMap.keySet());
|
||||
}
|
||||
// process the hits into beans etc
|
||||
for (Map.Entry<Object, Object> entry : beanDataMap.entrySet()) {
|
||||
@@ -437,8 +437,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
*/
|
||||
void beanCacheClear() {
|
||||
if (beanCache != null) {
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" CLEAR {}", cacheName);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " CLEAR {0}", cacheName);
|
||||
}
|
||||
beanCache.clear();
|
||||
}
|
||||
@@ -507,14 +507,14 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" MPUT {}({})", cacheName, map.keySet());
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " MPUT {0}({1})", cacheName, map.keySet());
|
||||
}
|
||||
getBeanCache().putAll(map);
|
||||
|
||||
if (natKeys != null && !natKeys.isEmpty()) {
|
||||
if (natLog.isDebugEnabled()) {
|
||||
natLog.debug(" MPUT {}({}, {})", cacheName, naturalKey, natKeys.keySet());
|
||||
if (natLog.isLoggable(Level.DEBUG)) {
|
||||
natLog.log(Level.DEBUG, " MPUT {0}({1}, {2})", cacheName, naturalKey, natKeys.keySet());
|
||||
}
|
||||
naturalKeyCache.putAll(natKeys);
|
||||
}
|
||||
@@ -526,15 +526,15 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
void beanCachePutDirect(EntityBean bean) {
|
||||
CachedBeanData beanData = beanExtractData(desc, bean);
|
||||
String key = desc.cacheKeyForBean(bean);
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" PUT {}({}) data:{}", cacheName, key, beanData);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " PUT {0}({1}) data:{2}", cacheName, key, beanData);
|
||||
}
|
||||
getBeanCache().put(key, beanData);
|
||||
if (naturalKey != null) {
|
||||
String naturalKey = calculateNaturalKey(beanData);
|
||||
if (naturalKey != null) {
|
||||
if (natLog.isDebugEnabled()) {
|
||||
natLog.debug(" PUT {}({}, {})", cacheName, naturalKey, key);
|
||||
if (natLog.isLoggable(Level.DEBUG)) {
|
||||
natLog.log(Level.DEBUG, " PUT {0}({1}, {2})", cacheName, naturalKey, key);
|
||||
}
|
||||
naturalKeyCache.put(naturalKey, key);
|
||||
}
|
||||
@@ -575,13 +575,13 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
private T beanCacheGetInternal(String key, Boolean readOnly, PersistenceContext context) {
|
||||
CachedBeanData data = (CachedBeanData) getBeanCache().get(key);
|
||||
if (data == null) {
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" GET {}({}) - cache miss", cacheName, key);
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " GET {0}({1}) - cache miss", cacheName, key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" GET {}({}) - hit", cacheName, key);
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " GET {0}({1}) - hit", cacheName, key);
|
||||
}
|
||||
return convertToBean(key, readOnly, context, data);
|
||||
}
|
||||
@@ -591,8 +591,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
if (cacheSharableBeans && !Boolean.FALSE.equals(readOnly)) {
|
||||
Object bean = data.getSharableBean();
|
||||
if (bean != null) {
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" GET {}({}) - hit shared bean", cacheName, id);
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " GET {0}({1}) - hit shared bean", cacheName, id);
|
||||
}
|
||||
if (desc.isReadAuditing()) {
|
||||
desc.readAuditBean("l2", "", bean);
|
||||
@@ -680,8 +680,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
*/
|
||||
void beanCacheApplyInvalidate(Collection<String> keys) {
|
||||
if (beanCache != null) {
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" MREMOVE {}({})", cacheName, keys);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " MREMOVE {0}({1})", cacheName, keys);
|
||||
}
|
||||
beanCache.removeAll(new HashSet<>(keys));
|
||||
}
|
||||
@@ -700,8 +700,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
|
||||
Map<Object, Object> hits = getBeanCache().getAll(ebis.keySet());
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" MLOAD {}({}) - got hits ({})", cacheName, ebis.keySet(), hits.size());
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " MLOAD {0}({1}) - got hits ({2})", cacheName, ebis.keySet(), hits.size());
|
||||
}
|
||||
|
||||
Set<EntityBeanIntercept> loaded = new HashSet<>();
|
||||
@@ -713,19 +713,19 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
CachedBeanData cacheData = (CachedBeanData) hit.getValue();
|
||||
|
||||
if (lazyLoadProperty > -1 && !cacheData.isLoaded(propertyName)) {
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" load {}({}) - cache miss on property({})", cacheName, key, propertyName);
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " load {0}({1}) - cache miss on property({2})", cacheName, key, propertyName);
|
||||
}
|
||||
} else {
|
||||
CachedBeanDataToBean.load(desc, ebi.getOwner(), cacheData, context);
|
||||
loaded.add(ebi);
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" load {}({}) - hit", cacheName, key);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " load {0}({1}) - hit", cacheName, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ebis.isEmpty() && beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" load {}({}) - cache miss", cacheName, ebis.keySet());
|
||||
if (!ebis.isEmpty() && beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " load {0}({1}) - cache miss", cacheName, ebis.keySet());
|
||||
}
|
||||
return loaded;
|
||||
}
|
||||
@@ -736,21 +736,21 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
boolean beanCacheLoad(EntityBean bean, EntityBeanIntercept ebi, String key, PersistenceContext context) {
|
||||
CachedBeanData cacheData = (CachedBeanData) getBeanCache().get(key);
|
||||
if (cacheData == null) {
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" LOAD {}({}) - cache miss", cacheName, key);
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " LOAD {0}({1}) - cache miss", cacheName, key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
int lazyLoadProperty = ebi.getLazyLoadPropertyIndex();
|
||||
if (lazyLoadProperty > -1 && !cacheData.isLoaded(ebi.getLazyLoadProperty())) {
|
||||
if (beanLog.isTraceEnabled()) {
|
||||
beanLog.trace(" LOAD {}({}) - cache miss on property({})", cacheName, key, ebi.getLazyLoadProperty());
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " LOAD {0}({1}) - cache miss on property({2})", cacheName, key, ebi.getLazyLoadProperty());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
CachedBeanDataToBean.load(desc, bean, cacheData, context);
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" LOAD {}({}) - hit", cacheName, key);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " LOAD {0}({1}) - hit", cacheName, key);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -874,8 +874,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
if (existingData != null) {
|
||||
long currentVersion = existingData.getVersion();
|
||||
if (version > 0 && version < currentVersion) {
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" REMOVE {}({}) - version conflict old:{} new:{}", cacheName, key, currentVersion, version);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " REMOVE {0}({1}) - version conflict old:{2} new:{3}", cacheName, key, currentVersion, version);
|
||||
}
|
||||
cache.remove(key);
|
||||
} else {
|
||||
@@ -883,16 +883,16 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
version = currentVersion;
|
||||
}
|
||||
CachedBeanData newData = existingData.update(changes, version);
|
||||
if (beanLog.isDebugEnabled()) {
|
||||
beanLog.debug(" UPDATE {}({}) changes:{}", cacheName, key, changes);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " UPDATE {0}({1}) changes:{2}", cacheName, key, changes);
|
||||
}
|
||||
cache.put(key, newData);
|
||||
}
|
||||
if (updateNaturalKey) {
|
||||
Object oldKey = calculateNaturalKey(existingData);
|
||||
if (oldKey != null) {
|
||||
if (natLog.isDebugEnabled()) {
|
||||
natLog.debug(".. update {} REMOVE({}) - old key for ({})", cacheName, oldKey, key);
|
||||
if (natLog.isLoggable(Level.DEBUG)) {
|
||||
natLog.log(Level.DEBUG, ".. update {0} REMOVE({1}) - old key for ({2})", cacheName, oldKey, key);
|
||||
}
|
||||
naturalKeyCache.remove(oldKey);
|
||||
}
|
||||
|
||||
+15
-15
@@ -41,13 +41,13 @@ import io.ebeaninternal.xmapping.api.XmapNamedQuery;
|
||||
import io.ebeaninternal.xmapping.api.XmapRawSql;
|
||||
import io.ebeanservice.docstore.api.DocStoreBeanAdapter;
|
||||
import io.ebeanservice.docstore.api.DocStoreFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Transient;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.Serializable;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
@@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTypeManager {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private static final BeanDescComparator beanDescComparator = new BeanDescComparator();
|
||||
public static final String JAVA_LANG_RECORD = "java.lang.Record";
|
||||
@@ -309,7 +309,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
} catch (BeanNotEnhancedException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
log.error("Error in deployment", e);
|
||||
log.log(Level.ERROR, "Error in deployment", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -332,13 +332,13 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
try {
|
||||
entityClass = Class.forName(entityClassName, false, classLoader);
|
||||
} catch (Exception e) {
|
||||
log.error("Could not load entity bean class " + entityClassName + " for ebean.xml entry");
|
||||
log.log(Level.ERROR, "Could not load entity bean class " + entityClassName + " for ebean.xml entry");
|
||||
return;
|
||||
}
|
||||
|
||||
DeployBeanInfo<?> info = deployInfoMap.get(entityClass);
|
||||
if (info == null) {
|
||||
log.error("No entity bean for ebean.xml entry " + entityClassName);
|
||||
log.log(Level.ERROR, "No entity bean for ebean.xml entry " + entityClassName);
|
||||
|
||||
} else {
|
||||
for (XmapRawSql sql : entityDeploy.getRawSql()) {
|
||||
@@ -601,11 +601,11 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
int pc = postConstructManager.getRegisterCount();
|
||||
int lc = persistListenerManager.getRegisterCount();
|
||||
int fc = beanFinderManager.getRegisterCount();
|
||||
log.debug("BeanPersistControllers[{}] BeanFinders[{}] BeanPersistListeners[{}] BeanQueryAdapters[{}] BeanPostLoaders[{}] BeanPostConstructors[{}]", cc, fc, lc, qa, pl, pc);
|
||||
log.log(Level.DEBUG, "BeanPersistControllers[{0}] BeanFinders[{1}] BeanPersistListeners[{2}] BeanQueryAdapters[{3}] BeanPostLoaders[{4}] BeanPostConstructors[{5}]", cc, fc, lc, qa, pl, pc);
|
||||
}
|
||||
|
||||
private void logStatus() {
|
||||
log.debug("Entities[{}]", entityBeanCount);
|
||||
log.log(Level.DEBUG, "Entities[{0}]", entityBeanCount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -865,13 +865,13 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
for (String possibleMappedBy : matchSet) {
|
||||
String possibleLower = possibleMappedBy.toLowerCase();
|
||||
if (possibleLower.contains(searchName)) {
|
||||
// we have a match..
|
||||
// we have a match
|
||||
prop.setMappedBy(possibleMappedBy);
|
||||
|
||||
String m = "Implicitly found mappedBy for " + targetDesc + "." + prop;
|
||||
m += " by searching for [" + searchName + "] against " + matchSet;
|
||||
log.debug(m);
|
||||
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
String m = "Implicitly found mappedBy for " + targetDesc + "." + prop;
|
||||
m += " by searching for [" + searchName + "] against " + matchSet;
|
||||
log.log(Level.DEBUG, m);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1207,12 +1207,12 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
final DeployIdentityMode identityMode = desc.getIdentityMode();
|
||||
if (identityMode.isSequence() && !dbIdentity.isSupportsSequence()) {
|
||||
// explicit sequence but not supported by the DatabasePlatform
|
||||
log.info("Explicit sequence on " + desc.getFullName() + " but not supported by DB Platform - ignored");
|
||||
log.log(Level.INFO, "Explicit sequence on {0} but not supported by DB Platform - ignored", desc.getFullName());
|
||||
identityMode.setIdType(IdType.AUTO);
|
||||
}
|
||||
if (identityMode.isIdentity() && !dbIdentity.isSupportsIdentity()) {
|
||||
// explicit identity but not supported by the DatabasePlatform
|
||||
log.info("Explicit Identity on " + desc.getFullName() + " but not supported by DB Platform - ignored");
|
||||
log.log(Level.INFO, "Explicit Identity on {0} but not supported by DB Platform - ignored", desc.getFullName());
|
||||
identityMode.setIdType(IdType.AUTO);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,16 +4,17 @@ import io.ebean.event.BeanFindController;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Default implementation for BeanFinderFactory.
|
||||
*/
|
||||
final class BeanFinderManager {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final List<BeanFindController> list;
|
||||
|
||||
@@ -31,7 +32,7 @@ final class BeanFinderManager {
|
||||
void addFindControllers(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanFindController c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
log.debug("BeanFindController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
log.log(DEBUG, "BeanFindController on[{0}] {1}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.setBeanFinder(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import javax.persistence.PersistenceException;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
@@ -1433,7 +1434,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
objValue = null;
|
||||
String msg = "Error trying to use Jackson ObjectMapper to read transient property "
|
||||
+ fullName() + " - consider marking this property with @JsonIgnore";
|
||||
CoreLog.log.error(msg, e);
|
||||
CoreLog.log.log(Level.ERROR, msg, e);
|
||||
}
|
||||
}
|
||||
if (jsonDeserialize) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
|
||||
import io.ebeanservice.docstore.api.support.DocStructure;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -432,7 +433,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
if (!idProp.isEmbedded()) {
|
||||
// simple single scalar id
|
||||
if (cols.length != 1) {
|
||||
CoreLog.log.error("No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]");
|
||||
CoreLog.log.log(Level.ERROR, "No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]");
|
||||
return null;
|
||||
} else {
|
||||
BeanProperty[] idProps = {idProp};
|
||||
|
||||
@@ -24,6 +24,7 @@ import io.ebeaninternal.server.query.SqlBeanLoad;
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -667,7 +668,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
// not found as individual scalar properties
|
||||
CoreLog.log.error("Could not find a exported property?", e);
|
||||
CoreLog.log.log(Level.ERROR, "Could not find a exported property?", e);
|
||||
}
|
||||
} else {
|
||||
if (idProp != null) {
|
||||
@@ -962,7 +963,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
setValue(bean, collection);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.error("Error setting value from L2 cache", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error setting value from L2 cache", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -975,7 +976,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
return jsonWriteCollection(collection);
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.error("Error building value element collection json for L2 cache", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error building value element collection json for L2 cache", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -7,6 +7,8 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Default implementation for creating BeanControllers.
|
||||
*/
|
||||
@@ -28,7 +30,7 @@ final class BeanQueryAdapterManager {
|
||||
void addQueryAdapter(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanQueryAdapter c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
CoreLog.internal.debug("BeanQueryAdapter on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
CoreLog.internal.log(DEBUG, "BeanQueryAdapter on[{0}] {1}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.addQueryAdapter(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanTable;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployTableJoin;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployTableJoinColumn;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
|
||||
/**
|
||||
* Used for associated beans in place of a BeanDescriptor. This is done to avoid
|
||||
@@ -105,7 +107,7 @@ public final class BeanTable {
|
||||
if (complexKey) {
|
||||
// just to copy the column name rather than prefix with the foreignKeyPrefix.
|
||||
// I think that with complex keys this is the more common approach.
|
||||
CoreLog.internal.debug("On table[{}] foreign key column [{}]", baseTable, lc);
|
||||
CoreLog.internal.log(Level.DEBUG, "On table[{0}] foreign key column [{1}]", baseTable, lc);
|
||||
fk = lc;
|
||||
}
|
||||
if (sqlFormulaSelect != null) {
|
||||
|
||||
+3
-1
@@ -7,6 +7,8 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Default implementation for creating BeanControllers.
|
||||
*/
|
||||
@@ -28,7 +30,7 @@ final class PersistControllerManager {
|
||||
void addPersistControllers(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanPersistController c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
CoreLog.log.debug("BeanPersistController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
CoreLog.log.log(DEBUG, "BeanPersistController on[{0}] {1}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.addPersistController(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Manages the assignment/registration of BeanPersistListener with their
|
||||
* respective DeployBeanDescriptor's.
|
||||
@@ -29,7 +31,7 @@ final class PersistListenerManager {
|
||||
<T> void addPersistListeners(DeployBeanDescriptor<T> deployDesc) {
|
||||
for (BeanPersistListener listener : list) {
|
||||
if (listener.isRegisterFor(deployDesc.getBeanType())) {
|
||||
CoreLog.log.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
|
||||
CoreLog.log.log(DEBUG, "BeanPersistListener on[{0}] {1}", deployDesc.getFullName(), listener.getClass().getName());
|
||||
deployDesc.addPersistListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Default implementation for creating BeanControllers.
|
||||
*/
|
||||
@@ -28,7 +30,7 @@ final class PostConstructManager {
|
||||
void addPostConstructListeners(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanPostConstructListener c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
CoreLog.log.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
CoreLog.log.log(DEBUG, "BeanPostLoad on[{0}] {1}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.addPostConstructListener(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Default implementation for creating BeanControllers.
|
||||
*/
|
||||
@@ -28,7 +30,7 @@ final class PostLoadManager {
|
||||
void addPostLoad(DeployBeanDescriptor<?> deployDesc) {
|
||||
for (BeanPostLoad c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
CoreLog.log.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
|
||||
CoreLog.log.log(DEBUG, "BeanPostLoad on[{0}] {1}", deployDesc.getFullName(), c.getClass().getName());
|
||||
deployDesc.addPostLoad(c);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -11,6 +11,8 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* Helper object to classify BeanProperties into appropriate lists.
|
||||
*/
|
||||
@@ -222,7 +224,7 @@ public final class DeployBeanPropertyLists {
|
||||
if (versionProperty == null) {
|
||||
versionProperty = prop;
|
||||
} else {
|
||||
CoreLog.internal.warn("Multiple @Version properties - property " + prop.fullName() + " not treated as a version property");
|
||||
CoreLog.internal.log(WARNING, "Multiple @Version properties - property " + prop.fullName() + " not treated as a version property");
|
||||
}
|
||||
} else if (prop.isDraftDirty()) {
|
||||
draftDirty = prop;
|
||||
|
||||
+3
-2
@@ -15,6 +15,7 @@ import io.ebeaninternal.server.deploy.meta.DeployTableJoinColumn;
|
||||
import io.ebeaninternal.server.query.SqlJoinType;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
/**
|
||||
* Read the deployment annotations for Associated One beans.
|
||||
@@ -213,10 +214,10 @@ final class AnnotationAssocOnes extends AnnotationAssoc {
|
||||
prop.setPrimaryKeyJoin(true);
|
||||
|
||||
if (!primaryKeyJoin.name().isEmpty()) {
|
||||
CoreLog.internal.info("Automatically determining join columns for @PrimaryKeyJoinColumn - ignoring PrimaryKeyJoinColumn.name attribute [{}] on {}", primaryKeyJoin.name(), prop.getFullBeanName());
|
||||
CoreLog.internal.log(Level.INFO, "Automatically determining join columns for @PrimaryKeyJoinColumn - ignoring PrimaryKeyJoinColumn.name attribute [{0}] on {1}", primaryKeyJoin.name(), prop.getFullBeanName());
|
||||
}
|
||||
if (!primaryKeyJoin.referencedColumnName().isEmpty()) {
|
||||
CoreLog.internal.info("Automatically determining join columns for @PrimaryKeyJoinColumn - Ignoring PrimaryKeyJoinColumn.referencedColumnName attribute [{}] on {}", primaryKeyJoin.referencedColumnName(), prop.getFullBeanName());
|
||||
CoreLog.internal.log(Level.INFO, "Automatically determining join columns for @PrimaryKeyJoinColumn - Ignoring PrimaryKeyJoinColumn.referencedColumnName attribute [{0}] on {1}", primaryKeyJoin.referencedColumnName(), prop.getFullBeanName());
|
||||
}
|
||||
BeanTable baseBeanTable = factory.beanTable(info.getDescriptor().getBeanType());
|
||||
String localPrimaryKey = baseBeanTable.getIdColumn();
|
||||
|
||||
@@ -32,6 +32,8 @@ import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
import static io.ebean.util.AnnotationUtil.typeGet;
|
||||
|
||||
/**
|
||||
@@ -65,7 +67,7 @@ final class AnnotationClass extends AnnotationParser {
|
||||
Column column = override.column();
|
||||
DeployBeanProperty beanProperty = descriptor.getBeanProperty(propertyName);
|
||||
if (beanProperty == null) {
|
||||
CoreLog.log.error("AttributeOverride property [" + propertyName + "] not found on " + descriptor.getFullName());
|
||||
CoreLog.log.log(Level.ERROR, "AttributeOverride property [" + propertyName + "] not found on " + descriptor.getFullName());
|
||||
} else {
|
||||
readColumn(column, beanProperty);
|
||||
}
|
||||
|
||||
+5
-4
@@ -11,6 +11,7 @@ import io.ebeaninternal.server.type.TypeManager;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Transient;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
@@ -84,7 +85,7 @@ public final class DeployCreateProperties {
|
||||
if (replaced != null && !replaced.isTransient()) {
|
||||
String msg = "Huh??? property " + prop.getFullBeanName() + " being defined twice";
|
||||
msg += " but replaced property was not transient? This is not expected?";
|
||||
CoreLog.log.warn(msg);
|
||||
CoreLog.log.log(Level.WARNING, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +112,7 @@ public final class DeployCreateProperties {
|
||||
return new DeployBeanPropertySimpleCollection(desc, targetType, manyType);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
CoreLog.internal.debug("expected non-scalar type {}", e.getMessage());
|
||||
CoreLog.internal.log(Level.DEBUG, "expected non-scalar type {0}", e.getMessage());
|
||||
}
|
||||
return new DeployBeanPropertyAssocMany(desc, targetType, manyType);
|
||||
}
|
||||
@@ -132,7 +133,7 @@ public final class DeployCreateProperties {
|
||||
// not supporting this field (generic type used)
|
||||
return null;
|
||||
}
|
||||
CoreLog.internal.warn("Could not find parameter type (via reflection) on " + desc.getFullName() + " " + field.getName());
|
||||
CoreLog.internal.log(Level.WARNING, "Could not find parameter type (via reflection) on " + desc.getFullName() + " " + field.getName());
|
||||
}
|
||||
return createManyType(desc, targetType, manyType);
|
||||
}
|
||||
@@ -151,7 +152,7 @@ public final class DeployCreateProperties {
|
||||
return new DeployBeanPropertyAssocOne(desc, propertyType);
|
||||
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.error("Error with " + desc + " field:" + field.getName(), e);
|
||||
CoreLog.log.log(Level.ERROR, "Error with " + desc + " field:" + field.getName(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.ebeaninternal.server.dto;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.type.TypeManager;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
@@ -39,7 +40,7 @@ final class DtoMetaBuilder {
|
||||
final String name = propertyName(method.getName());
|
||||
properties.add(new DtoMetaProperty(typeManager, dtoType, method, name));
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.debug("exclude on " + dtoType + " method " + method, e);
|
||||
CoreLog.log.log(Level.DEBUG, "exclude on " + dtoType + " method " + method, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +78,7 @@ final class DtoMetaBuilder {
|
||||
constructorList.add(new DtoMetaConstructor(typeManager, constructor, dtoType));
|
||||
} catch (Exception e) {
|
||||
// we don't want that constructor
|
||||
CoreLog.log.debug("exclude on " + dtoType + " constructor " + constructor, e);
|
||||
CoreLog.log.log(Level.DEBUG, "exclude on " + dtoType + " constructor " + constructor, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-8
@@ -1,9 +1,8 @@
|
||||
package io.ebeaninternal.server.executor;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@@ -14,7 +13,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
final class DaemonExecutorService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DaemonExecutorService.class);
|
||||
private static final System.Logger logger = AppLog.getLogger(DaemonExecutorService.class);
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock(false);
|
||||
private final String namePrefix;
|
||||
@@ -44,19 +43,19 @@ final class DaemonExecutorService {
|
||||
lock.lock();
|
||||
try {
|
||||
if (service.isShutdown()) {
|
||||
logger.debug("DaemonExecutorService[{}] already shut down", namePrefix);
|
||||
logger.log(Level.DEBUG, "DaemonExecutorService[{0}] already shut down", namePrefix);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
logger.debug("DaemonExecutorService[{}] shutting down...", namePrefix);
|
||||
logger.log(Level.DEBUG, "DaemonExecutorService[{0}] shutting down...", namePrefix);
|
||||
service.shutdown();
|
||||
if (!service.awaitTermination(shutdownWaitSeconds, TimeUnit.SECONDS)) {
|
||||
logger.info("DaemonExecutorService[{}] shut down timeout exceeded. Terminating running threads.", namePrefix);
|
||||
logger.log(Level.INFO, "DaemonExecutorService[{0}] shut down timeout exceeded. Terminating running threads.", namePrefix);
|
||||
service.shutdownNow();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during shutdown of DaemonThreadPool[" + namePrefix + "]", e);
|
||||
logger.log(Level.ERROR, "Error during shutdown of DaemonThreadPool[" + namePrefix + "]", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
|
||||
+7
-7
@@ -1,8 +1,8 @@
|
||||
package io.ebeaninternal.server.executor;
|
||||
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -12,7 +12,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public final class DaemonScheduleThreadPool extends ScheduledThreadPoolExecutor {
|
||||
|
||||
private static final Logger log = CoreLog.log;
|
||||
private static final System.Logger log = CoreLog.log;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final String namePrefix;
|
||||
@@ -38,19 +38,19 @@ public final class DaemonScheduleThreadPool extends ScheduledThreadPoolExecutor
|
||||
lock.lock();
|
||||
try {
|
||||
if (super.isShutdown()) {
|
||||
log.debug("Already shutdown threadPool {}", namePrefix);
|
||||
log.log(Level.DEBUG, "Already shutdown threadPool {0}", namePrefix);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
log.trace("shutting down threadPool {}", namePrefix);
|
||||
log.log(Level.TRACE, "shutting down threadPool {0}", namePrefix);
|
||||
super.shutdown();
|
||||
if (!super.awaitTermination(shutdownWaitSeconds, TimeUnit.SECONDS)) {
|
||||
log.info("Shutdown wait timeout exceeded. Terminating running threads for {}", namePrefix);
|
||||
log.log(Level.INFO, "Shutdown wait timeout exceeded. Terminating running threads for {0}", namePrefix);
|
||||
super.shutdownNow();
|
||||
}
|
||||
log.trace("shutdown complete for threadPool {}", namePrefix);
|
||||
log.log(Level.TRACE, "shutdown complete for threadPool {0}", namePrefix);
|
||||
} catch (Exception e) {
|
||||
log.error("Error during shutdown of threadPool " + namePrefix, e);
|
||||
log.log(Level.ERROR, "Error during shutdown of threadPool " + namePrefix, e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
|
||||
+12
-13
@@ -1,21 +1,20 @@
|
||||
package io.ebeaninternal.server.executor;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.ebean.config.BackgroundExecutorWrapper;
|
||||
import io.ebeaninternal.api.SpiBackgroundExecutor;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The default implementation of the BackgroundExecutor.
|
||||
*/
|
||||
@NonNullApi
|
||||
public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.BackgroundExecutor");
|
||||
private static final System.Logger log = AppLog.getLogger("io.ebean.BackgroundExecutor");
|
||||
|
||||
private final ScheduledExecutorService schedulePool;
|
||||
private final DaemonExecutorService pool;
|
||||
@@ -28,7 +27,7 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
this.schedulePool = new DaemonScheduleThreadPool(schedulePoolSize, shutdownWaitSeconds, namePrefix + "-periodic-");
|
||||
this.pool = new DaemonExecutorService(shutdownWaitSeconds, namePrefix);
|
||||
this.wrapper = wrapper;
|
||||
log.debug("Created backgroundExecutor {} (schedulePoolSize={}, shutdownWaitSeconds={})", namePrefix, schedulePoolSize, shutdownWaitSeconds);
|
||||
log.log(Level.DEBUG, "Created backgroundExecutor {0} (schedulePoolSize={1}, shutdownWaitSeconds={2})", namePrefix, schedulePoolSize, shutdownWaitSeconds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,20 +58,20 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
* This is used in methods that accepts a <code>Runnable</code> and return
|
||||
* either <code>void</code> or <code>ScheduledFuture</code>, as there is
|
||||
* normally no Future.get() call.
|
||||
*
|
||||
* <p>
|
||||
* Note: When submitting a <code>Callable</code>, you must check
|
||||
* <code>Future.get()</code> for exceptions.
|
||||
*/
|
||||
private Runnable logExceptions(Runnable task) {
|
||||
long queued = System.nanoTime();
|
||||
log.trace("Queued {}", task);
|
||||
log.log(Level.TRACE, "Queued {0}", task);
|
||||
return () -> {
|
||||
try {
|
||||
if (log.isTraceEnabled()) {
|
||||
if (log.isLoggable(Level.TRACE)) {
|
||||
long start = System.nanoTime();
|
||||
log.trace("Start {} (delay time {} us)", task, (start - queued) / 1000L);
|
||||
log.log(Level.TRACE, "Start {0} (delay time {1} us)", task, (start - queued) / 1000L);
|
||||
task.run();
|
||||
log.trace("Stop {} (exec time {} us)", task, (System.nanoTime() - start) / 1000L);
|
||||
log.log(Level.TRACE, "Stop {0} (exec time {1} us)", task, (System.nanoTime() - start) / 1000L);
|
||||
} else {
|
||||
task.run();
|
||||
}
|
||||
@@ -80,7 +79,7 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
// log any exception here. Note they will not bubble up to the calling user
|
||||
// unless Future.get() is checked. (Which is almost never done on scheduled
|
||||
// background executions)
|
||||
log.error("Error while executing the task {}", task, t);
|
||||
log.log(Level.ERROR, "Error while executing the task " + task, t);
|
||||
throw t;
|
||||
}
|
||||
};
|
||||
@@ -128,10 +127,10 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
log.trace("BackgroundExecutor shutting down");
|
||||
log.log(Level.TRACE, "BackgroundExecutor shutting down");
|
||||
schedulePool.shutdown();
|
||||
pool.shutdown();
|
||||
log.debug("BackgroundExecutor stopped");
|
||||
log.log(Level.DEBUG, "BackgroundExecutor stopped");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.ebeaninternal.server.idgen;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.*;
|
||||
@@ -8,12 +9,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* IdGenerator for java util UUID.
|
||||
*
|
||||
* <p>
|
||||
* It extends the UuidV1RndIdGenerator so that it can generate rfc4122 compliant Type 1 UUIDs.
|
||||
*
|
||||
* <p>
|
||||
* This generator produces real Type 1 UUIDs (best for sqlserver) - You should use this generator only,
|
||||
* if you can guarantee, that mac addess is uniqe or specify 'ebean.uuidNodeId' in your config file.
|
||||
*
|
||||
*/
|
||||
public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
* Returns an instance for given file.
|
||||
*/
|
||||
public static UuidV1IdGenerator getInstance(File file, String nodeId) {
|
||||
return INSTANCES.computeIfAbsent(file, f ->new UuidV1IdGenerator(f, nodeId == null ? null : nodeId.toLowerCase()));
|
||||
return INSTANCES.computeIfAbsent(file, f -> new UuidV1IdGenerator(f, nodeId == null ? null : nodeId.toLowerCase()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
|
||||
/**
|
||||
* Find hardware ID.
|
||||
*
|
||||
* <p>
|
||||
* We check all non-loopback networkinterfaces for valid hardwareAddresses
|
||||
* We prefer to take the first non virtual "up" device. If no device (with valid addr) is up,
|
||||
* we take the first down device.
|
||||
@@ -71,21 +71,18 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
while (e.hasMoreElements()) {
|
||||
NetworkInterface network = e.nextElement();
|
||||
try {
|
||||
log.trace("Probing interface {}", network);
|
||||
if (!network.isLoopback()) {
|
||||
byte[] addr = network.getHardwareAddress();
|
||||
if (validAddr(addr)) {
|
||||
if (network.isUp() && !network.isVirtual()) {
|
||||
log.debug("Using interface {}", network);
|
||||
return addr;
|
||||
} else if (fallbackAddr == null) {
|
||||
log.debug("Using interface {} as fallback", network);
|
||||
fallbackAddr = addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
log.debug("Skipping {}", network, ex);
|
||||
log.log(Level.DEBUG, "Skipping " + network, ex);
|
||||
}
|
||||
}
|
||||
return fallbackAddr;
|
||||
@@ -98,7 +95,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
if (addr != null && addr.length >= 6) { // valid addr has 6 bytes
|
||||
// check if vendor is != 0x000000 or 0xFFFFFF
|
||||
return (addr[0] != 0x00 && addr[1] != 0x00 && addr[2] != 0x00)
|
||||
||(addr[0] != 0xFF && addr[1] != 0xFF && addr[2] != 0xFF);
|
||||
|| (addr[0] != 0xFF && addr[1] != 0xFF && addr[2] != 0xFF);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -122,7 +119,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
// See, if there is an alternative MAC address set.
|
||||
nodeId = parseAlternativeNodeId(altNodeId);
|
||||
restoreState();
|
||||
log.info("Explicitly using ID {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(Level.INFO, "Explicitly using ID {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
}
|
||||
UUID uuid = nextId(null);
|
||||
long ts = timeStamp.get();
|
||||
@@ -130,9 +127,9 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
ts /= MILLIS_TO_UUID;
|
||||
|
||||
saveState();
|
||||
log.debug("Saved state: clockSeq {}, timestamp {}, uuid {}, stateFile: {})", clockSeq.get(), new Date(ts), uuid, stateFile);
|
||||
log.log(Level.DEBUG, "Saved state: clockSeq {0}, timestamp {1}, uuid {2}, stateFile: {3})", clockSeq.get(), new Date(ts), uuid, stateFile);
|
||||
} catch (IOException e) {
|
||||
log.error("There was a problem while detecting the nodeId. Falling back to random mode. Try using to specify 'ebean.uuidNodeId' property", e);
|
||||
log.log(Level.ERROR, "There was a problem while detecting the nodeId. Falling back to random mode. Try using to specify 'ebean.uuidNodeId' property", e);
|
||||
useRandomMode();
|
||||
}
|
||||
}
|
||||
@@ -141,7 +138,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
* Tries to initialize the generator by retrieving the MAC address from
|
||||
* hardware. If there is no suitable network interface found, it will fall back
|
||||
* to "generate" mode.
|
||||
*
|
||||
*
|
||||
* @throws IOException if state file is not readable or tryGenerateMode also
|
||||
* fails.
|
||||
*/
|
||||
@@ -149,16 +146,16 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
try {
|
||||
nodeId = getHardwareId();
|
||||
} catch (IOException e) {
|
||||
log.error("Error while reading MAC address. Fall back to 'generate' mode", e);
|
||||
log.log(Level.ERROR, "Error while reading MAC address. Fall back to 'generate' mode", e);
|
||||
tryGenerateMode();
|
||||
}
|
||||
|
||||
if (nodeId != null) {
|
||||
restoreState();
|
||||
log.info("Using MAC {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(Level.INFO, "Using MAC {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
return;
|
||||
}
|
||||
log.warn("No suitable network interface found. Fall back to 'generate' mode");
|
||||
log.log(Level.WARNING, "No suitable network interface found. Fall back to 'generate' mode");
|
||||
tryGenerateMode();
|
||||
}
|
||||
|
||||
@@ -168,11 +165,11 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
*/
|
||||
private void tryGenerateMode() throws IOException {
|
||||
if (restoreState()) {
|
||||
log.info("Using recently generated nodeId {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(Level.INFO, "Using recently generated nodeId {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
} else {
|
||||
// RFC 4.5 use random portion for node
|
||||
nodeId = super.getNodeIdBytes();
|
||||
log.info("Using a newly generated nodeId {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(Level.INFO, "Using a newly generated nodeId {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +180,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
private void useRandomMode() {
|
||||
canSaveState = false;
|
||||
nodeId = super.getNodeIdBytes();
|
||||
log.info("Explicitly using a new random ID {} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(Level.INFO, "Explicitly using a new random ID {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +203,6 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
private boolean restoreState() throws IOException {
|
||||
Properties prop = new Properties();
|
||||
if (!stateFile.exists()) {
|
||||
log.debug("State file '{}' does not exist", stateFile);
|
||||
return false;
|
||||
}
|
||||
try (InputStream is = new FileInputStream(stateFile)) {
|
||||
@@ -215,28 +211,27 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
|
||||
String propNodeId = prop.getProperty("nodeId");
|
||||
if (propNodeId == null || propNodeId.isEmpty()) {
|
||||
log.warn("State file '{}' is incomplete", stateFile);
|
||||
log.log(Level.WARNING, "State file '{0}' is incomplete", stateFile);
|
||||
return false; // we cannot restore
|
||||
}
|
||||
try {
|
||||
if (nodeId == null) {
|
||||
nodeId = parseAlternativeNodeId(propNodeId);
|
||||
} else if (!getNodeIdentifier().equals(propNodeId)) {
|
||||
log.warn(
|
||||
"The nodeId in the state file '{}' has changed from {} to {}. "
|
||||
+ "This can happen when MAC address changes or when two containers share the same state file",
|
||||
stateFile, propNodeId, getNodeIdentifier());
|
||||
log.log(Level.WARNING,
|
||||
"The nodeId in the state file '{0}' has changed from {1} to {2}. "
|
||||
+ "This can happen when MAC address changes or when two containers share the same state file",
|
||||
stateFile, propNodeId, getNodeIdentifier());
|
||||
return false;
|
||||
}
|
||||
Integer seq = Integer.valueOf(prop.getProperty("clockSeq")) & 0x3FFF;
|
||||
Long ts = Long.valueOf(prop.getProperty("timeStamp"));
|
||||
clockSeq.set(seq);
|
||||
timeStamp.set(ts);
|
||||
log.debug("State successfully restored: {}", prop);
|
||||
return true;
|
||||
|
||||
|
||||
} catch (IllegalArgumentException nfe) {
|
||||
log.error("State file '{}' is corrupt", stateFile, nfe);
|
||||
log.log(Level.ERROR, "State file corrupt: " + stateFile, nfe);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -259,9 +254,8 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
}
|
||||
try (OutputStream os = new FileOutputStream(stateFile)) {
|
||||
prop.store(os, "ebean uuid state file");
|
||||
log.debug("Persisted state to '{}'", stateFile);
|
||||
} catch (IOException e) {
|
||||
log.error("Could not persist uuid state to '{}'", stateFile, e);
|
||||
log.log(Level.ERROR, "Could not persist uuid state to: " + stateFile, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package io.ebeaninternal.server.idgen;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.config.dbplatform.PlatformIdGenerator;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* IdGenerator for (pseudo) type 1 UUIDs.
|
||||
*
|
||||
@@ -27,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public class UuidV1RndIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
protected static final Logger log = LoggerFactory.getLogger("io.ebean.IDGEN");
|
||||
protected static final System.Logger log = AppLog.getLogger("io.ebean.IDGEN");
|
||||
|
||||
// UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
|
||||
protected static final long UUID_EPOCH_OFFSET = 0x01B21DD213814000L;
|
||||
@@ -106,7 +105,7 @@ public class UuidV1RndIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
delta = current - last;
|
||||
if (delta < -10000 * 20000) {
|
||||
log.info("Clock skew of {} ms detected", delta / -10000);
|
||||
log.log(Level.INFO, "Clock skew of {} ms detected", delta / -10000);
|
||||
// The clock was adjusted back about 2 seconds, or we were generating a lot of ids too fast
|
||||
// if so, we try to set the current as last and also increment the clockSeq.
|
||||
lock.lock();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ebeaninternal.server.logger;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebeaninternal.api.SpiLogger;
|
||||
import io.ebeaninternal.api.SpiLoggerFactory;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Default SpiLoggerFactory implementation.
|
||||
@@ -14,6 +14,6 @@ public final class DLoggerFactory implements SpiLoggerFactory {
|
||||
*/
|
||||
@Override
|
||||
public SpiLogger create(String name) {
|
||||
return new DSpiLogger(LoggerFactory.getLogger(name));
|
||||
return new DSpiLogger(AppLog.getLogger(name));
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,34 @@
|
||||
package io.ebeaninternal.server.logger;
|
||||
|
||||
import io.ebeaninternal.api.SpiLogger;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
final class DSpiLogger implements SpiLogger {
|
||||
|
||||
private final Logger logger;
|
||||
private final System.Logger logger;
|
||||
|
||||
DSpiLogger(Logger logger) {
|
||||
DSpiLogger(System.Logger logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebug() {
|
||||
return logger.isDebugEnabled();
|
||||
return logger.isLoggable(Level.DEBUG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrace() {
|
||||
return logger.isTraceEnabled();
|
||||
return logger.isLoggable(Level.TRACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String msg) {
|
||||
logger.debug(msg);
|
||||
logger.log(Level.DEBUG, msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(String msg) {
|
||||
logger.trace(msg);
|
||||
logger.log(Level.TRACE, msg);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import io.ebeaninternal.api.SpiTransaction;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@@ -135,7 +136,7 @@ public final class BatchedPstmt implements SpiProfileTransactionEvent {
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.warn("BatchedPstmt Error closing statement", e);
|
||||
CoreLog.log.log(Level.WARNING, "BatchedPstmt Error closing statement", e);
|
||||
} finally {
|
||||
pstmt = null;
|
||||
}
|
||||
@@ -201,7 +202,7 @@ public final class BatchedPstmt implements SpiProfileTransactionEvent {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.warn("BatchedPstmt Error closing inputStream ", e);
|
||||
CoreLog.log.log(Level.WARNING, "BatchedPstmt Error closing inputStream ", e);
|
||||
}
|
||||
}
|
||||
inputStreams = null;
|
||||
|
||||
@@ -12,6 +12,7 @@ import io.ebeaninternal.server.persist.platform.MultiValueBind;
|
||||
import io.ebeaninternal.server.type.*;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.util.Collection;
|
||||
@@ -132,7 +133,7 @@ public final class Binder {
|
||||
}
|
||||
|
||||
} catch (SQLException ex) {
|
||||
CoreLog.log.warn("error binding parameter [{}][{}]", (dataBind.currentPos() - 1), value);
|
||||
CoreLog.log.log(Level.WARNING, "error binding parameter [{0}][{1}]", (dataBind.currentPos() - 1), value);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.persist;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.*;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollection.ModifyListenMode;
|
||||
@@ -11,9 +12,8 @@ import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.server.core.*;
|
||||
import io.ebeaninternal.server.core.PersistRequest.Type;
|
||||
import io.ebeaninternal.server.deploy.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
@@ -33,8 +33,8 @@ import java.util.*;
|
||||
*/
|
||||
public final class DefaultPersister implements Persister {
|
||||
|
||||
private static final Logger PUB = LoggerFactory.getLogger("io.ebean.PUB");
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger PUB = AppLog.getLogger("io.ebean.PUB");
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
/**
|
||||
* Actually does the persisting work.
|
||||
@@ -143,7 +143,7 @@ public final class DefaultPersister implements Persister {
|
||||
DraftHandler<T> draftHandler = new DraftHandler<>(desc, transaction);
|
||||
|
||||
List<T> liveBeans = draftHandler.fetchSourceBeans(query, false);
|
||||
PUB.debug("draftRestore [{}] count[{}]", desc.name(), liveBeans.size());
|
||||
PUB.log(Level.DEBUG, "draftRestore [{0}] count[{1}]", desc.name(), liveBeans.size());
|
||||
if (liveBeans.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -156,11 +156,11 @@ public final class DefaultPersister implements Persister {
|
||||
// reset @DraftDirty and @DraftReset properties
|
||||
draftHandler.resetDraft(draftBean);
|
||||
|
||||
PUB.trace("draftRestore bean [{}] id[{}]", desc.name(), draftHandler.getId());
|
||||
PUB.log(Level.TRACE, "draftRestore bean [{0}] id[{1}]", desc.name(), draftHandler.getId());
|
||||
update(createRequest(draftBean, transaction, null, mgr, Type.UPDATE, Flags.RECURSE));
|
||||
}
|
||||
|
||||
PUB.debug("draftRestore - complete for [{}]", desc.name());
|
||||
PUB.log(Level.DEBUG, "draftRestore - complete for [{0}]", desc.name());
|
||||
return draftHandler.getDrafts();
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public final class DefaultPersister implements Persister {
|
||||
DraftHandler<T> draftHandler = new DraftHandler<>(desc, transaction);
|
||||
|
||||
List<T> draftBeans = draftHandler.fetchSourceBeans(query, true);
|
||||
PUB.debug("publish [{}] count[{}]", desc.name(), draftBeans.size());
|
||||
PUB.log(Level.DEBUG, "publish [{0}] count[{1}]", desc.name(), draftBeans.size());
|
||||
if (draftBeans.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public final class DefaultPersister implements Persister {
|
||||
draftHandler.resetDraft(draftBean);
|
||||
|
||||
Type persistType = draftHandler.isInsert() ? Type.INSERT : Type.UPDATE;
|
||||
PUB.trace("publish bean [{}] id[{}] type[{}]", desc.name(), draftHandler.getId(), persistType);
|
||||
PUB.log(Level.TRACE, "publish bean [{0}] id[{1}] type[{2}]", desc.name(), draftHandler.getId(), persistType);
|
||||
|
||||
PersistRequestBean<T> request = createRequest(liveBean, transaction, null, mgr, persistType, Flags.PUBLISH_RECURSE);
|
||||
if (persistType == Type.INSERT) {
|
||||
@@ -214,7 +214,7 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
|
||||
draftHandler.updateDrafts(transaction, mgr);
|
||||
PUB.debug("publish - complete for [{}]", desc.name());
|
||||
PUB.log(Level.DEBUG, "publish - complete for [{0}]", desc.name());
|
||||
return livePublish;
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ public final class DefaultPersister implements Persister {
|
||||
void updateDrafts(Transaction transaction, BeanManager<T> mgr) {
|
||||
if (!draftUpdates.isEmpty()) {
|
||||
// update the dirty status on the drafts that have been published
|
||||
PUB.debug("publish - update dirty status on [{}] drafts", draftUpdates.size());
|
||||
PUB.log(Level.DEBUG, "publish - update dirty status on [{0}] drafts", draftUpdates.size());
|
||||
for (T draftUpdate : draftUpdates) {
|
||||
update(createRequest(draftUpdate, transaction, null, mgr, Type.UPDATE, Flags.ZERO));
|
||||
}
|
||||
@@ -491,8 +491,8 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
if (request.isDirty()) {
|
||||
request.executeOrQueue();
|
||||
} else if (log.isDebugEnabled()) {
|
||||
log.debug("Update skipped as bean is unchanged: {}", request.bean());
|
||||
} else if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "Update skipped as bean is unchanged: {0}", request.bean());
|
||||
}
|
||||
if (request.isPersistCascade()) {
|
||||
// save all the beans in assocMany's after
|
||||
@@ -538,8 +538,8 @@ public final class DefaultPersister implements Persister {
|
||||
if (req.isRegisteredForDeleteBean()) {
|
||||
// skip deleting bean. Used where cascade is on
|
||||
// both sides of a relationship
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("skipping delete on alreadyRegistered {}", req.bean());
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "skipping delete on alreadyRegistered {0}", req.bean());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
/**
|
||||
* Base for saving entity bean collections and element collections.
|
||||
@@ -71,7 +72,7 @@ abstract class SaveManyBase implements SaveMany {
|
||||
String asJson = many.jsonWriteCollection(value);
|
||||
request.addCollectionChange(many.name(), asJson);
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.error("Error build element collection entry for L2 cache", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error build element collection entry for L2 cache", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
if (transaction.isLogSummary()) {
|
||||
transaction.logSummary(m);
|
||||
}
|
||||
CoreLog.log.warn(m);
|
||||
CoreLog.log.log(System.Logger.Level.WARNING, m);
|
||||
} else {
|
||||
if (!many.hasImportedId(otherBean)) {
|
||||
throw new PersistenceException("ManyToMany bean " + otherBean + " does not have an Id value.");
|
||||
|
||||
@@ -15,6 +15,8 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Base class for Handler implementations.
|
||||
*/
|
||||
@@ -123,7 +125,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
|
||||
dataBind.close();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
CoreLog.log.error(null, ex);
|
||||
CoreLog.log.log(ERROR, "Error closing DataBind", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* An object that represents a SqlSelect statement.
|
||||
* <p>
|
||||
@@ -344,7 +346,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
auditIterateLogMessage();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
CoreLog.log.error("Error logging read audit logs", e);
|
||||
CoreLog.log.log(ERROR, "Error logging read audit logs", e);
|
||||
}
|
||||
try {
|
||||
if (dataReader != null) {
|
||||
@@ -352,7 +354,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
dataReader = null;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.error("Error closing dataReader", e);
|
||||
CoreLog.log.log(ERROR, "Error closing dataReader", e);
|
||||
}
|
||||
JdbcClose.close(pstmt);
|
||||
pstmt = null;
|
||||
@@ -548,7 +550,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
}
|
||||
transaction().profileEvent(this);
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.error("Error updating execution statistics", e);
|
||||
CoreLog.log.log(ERROR, "Error updating execution statistics", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,16 +11,14 @@ import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import io.ebean.util.StringHelper;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.DiffHelp;
|
||||
import io.ebeaninternal.server.core.OrmQueryRequest;
|
||||
import io.ebeaninternal.server.core.SpiResultSet;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.util.Str;
|
||||
import io.ebeaninternal.server.persist.Binder;
|
||||
import org.slf4j.Logger;
|
||||
import io.ebeaninternal.server.util.Str;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.ResultSet;
|
||||
@@ -32,7 +30,6 @@ import java.util.*;
|
||||
*/
|
||||
public final class CQueryEngine {
|
||||
|
||||
private static final Logger log = CoreLog.log;
|
||||
private static final String T0 = "t0";
|
||||
|
||||
private final int defaultFetchSizeFindList;
|
||||
@@ -195,7 +192,6 @@ public final class CQueryEngine {
|
||||
}
|
||||
if (!cquery.prepareBindExecuteQueryForwardOnly(forwardOnlyHintOnFindIterate)) {
|
||||
// query has been cancelled already
|
||||
log.trace("Future fetch already cancelled");
|
||||
return null;
|
||||
}
|
||||
if (request.logSql()) {
|
||||
@@ -349,7 +345,6 @@ public final class CQueryEngine {
|
||||
}
|
||||
if (!cquery.prepareBindExecuteQuery()) {
|
||||
// query has been cancelled already
|
||||
log.trace("Future fetch already cancelled");
|
||||
return null;
|
||||
}
|
||||
if (request.logSql()) {
|
||||
|
||||
+3
-1
@@ -19,6 +19,8 @@ import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Base compiled query request for single attribute queries.
|
||||
*/
|
||||
@@ -153,7 +155,7 @@ final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, Ca
|
||||
dataReader = null;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.error("Error closing DataReader", e);
|
||||
CoreLog.log.log(ERROR, "Error closing DataReader", e);
|
||||
}
|
||||
JdbcClose.close(pstmt);
|
||||
pstmt = null;
|
||||
|
||||
@@ -23,6 +23,8 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Represents a query for a given SQL statement.
|
||||
* <p>
|
||||
@@ -313,7 +315,7 @@ public class CQueryPlan implements SpiQueryPlan {
|
||||
predicates.bind(capture);
|
||||
bindCapture.setBind(capture.bindCapture(), executionTimeMicros, startNanos);
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.error("Error capturing bind values", e);
|
||||
CoreLog.log.log(ERROR, "Error capturing bind values", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.server.transaction.TransactionManager;
|
||||
import io.ebeaninternal.server.type.bindcapture.BindCapture;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
@@ -64,7 +65,7 @@ public final class CQueryPlanManager implements QueryPlanManager {
|
||||
}
|
||||
return req.plans();
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.error("Error during query plan collection", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error during query plan collection", e);
|
||||
return emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* Compile Query Predicates.
|
||||
* <p>
|
||||
@@ -339,7 +341,7 @@ public final class CQueryPredicates {
|
||||
msg += "] with an incorrect orderBy [" + orderBy + "]. The id property [" + orderById + "]";
|
||||
msg += " must come before the many property [" + manyProp.name() + "] in the orderBy.";
|
||||
msg += " Ebean has automatically modified the orderBy clause to do this.";
|
||||
CoreLog.log.warn(msg);
|
||||
CoreLog.log.log(WARNING, msg);
|
||||
}
|
||||
// the id needs to come before the manyPropName
|
||||
orderBy = orderBy.substring(0, manyPos) + orderById + ", " + orderBy.substring(manyPos);
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* A QueryPlanLogger that prefixes "EXPLAIN " to the query. This works for Postgres, H2 and MySql.
|
||||
*/
|
||||
@@ -23,7 +25,7 @@ public final class QueryPlanLoggerExplain extends QueryPlanLogger {
|
||||
return readQueryPlan(plan, bind, rset);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.warn("Could not log query plan", e);
|
||||
CoreLog.log.log(WARNING, "Could not log query plan", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* A QueryPlanLogger for oracle.
|
||||
*
|
||||
@@ -30,7 +32,7 @@ public final class QueryPlanLoggerOracle extends QueryPlanLogger {
|
||||
return readQueryPlan(plan, bind, rset);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.warn("Could not log query plan", e);
|
||||
CoreLog.log.log(WARNING, "Could not log query plan", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* A QueryPlanLogger for Postgres that prefixes "EXPLAIN ANALYZE" to the query.
|
||||
*/
|
||||
@@ -24,7 +26,7 @@ public final class QueryPlanLoggerPostgres extends QueryPlanLogger {
|
||||
return readQueryPlanBasic(plan, bind, rset);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.warn("Could not log query plan: " + explain, e);
|
||||
CoreLog.log.log(WARNING, "Could not log query plan: " + explain, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -11,6 +11,8 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* A QueryPlanLogger for SqlServer. It will return the plan as XML, which can be opened in
|
||||
* Microsoft SQL Server Management Studio.
|
||||
@@ -42,13 +44,13 @@ public final class QueryPlanLoggerSqlServer extends QueryPlanLogger {
|
||||
return createPlan(plan, bind.toString(), xml);
|
||||
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.warn("Could not log query plan", e);
|
||||
CoreLog.log.log(WARNING, "Could not log query plan", e);
|
||||
return null;
|
||||
} finally {
|
||||
stmt.execute("set statistics xml off");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.warn("Could not log query plan", e);
|
||||
CoreLog.log.log(WARNING, "Could not log query plan", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,23 +11,16 @@ import io.ebeaninternal.server.deploy.InheritInfo;
|
||||
import io.ebeaninternal.server.deploy.TableJoin;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Factory for SqlTree.
|
||||
*/
|
||||
public final class SqlTreeBuilder {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final SpiQuery<?> query;
|
||||
private final STreeType desc;
|
||||
@@ -92,10 +85,10 @@ public final class SqlTreeBuilder {
|
||||
this.disableLazyLoad = query.isDisableLazyLoading();
|
||||
this.readOnly = Boolean.TRUE.equals(query.isReadOnly());
|
||||
this.subQuery = Type.SQ_EXISTS == query.getType()
|
||||
|| Type.SQ_IN == query.getType()
|
||||
|| Type.ID_LIST == query.getType()
|
||||
|| Type.DELETE == query.getType()
|
||||
|| query.isCountDistinct();
|
||||
|| Type.SQ_IN == query.getType()
|
||||
|| Type.ID_LIST == query.getType()
|
||||
|| Type.DELETE == query.getType()
|
||||
|| query.isCountDistinct();
|
||||
this.includeJoin = query.getM2mIncludeJoin();
|
||||
this.manyWhereJoins = query.getManyWhereJoins();
|
||||
this.queryDetail = query.getDetail();
|
||||
@@ -392,7 +385,7 @@ public final class SqlTreeBuilder {
|
||||
private void addPropertyToSubQuery(SqlTreeProperties selectProps, STreeType desc, String propName, String path) {
|
||||
STreeProperty p = desc.findPropertyWithDynamic(propName, path);
|
||||
if (p == null) {
|
||||
log.error("property [" + propName + "]not found on " + desc + " for query - excluding it.");
|
||||
log.log(Level.ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
return;
|
||||
} else if (p instanceof STreePropertyAssoc && p.isEmbedded()) {
|
||||
// if the property is embedded we need to lookup the real column name
|
||||
@@ -427,13 +420,13 @@ public final class SqlTreeBuilder {
|
||||
if (p != null) {
|
||||
selectProps.add(p);
|
||||
} else {
|
||||
log.error("property [" + propName + "] not found on " + desc + " for query - excluding it.");
|
||||
log.log(Level.ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
}
|
||||
} else if (p.isEmbedded() || (p instanceof STreePropertyAssoc && !queryProps.isIncludedBeanJoin(p.name()))) {
|
||||
// add the embedded bean or the *ToOne assoc bean. We skip the check that the *ToOne propName maps to Id property ...
|
||||
selectProps.add(p);
|
||||
} else {
|
||||
log.error("property [" + p.fullName() + "] expected to be an embedded or *ToOne bean for query - excluding it.");
|
||||
log.log(Level.ERROR, "property [{0}] expected to be an embedded or *ToOne bean for query - excluding it.", p.fullName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +435,7 @@ public final class SqlTreeBuilder {
|
||||
// sub class hierarchy if required
|
||||
STreeProperty p = desc.findPropertyWithDynamic(propName, queryProps.getPath());
|
||||
if (p == null) {
|
||||
log.error("property [" + propName + "] not found on " + desc + " for query - excluding it.");
|
||||
log.log(Level.ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
p = desc.findProperty("id");
|
||||
selectProps.add(p);
|
||||
|
||||
@@ -542,9 +535,6 @@ public final class SqlTreeBuilder {
|
||||
if (queryDetail.includesPath(propName)) {
|
||||
if (manyProperty != null) {
|
||||
// only one many associated allowed to be included in fetch
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Not joining [" + propName + "] as already joined to a Many[" + manyProperty + "].");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
manyProperty = manyProp;
|
||||
@@ -559,7 +549,6 @@ public final class SqlTreeBuilder {
|
||||
* Return true if this node is FULLY included resulting in table join. If the
|
||||
* node is not included but its parent has been included then a "bean proxy"
|
||||
* is added and false is returned.
|
||||
* </p>
|
||||
*/
|
||||
private boolean isIncludeBean(String prefix) {
|
||||
if (queryDetail.includesPath(prefix)) {
|
||||
|
||||
+10
-10
@@ -1,17 +1,17 @@
|
||||
package io.ebeaninternal.server.readaudit;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.event.readaudit.ReadAuditLogger;
|
||||
import io.ebean.event.readaudit.ReadAuditQueryPlan;
|
||||
import io.ebean.event.readaudit.ReadEvent;
|
||||
import io.ebean.text.json.EJson;
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -19,8 +19,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class DefaultReadAuditLogger implements ReadAuditLogger {
|
||||
|
||||
private static final Logger queryLogger = LoggerFactory.getLogger("io.ebean.ReadAuditQuery");
|
||||
private static final Logger auditLogger = LoggerFactory.getLogger("io.ebean.ReadAudit");
|
||||
private static final System.Logger queryLogger = AppLog.getLogger("io.ebean.ReadAuditQuery");
|
||||
private static final System.Logger auditLogger = AppLog.getLogger("io.ebean.ReadAudit");
|
||||
|
||||
protected final JsonFactory jsonFactory = new JsonFactory();
|
||||
protected int defaultQueryBuffer = 500;
|
||||
@@ -48,9 +48,9 @@ public class DefaultReadAuditLogger implements ReadAuditLogger {
|
||||
}
|
||||
gen.writeEndObject();
|
||||
gen.flush();
|
||||
queryLogger.info(writer.toString());
|
||||
queryLogger.log(Level.INFO, writer.toString());
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.error("Error writing Read audit event", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error writing Read audit event", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ public class DefaultReadAuditLogger implements ReadAuditLogger {
|
||||
StringWriter writer = new StringWriter(defaultReadBuffer);
|
||||
JsonGenerator gen = jsonFactory.createGenerator(writer);
|
||||
writeDetails(gen, event);
|
||||
auditLogger.info(writer.toString());
|
||||
auditLogger.log(Level.INFO, writer.toString());
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.error("Error writing Read audit event", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error writing Read audit event", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-12
@@ -7,9 +7,11 @@ import io.ebean.plugin.SpiServer;
|
||||
import io.ebean.util.IOUtils;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiProfileHandler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
@@ -31,8 +33,9 @@ import static java.time.temporal.ChronoField.*;
|
||||
*/
|
||||
public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
private static final DateTimeFormatter DTF;
|
||||
|
||||
static {
|
||||
DTF = new DateTimeFormatterBuilder()
|
||||
.parseCaseInsensitive()
|
||||
@@ -76,7 +79,7 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
this.executor = Executors.newSingleThreadExecutor();
|
||||
this.dir = new File(config.getDirectory());
|
||||
if (!dir.exists() && !dir.mkdirs()) {
|
||||
log.error("failed to mkdirs " + dir.getAbsolutePath());
|
||||
log.log(Level.ERROR, "failed to mkdirs " + dir.getAbsolutePath());
|
||||
}
|
||||
incrementFile();
|
||||
}
|
||||
@@ -106,7 +109,7 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
out.close();
|
||||
out = null;
|
||||
} catch (IOException e) {
|
||||
log.error("Failed to flush and close transaction profiling file ", e);
|
||||
log.log(Level.ERROR, "Failed to flush and close transaction profiling file ", e);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -126,7 +129,7 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
File file = new File(dir, "txprofile-" + now + ".tprofile");
|
||||
out = IOUtils.newWriter(file);
|
||||
} catch (IOException e) {
|
||||
log.error("Not expected", e);
|
||||
log.log(Level.ERROR, "Not expected", e);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
@@ -149,7 +152,7 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
}
|
||||
flushCurrentFile();
|
||||
} catch (Exception e) {
|
||||
log.warn("Error on collect", e);
|
||||
log.log(Level.WARNING, "Error on collect", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,10 +183,10 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
|
||||
if (profileCounter % profilesPerFile == 0) {
|
||||
incrementFile();
|
||||
log.debug("profiled {} transactions", profileCounter);
|
||||
log.log(Level.DEBUG, "profiled {0} transactions", profileCounter);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.warn("Error writing transaction profiling", e);
|
||||
log.log(Level.WARNING, "Error writing transaction profiling", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,16 +250,16 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
@Override
|
||||
public void shutdown() {
|
||||
shutdown = true;
|
||||
log.trace("shutting down");
|
||||
log.log(Level.TRACE, "shutting down");
|
||||
try {
|
||||
executor.shutdown();
|
||||
if (!executor.awaitTermination(4, TimeUnit.SECONDS)) {
|
||||
log.info("Shut down timeout exceeded. Terminating profiling consumer thread.");
|
||||
log.log(Level.INFO, "Shut down timeout exceeded. Terminating profiling consumer thread.");
|
||||
executor.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
log.warn("Interrupt on shutdown", e);
|
||||
log.log(Level.WARNING, "Interrupt on shutdown", e);
|
||||
}
|
||||
flushCurrentFile();
|
||||
}
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import io.ebeaninternal.server.persist.BatchControl;
|
||||
import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
@@ -483,7 +484,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
|
||||
} catch (Exception ex) {
|
||||
// the connection pool will automatically remove the
|
||||
// connection if it does not pass the test
|
||||
CoreLog.log.error("Error closing connection", ex);
|
||||
CoreLog.log.log(Level.ERROR, "Error closing connection", ex);
|
||||
}
|
||||
connection = null;
|
||||
active = false;
|
||||
|
||||
@@ -14,10 +14,10 @@ import io.ebeaninternal.server.persist.BatchControl;
|
||||
import io.ebeaninternal.server.persist.BatchedSqlException;
|
||||
import io.ebeaninternal.server.util.Str;
|
||||
import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.RollbackException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
@@ -28,7 +28,7 @@ import java.util.function.Consumer;
|
||||
*/
|
||||
class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
|
||||
private static final Logger log = CoreLog.log;
|
||||
private static final System.Logger log = CoreLog.log;
|
||||
private static final Object PLACEHOLDER = new Object();
|
||||
private static final String illegalStateMessage = "Transaction is Inactive";
|
||||
|
||||
@@ -356,7 +356,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
try {
|
||||
consumer.accept(callbackList.get(i));
|
||||
} catch (Exception e) {
|
||||
log.error("Error executing transaction callback", e);
|
||||
log.log(Level.ERROR, "Error executing transaction callback", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -884,7 +884,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
connection.setReadOnly(false);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error("Error setting to readOnly?", e);
|
||||
log.log(Level.ERROR, "Error setting to readOnly?", e);
|
||||
}
|
||||
try {
|
||||
if (autoCommit) {
|
||||
@@ -892,14 +892,14 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
connection.setAutoCommit(true);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error("Error setting to readOnly?", e);
|
||||
log.log(Level.ERROR, "Error setting to readOnly?", e);
|
||||
}
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception ex) {
|
||||
// the connection pool will automatically remove the
|
||||
// connection if it does not pass the test
|
||||
log.error("Error closing connection", ex);
|
||||
log.log(Level.ERROR, "Error closing connection", ex);
|
||||
}
|
||||
connection = null;
|
||||
active = false;
|
||||
@@ -932,7 +932,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
withEachCallback(TransactionCallback::postCommit);
|
||||
} catch (SQLException e) {
|
||||
log.error("Error when ending a query only transaction via " + onQueryOnly, e);
|
||||
log.log(Level.ERROR, "Error when ending a query only transaction via " + onQueryOnly, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1056,7 +1056,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
private RuntimeException wrapIfNeeded(Exception e) {
|
||||
if (e instanceof PersistenceException) {
|
||||
// keep more specific exception if we have it
|
||||
return (PersistenceException)e;
|
||||
return (PersistenceException) e;
|
||||
}
|
||||
return new RollbackException(e);
|
||||
}
|
||||
|
||||
+8
-14
@@ -4,7 +4,6 @@ import io.ebean.config.ExternalTransactionManager;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
@@ -14,13 +13,14 @@ import javax.transaction.Status;
|
||||
import javax.transaction.Synchronization;
|
||||
import javax.transaction.TransactionSynchronizationRegistry;
|
||||
import javax.transaction.UserTransaction;
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
/**
|
||||
* Hook into external JTA transaction manager.
|
||||
*/
|
||||
public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
private static final String EBEAN_TXN_RESOURCE = "EBEAN_TXN_RESOURCE";
|
||||
|
||||
private TransactionManager transactionManager;
|
||||
@@ -87,15 +87,15 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
SpiTransaction currentEbeanTransaction = scope.inScope();
|
||||
if (currentEbeanTransaction != null) {
|
||||
// NOT expecting this so log WARNING
|
||||
log.warn("JTA Transaction - no current txn BUT using current Ebean one {}", currentEbeanTransaction.getId());
|
||||
log.log(Level.WARNING, "JTA Transaction - no current txn BUT using current Ebean one {0}", currentEbeanTransaction.getId());
|
||||
return currentEbeanTransaction;
|
||||
}
|
||||
|
||||
UserTransaction ut = getUserTransaction();
|
||||
if (ut == null) {
|
||||
// no current JTA transaction
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("JTA Transaction - no current txn");
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "JTA Transaction - no current txn");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -181,27 +181,21 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
public void afterCompletion(int status) {
|
||||
switch (status) {
|
||||
case Status.STATUS_COMMITTED:
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Jta Txn [" + transaction.getId() + "] committed");
|
||||
}
|
||||
log.log(Level.DEBUG, "Jta Txn [{0}] committed", transaction.getId());
|
||||
transaction.postCommit();
|
||||
// Remove this transaction object as it is completed
|
||||
transactionManager.scope().clearExternal();
|
||||
break;
|
||||
|
||||
case Status.STATUS_ROLLEDBACK:
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Jta Txn [" + transaction.getId() + "] rollback");
|
||||
}
|
||||
log.log(Level.DEBUG, "Jta Txn [{0}] rollback", transaction.getId());
|
||||
transaction.postRollback(null);
|
||||
// Remove this transaction object as it is completed
|
||||
transactionManager.scope().clearExternal();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Jta Txn [" + transaction.getId() + "] status:" + status);
|
||||
}
|
||||
log.log(Level.DEBUG, "Jta Txn [{0}] status:{1}", transaction.getId(), status);
|
||||
}
|
||||
|
||||
// No matter the completion status of the transaction, we release the connection we got from the pool.
|
||||
|
||||
+4
-4
@@ -10,8 +10,8 @@ import io.ebeaninternal.server.cache.CacheChangeSet;
|
||||
import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeanservice.docstore.api.DocStoreUpdates;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Set;
|
||||
*/
|
||||
final class PostCommitProcessing {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final ClusterManager clusterManager;
|
||||
private final TransactionEvent event;
|
||||
@@ -104,8 +104,8 @@ final class PostCommitProcessing {
|
||||
private void notifyCluster() {
|
||||
if (remoteTransactionEvent != null && !remoteTransactionEvent.isEmpty()) {
|
||||
// send the interesting events to the cluster
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Cluster Send: {}", remoteTransactionEvent);
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "Cluster Send: {0}", remoteTransactionEvent);
|
||||
}
|
||||
clusterManager.broadcast(remoteTransactionEvent);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.cache.QueryCacheEntry;
|
||||
import io.ebean.cache.QueryCacheEntryValidate;
|
||||
import io.ebean.cache.ServerCacheNotification;
|
||||
import io.ebean.cache.ServerCacheNotify;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -19,7 +19,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public final class TableModState implements QueryCacheEntryValidate, ServerCacheNotify {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.cache.TABLEMOD");
|
||||
private static final System.Logger log = AppLog.getLogger("io.ebean.cache.TABLEMOD");
|
||||
|
||||
private final Map<String, Long> tableModStamp = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -34,8 +34,8 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
for (String tableName : touchedTables) {
|
||||
tableModStamp.put(tableName, modNanoTime);
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("TableModState updated - touched:{} modNanoTime:{}", touchedTables, modNanoTime);
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "TableModState updated - touched:{0} modNanoTime:{1}", touchedTables, modNanoTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
for (String tableName : tables) {
|
||||
Long modTime = tableModStamp.get(tableName);
|
||||
if (modTime != null && modTime >= sinceNanoTime) {
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("Invalidate on table:{}", tableName);
|
||||
if (log.isLoggable(Level.TRACE)) {
|
||||
log.log(Level.TRACE, "Invalidate on table:{0}", tableName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -68,15 +68,13 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
* Update the table modification timestamps based on remote table modification events.
|
||||
* <p>
|
||||
* Generally this is used with distributed caches (Hazelcast, Ignite etc) via topic.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public void notify(ServerCacheNotification notification) {
|
||||
|
||||
// use local clock - for slightly more aggressive invalidation (as later)
|
||||
// that removes any concern regarding clock syncing across cluster
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("ServerCacheNotification:{}", notification);
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "ServerCacheNotification:{0}", notification);
|
||||
}
|
||||
touch(notification.getDependentTables());
|
||||
}
|
||||
@@ -85,14 +83,12 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
* Update from Remote transaction event.
|
||||
* <p>
|
||||
* Generally this is used with Clustering (ebean-cluster, k8scache).
|
||||
* </p>
|
||||
*/
|
||||
public void notify(RemoteTableMod tableMod) {
|
||||
|
||||
// use local clock - for slightly more aggressive invalidation (as later)
|
||||
// that removes any concern regarding clock syncing across cluster
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RemoteTableMod:{}", tableMod);
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "RemoteTableMod:{0}", tableMod);
|
||||
}
|
||||
touch(tableMod.getTables());
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.ProfileLocation;
|
||||
import io.ebean.TxScope;
|
||||
@@ -28,11 +29,10 @@ import io.ebeaninternal.server.profile.TimedProfileLocationRegistry;
|
||||
import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
import io.ebeanservice.docstore.api.DocStoreUpdateProcessor;
|
||||
import io.ebeanservice.docstore.api.DocStoreUpdates;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
@@ -47,8 +47,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
*/
|
||||
public class TransactionManager implements SpiTransactionManager {
|
||||
|
||||
private static final Logger log = CoreLog.log;
|
||||
private static final Logger clusterLogger = LoggerFactory.getLogger("io.ebean.Cluster");
|
||||
private static final System.Logger log = CoreLog.log;
|
||||
private static final System.Logger clusterLogger = AppLog.getLogger("io.ebean.Cluster");
|
||||
|
||||
private final SpiServer server;
|
||||
private final BeanDescriptorManager beanDescriptorManager;
|
||||
@@ -365,7 +365,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
txnLogger.debug(msg);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("Error while notifying TransactionEventListener of rollback event", ex);
|
||||
log.log(Level.ERROR, "Error while notifying TransactionEventListener of rollback event", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
postCommit.notifyLocalCache();
|
||||
backgroundExecutor.execute(postCommit.backgroundNotify());
|
||||
} catch (Exception ex) {
|
||||
log.error("NotifyOfCommit failed. L2 Cache potentially not notified.", ex);
|
||||
log.log(Level.ERROR, "NotifyOfCommit failed. L2 Cache potentially not notified.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,8 +442,8 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
* Notify local BeanPersistListeners etc of events from another server in the cluster.
|
||||
*/
|
||||
public final void remoteTransactionEvent(RemoteTransactionEvent remoteEvent) {
|
||||
if (clusterLogger.isDebugEnabled()) {
|
||||
clusterLogger.debug("processing {}", remoteEvent);
|
||||
if (clusterLogger.isLoggable(Level.DEBUG)) {
|
||||
clusterLogger.log(Level.DEBUG, "processing {0}", remoteEvent);
|
||||
}
|
||||
CacheChangeSet changeSet = new CacheChangeSet();
|
||||
|
||||
|
||||
@@ -4,18 +4,10 @@ import io.ebean.core.type.DataBinder;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.io.*;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Array;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
@@ -109,7 +101,7 @@ public class DataBind implements DataBinder {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.warn("Error closing InputStream that was bound to PreparedStatement", e);
|
||||
CoreLog.log.log(Level.WARNING, "Error closing InputStream that was bound to PreparedStatement", e);
|
||||
}
|
||||
}
|
||||
inputStreams = null;
|
||||
|
||||
@@ -25,11 +25,11 @@ import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.LocalTime;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.EnumType;
|
||||
import java.io.File;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
@@ -52,7 +52,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public final class DefaultTypeManager implements TypeManager {
|
||||
|
||||
private static final Logger log = CoreLog.internal;
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final ConcurrentHashMap<Class<?>, ScalarType<?>> typeMap;
|
||||
private final ConcurrentHashMap<Integer, ScalarType<?>> nativeMap;
|
||||
@@ -194,7 +194,6 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
ExtraTypeFactory plugin = iterator.next();
|
||||
List<? extends ScalarType<?>> types = plugin.createTypes(config, objectMapper);
|
||||
for (ScalarType<?> type : types) {
|
||||
log.debug("adding ScalarType {}", type.getClass());
|
||||
add(type);
|
||||
}
|
||||
}
|
||||
@@ -220,10 +219,10 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
}
|
||||
|
||||
private void logAdd(ScalarType<?> scalarType) {
|
||||
if (log.isTraceEnabled()) {
|
||||
if (log.isLoggable(Level.TRACE)) {
|
||||
String msg = "ScalarType register [" + scalarType.getClass().getName() + "]";
|
||||
msg += " for [" + scalarType.getType().getName() + "]";
|
||||
log.trace(msg);
|
||||
log.log(Level.TRACE, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,7 +675,7 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
}
|
||||
add(scalarType);
|
||||
} catch (Exception e) {
|
||||
log.error("Error loading ScalarType [" + cls.getName() + "]", e);
|
||||
log.log(Level.ERROR, "Error loading ScalarType [" + cls.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -707,10 +706,10 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
}
|
||||
ScalarTypeConverter converter = foundType.getDeclaredConstructor().newInstance();
|
||||
ScalarTypeWrapper stw = new ScalarTypeWrapper(logicalType, wrappedType, converter);
|
||||
log.debug("Register ScalarTypeWrapper from {} -> {} using:{}", logicalType, persistType, foundType);
|
||||
log.log(Level.DEBUG, "Register ScalarTypeWrapper from {0} -> {1} using:{2}", logicalType, persistType, foundType);
|
||||
add(stw);
|
||||
} catch (Exception e) {
|
||||
log.error("Error registering ScalarTypeConverter [" + foundType.getName() + "]", e);
|
||||
log.log(Level.ERROR, "Error registering ScalarTypeConverter [" + foundType.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -731,10 +730,10 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
}
|
||||
AttributeConverter converter = foundType.getDeclaredConstructor().newInstance();
|
||||
ScalarTypeWrapper stw = new ScalarTypeWrapper(logicalType, wrappedType, new AttributeConverterAdapter(converter));
|
||||
log.debug("Register ScalarTypeWrapper from {} -> {} using:{}", logicalType, persistType, foundType);
|
||||
log.log(Level.DEBUG, "Register ScalarTypeWrapper from {0} -> {1} using:{2}", logicalType, persistType, foundType);
|
||||
add(stw);
|
||||
} catch (Exception e) {
|
||||
log.error("Error registering AttributeConverter [" + foundType.getName() + "]", e);
|
||||
log.log(Level.ERROR, "Error registering AttributeConverter [" + foundType.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -744,7 +743,6 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
*/
|
||||
private void initialiseJacksonTypes(DatabaseConfig config) {
|
||||
if (objectMapper != null) {
|
||||
log.trace("Registering JsonNode type support");
|
||||
ObjectMapper mapper = (ObjectMapper) objectMapper;
|
||||
jsonNodeClob = new ScalarTypeJsonNode.Clob(mapper);
|
||||
jsonNodeBlob = new ScalarTypeJsonNode.Blob(mapper);
|
||||
@@ -807,7 +805,7 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
// detect if Joda classes are in the classpath
|
||||
if (config.getClassLoadConfig().isJodaTimePresent()) {
|
||||
// Joda classes are in the classpath so register the types
|
||||
log.debug("Registering Joda data types");
|
||||
log.log(Level.DEBUG, "Registering Joda data types");
|
||||
addType(LocalDateTime.class, new ScalarTypeJodaLocalDateTime(jsonDateTime));
|
||||
addType(DateTime.class, new ScalarTypeJodaDateTime(jsonDateTime));
|
||||
if (config.getDatabasePlatform().supportsNativeJavaTime()) {
|
||||
@@ -822,11 +820,9 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
if ("normal".equalsIgnoreCase(jodaLocalTimeMode)) {
|
||||
// use the expected/normal local time zone
|
||||
addType(LocalTime.class, new ScalarTypeJodaLocalTime());
|
||||
log.debug("registered ScalarTypeJodaLocalTime");
|
||||
} else if ("utc".equalsIgnoreCase(jodaLocalTimeMode)) {
|
||||
// use the old UTC based
|
||||
addType(LocalTime.class, new ScalarTypeJodaLocalTimeUTC());
|
||||
log.debug("registered ScalarTypeJodaLocalTimeUTC");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import io.ebean.text.TextException;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
@@ -169,14 +170,14 @@ final class ScalarTypeFile extends ScalarTypeBase<File> {
|
||||
try {
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.error("Error when closing outputstream", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error when closing outputStream", e);
|
||||
}
|
||||
}
|
||||
if (input != null) {
|
||||
try {
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.error("Error when closing inputstream ", e);
|
||||
CoreLog.log.log(Level.ERROR, "Error when closing inputStream ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user