Fixed debug log messages

This commit is contained in:
Rsl1122 2017-11-05 12:05:42 +02:00
parent beb04c3f9c
commit c9bcf0ee6f
7 changed files with 37 additions and 39 deletions

View File

@ -65,7 +65,7 @@ public abstract class SQLDB extends Database {
public void init() throws DatabaseInitException { public void init() throws DatabaseInitException {
setStatus("Init"); setStatus("Init");
String benchName = "Init " + getConfigName(); String benchName = "Init " + getConfigName();
Benchmark.start(benchName); Benchmark.start("Database", benchName);
try { try {
setupDataSource(); setupDataSource();
setupDatabase(); setupDatabase();
@ -148,7 +148,7 @@ public abstract class SQLDB extends Database {
* Updates table columns to latest schema. * Updates table columns to latest schema.
*/ */
private void createTables() throws DatabaseInitException { private void createTables() throws DatabaseInitException {
Benchmark.start("Create tables"); Benchmark.start("Database", "Create tables");
for (Table table : getAllTables()) { for (Table table : getAllTables()) {
table.createTable(); table.createTable();
} }
@ -243,8 +243,8 @@ public abstract class SQLDB extends Database {
} }
try { try {
Benchmark.start("Remove Account"); Log.logDebug("Database", "Removing Account: " + uuid);
Log.debug("Database", "Removing Account: " + uuid); Benchmark.start("Database", "Remove Account");
for (Table t : getAllTablesInRemoveOrder()) { for (Table t : getAllTablesInRemoveOrder()) {
if (!(t instanceof UserIDTable)) { if (!(t instanceof UserIDTable)) {
@ -279,7 +279,7 @@ public abstract class SQLDB extends Database {
} }
private void setStatus(String status) { private void setStatus(String status) {
Log.debug("Database", status); Log.logDebug("Database", status);
} }
public void setAvailable() { public void setAvailable() {

View File

@ -151,7 +151,7 @@ public class Locale {
add(Msg.ANALYSIS_FETCH, analysis + "Fetching Data.."); add(Msg.ANALYSIS_FETCH, analysis + "Fetching Data..");
add(Msg.ANALYSIS_PHASE_START, analysis + "Data Fetched (${0} users, took ${1}ms), beginning Analysis of data.."); add(Msg.ANALYSIS_PHASE_START, analysis + "Data Fetched (${0} users, took ${1}ms), beginning Analysis of data..");
add(Msg.ANALYSIS_3RD_PARTY, analysis + "Analyzing additional data sources (3rd party)"); add(Msg.ANALYSIS_3RD_PARTY, analysis + "Analyzing additional data sources (3rd party)");
add(Msg.ANALYSIS_FINISHED, analysis + "Analysis Complete. (${0}) ${1}"); add(Msg.ANALYSIS_FINISHED, analysis + "Analysis Complete. (took ${0} ms) ${1}");
add(Msg.ANALYSIS_FAIL_NO_PLAYERS, analysis + "Analysis failed, no known players."); add(Msg.ANALYSIS_FAIL_NO_PLAYERS, analysis + "Analysis failed, no known players.");
add(Msg.ANALYSIS_FAIL_NO_DATA, analysis + "Analysis failed, no data in the database."); add(Msg.ANALYSIS_FAIL_NO_DATA, analysis + "Analysis failed, no data in the database.");
add(Msg.ANALYSIS_FAIL_FETCH_EXCEPTION, analysis + "Failed to fetch data for Analysis, Exception occurred."); add(Msg.ANALYSIS_FAIL_FETCH_EXCEPTION, analysis + "Failed to fetch data for Analysis, Exception occurred.");

View File

@ -53,7 +53,7 @@ public class InspectPageParser extends PageParser {
public String parse() throws ParseException { public String parse() throws ParseException {
try { try {
// TODO Player is online parts // TODO Player is online parts
Log.debug("Database", "Inspect Parse Fetch"); Log.logDebug("Database", "Inspect Parse Fetch");
Benchmark.start("Inspect Parse, Fetch"); Benchmark.start("Inspect Parse, Fetch");
Database db = plugin.getDB(); Database db = plugin.getDB();
SessionsTable sessionsTable = db.getSessionsTable(); SessionsTable sessionsTable = db.getSessionsTable();

View File

@ -4,6 +4,7 @@ import com.djrapitops.plugin.api.Benchmark;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.task.RunnableFactory;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Settings; import main.java.com.djrapitops.plan.Settings;
@ -63,7 +64,7 @@ public class Analysis {
Benchmark.start("Analysis"); Benchmark.start("Analysis");
log(Locale.get(Msg.ANALYSIS_START).toString()); log(Locale.get(Msg.ANALYSIS_START).toString());
// Async task for Analysis // Async task for Analysis
plugin.getRunnableFactory().createNew(new AbsRunnable("AnalysisTask") { RunnableFactory.createNew(new AbsRunnable("AnalysisTask") {
@Override @Override
public void run() { public void run() {
ErrorResponse analysisRefreshPage = new ErrorResponse(); ErrorResponse analysisRefreshPage = new ErrorResponse();
@ -90,8 +91,8 @@ public class Analysis {
public boolean analyze(InformationManager infoManager, Database db) { public boolean analyze(InformationManager infoManager, Database db) {
log(Locale.get(Msg.ANALYSIS_FETCH).toString()); log(Locale.get(Msg.ANALYSIS_FETCH).toString());
Benchmark.start("Fetch Phase"); Benchmark.start("Fetch Phase");
Log.debug("Database", "Analysis Fetch"); Log.logDebug("Database", "Analysis Fetch");
Log.debug("Analysis", "Analysis Fetch Phase"); Log.logDebug("Analysis", "Analysis Fetch Phase");
return analyzeData(infoManager, db); return analyzeData(infoManager, db);
@ -113,33 +114,31 @@ public class Analysis {
Benchmark.stop("Analysis", "Create Empty dataset"); Benchmark.stop("Analysis", "Create Empty dataset");
fillDataset(analysisData, db); fillDataset(analysisData, db);
String fetchPhaseLength = Benchmark.stop("Analysis", "Fetch Phase"); long fetchPhaseLength = Benchmark.stop("Analysis", "Fetch Phase");
Benchmark.start("Analysis Phase"); Benchmark.start("Analysis Phase");
Log.debug("Analysis", "Analysis Phase"); Log.logDebug("Analysis", "Analysis Phase");
log(Locale.get(Msg.ANALYSIS_PHASE_START).parse(analysisData.getPlayerCountPart().getPlayerCount(), fetchPhaseLength)); log(Locale.get(Msg.ANALYSIS_PHASE_START).parse(analysisData.getPlayerCountPart().getPlayerCount(), fetchPhaseLength));
analysisData.analyseData(); analysisData.analyseData();
Benchmark.stop("Analysis", "Analysis Phase"); Benchmark.stop("Analysis", "Analysis Phase");
log(Locale.get(Msg.ANALYSIS_3RD_PARTY).toString()); log(Locale.get(Msg.ANALYSIS_3RD_PARTY).toString());
Log.debug("Analysis", "Analyzing additional data sources (3rd party)"); Log.logDebug("Analysis", "Analyzing additional data sources (3rd party)");
analysisData.setAdditionalDataReplaceMap(analyzeAdditionalPluginData(analysisData.getPlayerCountPart().getUuids())); analysisData.setAdditionalDataReplaceMap(analyzeAdditionalPluginData(analysisData.getPlayerCountPart().getUuids()));
((BukkitInformationManager) infoManager).cacheAnalysisData(analysisData); ((BukkitInformationManager) infoManager).cacheAnalysisData(analysisData);
String time = Benchmark.stop("Analysis", "Analysis");
Log.logDebug("Analysis", time);
Log.info(Locale.get(Msg.ANALYSIS_FINISHED).parse(String.valueOf(time), ""));
// TODO Export // TODO Export
// ExportUtility.export(analysisData, rawData); // ExportUtility.export(analysisData, rawData);
} catch (Exception e) { } catch (Exception e) {
Log.toLog(this.getClass().getName(), e); Log.toLog(this.getClass().getName(), e);
((BukkitInformationManager) plugin.getInfoManager()).cacheAnalysisHtml(new InternalErrorResponse(e, "Analysis").getContent()); ((BukkitInformationManager) plugin.getInfoManager()).cacheAnalysisHtml(new InternalErrorResponse(e, "Analysis").getContent());
Log.debug("Analysis", "Error: " + e); Log.logDebug("Analysis", "Error: " + e);
Log.logDebug("Analysis");
return false; return false;
} finally {
long time = Benchmark.stop("Analysis", "Analysis");
Log.logDebug("Analysis");
Log.info(Locale.get(Msg.ANALYSIS_FINISHED).parse(time, ""));
} }
return true; return true;
} }
@ -166,7 +165,7 @@ public class Analysis {
}; };
final AnalysisType bool = AnalysisType.BOOLEAN_PERCENTAGE; final AnalysisType bool = AnalysisType.BOOLEAN_PERCENTAGE;
final AnalysisType boolTot = AnalysisType.BOOLEAN_TOTAL; final AnalysisType boolTot = AnalysisType.BOOLEAN_TOTAL;
Log.debug("Analysis", "Additional Sources: " + sources.size()); Log.logDebug("Analysis", "Additional Sources: " + sources.size());
sources.parallelStream().filter(Verify::notNull).forEach(source -> { sources.parallelStream().filter(Verify::notNull).forEach(source -> {
try { try {
Benchmark.start("Source " + StringUtils.remove(source.getPlaceholder(), '%')); Benchmark.start("Source " + StringUtils.remove(source.getPlaceholder(), '%'));
@ -250,7 +249,7 @@ public class Analysis {
tpsTable.getPeakPlayerCount(now - (TimeAmount.DAY.ms() * 2)).ifPresent(tpsPart::setLastPeak); tpsTable.getPeakPlayerCount(now - (TimeAmount.DAY.ms() * 2)).ifPresent(tpsPart::setLastPeak);
tpsPart.addTpsData(tpsData); tpsPart.addTpsData(tpsData);
Log.debug("Analysis", "TPS Data Size: " + tpsData.size()); Log.logDebug("Analysis", "TPS Data Size: " + tpsData.size());
List<UserInfo> userInfo = db.getUserInfoTable().getServerUserInfo().stream().distinct().collect(Collectors.toList()); List<UserInfo> userInfo = db.getUserInfoTable().getServerUserInfo().stream().distinct().collect(Collectors.toList());

View File

@ -30,9 +30,9 @@ public class ExportUtility {
public static File getFolder() { public static File getFolder() {
String path = Settings.ANALYSIS_EXPORT_PATH.toString(); String path = Settings.ANALYSIS_EXPORT_PATH.toString();
Log.debug("Export", "Path: " + path); Log.logDebug("Export", "Path: " + path);
boolean isAbsolute = Paths.get(path).isAbsolute(); boolean isAbsolute = Paths.get(path).isAbsolute();
Log.debug("Export", "Absolute: " + (isAbsolute ? "Yes" : "No")); Log.logDebug("Export", "Absolute: " + (isAbsolute ? "Yes" : "No"));
if (isAbsolute) { if (isAbsolute) {
File folder = new File(path); File folder = new File(path);
if (!folder.exists() || !folder.isDirectory()) { if (!folder.exists() || !folder.isDirectory()) {
@ -51,17 +51,17 @@ public class ExportUtility {
return; return;
} }
// Benchmark.start("Exporting Html pages"); // Benchmark.start("Export","Exporting Html pages");
// try { // try {
// File folder = getFolder(); // File folder = getFolder();
// Log.debug("Export", "Folder: " + folder.getAbsolutePath()); // Log.logDebug("Export", "Folder: " + folder.getAbsolutePath());
// //
// writePlayersPageHtml(playerNames, new File(folder, "players")); // writePlayersPageHtml(playerNames, new File(folder, "players"));
// writeAnalysisHtml(analysisData, new File(folder, "server")); // writeAnalysisHtml(analysisData, new File(folder, "server"));
// //
// File playersFolder = getPlayersFolder(folder); // File playersFolder = getPlayersFolder(folder);
// Log.debug("Export", "Player html files."); // Log.logDebug("Export", "Player html files.");
// Log.debug("Export", "Player Page Folder: " + playersFolder.getAbsolutePath()); // Log.logDebug("Export", "Player Page Folder: " + playersFolder.getAbsolutePath());
// //
// String playerHtml = FileUtil.getStringFromResource("player.html"); // String playerHtml = FileUtil.getStringFromResource("player.html");
// //
@ -120,7 +120,7 @@ public class ExportUtility {
// PlaceholderUtils.getAnalysisReplaceRules(analysisData)) // PlaceholderUtils.getAnalysisReplaceRules(analysisData))
// .replace(HtmlUtils.getInspectUrl(""), "../player/"); // .replace(HtmlUtils.getInspectUrl(""), "../player/");
// File analysisHtmlFile = new File(serverFolder, "index.html"); // File analysisHtmlFile = new File(serverFolder, "index.html");
// Log.debug("Export", "Analysis Page File: " + analysisHtmlFile.getAbsolutePath()); // Log.logDebug("Export", "Analysis Page File: " + analysisHtmlFile.getAbsolutePath());
// Files.write(analysisHtmlFile.toPath(), Collections.singletonList(analysisHtml)); // Files.write(analysisHtmlFile.toPath(), Collections.singletonList(analysisHtml));
} }
@ -128,7 +128,7 @@ public class ExportUtility {
String playersHtml = PlayersPageResponse.buildContent(names); String playersHtml = PlayersPageResponse.buildContent(names);
playersFolder.mkdirs(); playersFolder.mkdirs();
File playersHtmlFile = new File(playersFolder, "index.html"); File playersHtmlFile = new File(playersFolder, "index.html");
Log.debug("Export", "Players Page File: " + playersHtmlFile.getAbsolutePath()); Log.logDebug("Export", "Players Page File: " + playersHtmlFile.getAbsolutePath());
Files.write(playersHtmlFile.toPath(), Collections.singletonList(playersHtml)); Files.write(playersHtmlFile.toPath(), Collections.singletonList(playersHtml));
} }

View File

@ -26,7 +26,7 @@ WebServer:
KeyPass: 'default' KeyPass: 'default'
StorePass: 'default' StorePass: 'default'
Alias: 'alias' Alias: 'alias'
# -----------------------------------------------------
Database: Database:
MySQL: MySQL:
Host: localhost Host: localhost
@ -34,7 +34,7 @@ Database:
User: root User: root
Password: minecraft Password: minecraft
Database: Plan Database: Plan
# -----------------------------------------------------
Commands: Commands:
AlternativeIP: AlternativeIP:
Enabled: false Enabled: false
@ -55,7 +55,7 @@ Data:
Commands: Commands:
LogUnknownCommands: false LogUnknownCommands: false
CombineCommandAliases: true CombineCommandAliases: true
# -----------------------------------------------------
Customization: Customization:
Formatting: Formatting:
DecimalPoints: '#.##' DecimalPoints: '#.##'
@ -107,7 +107,7 @@ Theme:
ActivityPie: '"#228B22", "#A9A9A9", "#808080", "#951800"' ActivityPie: '"#228B22", "#A9A9A9", "#808080", "#951800"'
ServerPreferencePie: '"#0099C6", "#66AA00", "#316395", "#994499", "#22AA99", "#AAAA11", "#6633CC", "#E67300", "#329262", "#5574A6"' ServerPreferencePie: '"#0099C6", "#66AA00", "#316395", "#994499", "#22AA99", "#AAAA11", "#6633CC", "#E67300", "#329262", "#5574A6"'
# -----------------------------------------------------
Servers: Servers:
Example: Example:
WebServerPort: 8034 WebServerPort: 8034

View File

@ -31,7 +31,7 @@ WebServer:
KeyPass: 'default' KeyPass: 'default'
StorePass: 'default' StorePass: 'default'
Alias: 'alias' Alias: 'alias'
# -----------------------------------------------------
Database: Database:
Type: SQLite Type: SQLite
MySQL: MySQL:
@ -40,7 +40,7 @@ Database:
User: root User: root
Password: minecraft Password: minecraft
Database: Plan Database: Plan
# -----------------------------------------------------
Commands: Commands:
AlternativeIP: AlternativeIP:
Enabled: false Enabled: false
@ -57,12 +57,11 @@ Analysis:
Enabled: false Enabled: false
ExternalWebServerLinkProtocol: http ExternalWebServerLinkProtocol: http
DestinationFolder: 'Analysis Results' DestinationFolder: 'Analysis Results'
Data: Data:
Commands: Commands:
LogUnknownCommands: false LogUnknownCommands: false
CombineCommandAliases: true CombineCommandAliases: true
# -----------------------------------------------------
Customization: Customization:
UseServerTime: true UseServerTime: true
Display: Display:
@ -121,7 +120,7 @@ Theme:
GMDrilldown: '"#438c99", "#639A67", "#D8EBB5", "#D9BF77"' GMDrilldown: '"#438c99", "#639A67", "#D8EBB5", "#D9BF77"'
ActivityPie: '"#228B22", "#A9A9A9", "#808080", "#951800"' ActivityPie: '"#228B22", "#A9A9A9", "#808080", "#951800"'
ServerPreferencePie: '"#0099C6", "#66AA00", "#316395", "#994499", "#22AA99", "#AAAA11", "#6633CC", "#E67300", "#329262", "#5574A6"' ServerPreferencePie: '"#0099C6", "#66AA00", "#316395", "#994499", "#22AA99", "#AAAA11", "#6633CC", "#E67300", "#329262", "#5574A6"'
# -----------------------------------------------------
Plugins: Plugins:
Factions: Factions:
HideFactions: HideFactions: