/** * Set up this profile listener before it is active. */ public void setOwner(SpiEbeanServer server, ServerConfig serverConfig) { this.server = server; this.logging = new DefaultAutoFetchManagerLogging(serverConfig, this); AutofetchConfig autofetchConfig = serverConfig.getAutofetchConfig(); useFileLogging = autofetchConfig.isUseFileLogging(); queryTuning = autofetchConfig.isQueryTuning(); queryTuningAddVersion = autofetchConfig.isQueryTuningAddVersion(); profiling = autofetchConfig.isProfiling(); profilingMin = autofetchConfig.getProfilingMin(); profilingBase = autofetchConfig.getProfilingBase(); setProfilingRate(autofetchConfig.getProfilingRate()); defaultGarbageCollectionWait = (long) autofetchConfig.getGarbageCollectionWait(); // determine the mode to use when Query.setAutoFetch() was // not explicitly set mode = autofetchConfig.getMode(); if (profiling || queryTuning) { // log the guts of the autoFetch setup String msg = "AutoFetch queryTuning[" + queryTuning + "] profiling[" + profiling + "] mode[" + mode + "] profiling rate[" + profilingRate + "] min[" + profilingMin + "] base[" + profilingBase + "]"; logging.logToJavaLogger(msg); } }
/** * Return the directory that autofetch file goes into. */ protected static File getAutofetchDir(ServerConfig serverConfig, ResourceSource resourceSource) { String dir = null; if (serverConfig.getAutofetchConfig() != null) { dir = serverConfig.getAutofetchConfig().getLogDirectoryWithEval(); } if (dir != null) { return new File(dir); } String realPath = resourceSource.getRealPath(); if (realPath != null) { return new File(realPath); } else { throw new RuntimeException("No autofetch directory set?"); } }
public DefaultAutoFetchManagerLogging(ServerConfig serverConfig, DefaultAutoFetchManager profileListener) { this.manager = profileListener; AutofetchConfig autofetchConfig = serverConfig.getAutofetchConfig(); traceUsageCollection = GlobalProperties.getBoolean("ebean.autofetch.traceUsageCollection", false); useFileLogger = autofetchConfig.isUseFileLogging(); if (!useFileLogger) { fileLogger = null; } else { // a separate log file just like the transaction logging // for putting the profiling log messages. The benefit is that // this doesn't pollute the main log with heaps of messages. String baseDir = serverConfig.getLoggingDirectoryWithEval(); fileLogger = new SimpleLogger(baseDir, "autofetch", true, "csv"); } int updateFreqInSecs = autofetchConfig.getProfileUpdateFrequency(); BackgroundThread.add(updateFreqInSecs, new UpdateProfile()); }
autofetchConfig = new AutofetchConfig(); autofetchConfig.loadSettings(p); if (dataSourceConfig == null) { dataSourceConfig = new DataSourceConfig();
public DefaultAutoFetchManagerLogging(ServerConfig serverConfig, DefaultAutoFetchManager profileListener) { this.manager = profileListener; AutofetchConfig autofetchConfig = serverConfig.getAutofetchConfig(); traceUsageCollection = GlobalProperties.getBoolean("ebean.autofetch.traceUsageCollection", false); useFileLogger = autofetchConfig.isUseFileLogging(); if (!useFileLogger) { fileLogger = null; } else { // a separate log file just like the transaction logging // for putting the profiling log messages. The benefit is that // this doesn't pollute the main log with heaps of messages. String baseDir = serverConfig.getLoggingDirectoryWithEval(); fileLogger = new SimpleLogger(baseDir, "autofetch", true, "csv"); } int updateFreqInSecs = autofetchConfig.getProfileUpdateFrequency(); BackgroundThread.add(updateFreqInSecs, new UpdateProfile()); }
autofetchConfig = new AutofetchConfig(); autofetchConfig.loadSettings(p); if (dataSourceConfig == null) { dataSourceConfig = new DataSourceConfig();
/** * Set up this profile listener before it is active. */ public void setOwner(SpiEbeanServer server, ServerConfig serverConfig) { this.server = server; this.logging = new DefaultAutoFetchManagerLogging(serverConfig, this); AutofetchConfig autofetchConfig = serverConfig.getAutofetchConfig(); useFileLogging = autofetchConfig.isUseFileLogging(); queryTuning = autofetchConfig.isQueryTuning(); queryTuningAddVersion = autofetchConfig.isQueryTuningAddVersion(); profiling = autofetchConfig.isProfiling(); profilingMin = autofetchConfig.getProfilingMin(); profilingBase = autofetchConfig.getProfilingBase(); setProfilingRate(autofetchConfig.getProfilingRate()); defaultGarbageCollectionWait = (long) autofetchConfig.getGarbageCollectionWait(); // determine the mode to use when Query.setAutoFetch() was // not explicitly set mode = autofetchConfig.getMode(); if (profiling || queryTuning) { // log the guts of the autoFetch setup String msg = "AutoFetch queryTuning[" + queryTuning + "] profiling[" + profiling + "] mode[" + mode + "] profiling rate[" + profilingRate + "] min[" + profilingMin + "] base[" + profilingBase + "]"; logging.logToJavaLogger(msg); } }
/** * Return the directory that autofetch file goes into. */ protected static File getAutofetchDir(ServerConfig serverConfig, ResourceSource resourceSource) { String dir = null; if (serverConfig.getAutofetchConfig() != null) { dir = serverConfig.getAutofetchConfig().getLogDirectoryWithEval(); } if (dir != null) { return new File(dir); } String realPath = resourceSource.getRealPath(); if (realPath != null) { return new File(realPath); } else { throw new RuntimeException("No autofetch directory set?"); } }