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

View File

@ -151,7 +151,7 @@ public class Locale {
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_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_DATA, analysis + "Analysis failed, no data in the database.");
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 {
try {
// TODO Player is online parts
Log.debug("Database", "Inspect Parse Fetch");
Log.logDebug("Database", "Inspect Parse Fetch");
Benchmark.start("Inspect Parse, Fetch");
Database db = plugin.getDB();
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.utility.log.Log;
import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.task.RunnableFactory;
import com.djrapitops.plugin.utilities.Verify;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Settings;
@ -63,7 +64,7 @@ public class Analysis {
Benchmark.start("Analysis");
log(Locale.get(Msg.ANALYSIS_START).toString());
// Async task for Analysis
plugin.getRunnableFactory().createNew(new AbsRunnable("AnalysisTask") {
RunnableFactory.createNew(new AbsRunnable("AnalysisTask") {
@Override
public void run() {
ErrorResponse analysisRefreshPage = new ErrorResponse();
@ -90,8 +91,8 @@ public class Analysis {
public boolean analyze(InformationManager infoManager, Database db) {
log(Locale.get(Msg.ANALYSIS_FETCH).toString());
Benchmark.start("Fetch Phase");
Log.debug("Database", "Analysis Fetch");
Log.debug("Analysis", "Analysis Fetch Phase");
Log.logDebug("Database", "Analysis Fetch");
Log.logDebug("Analysis", "Analysis Fetch Phase");
return analyzeData(infoManager, db);
@ -113,33 +114,31 @@ public class Analysis {
Benchmark.stop("Analysis", "Create Empty dataset");
fillDataset(analysisData, db);
String fetchPhaseLength = Benchmark.stop("Analysis", "Fetch Phase");
long fetchPhaseLength = Benchmark.stop("Analysis", "Fetch 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));
analysisData.analyseData();
Benchmark.stop("Analysis", "Analysis Phase");
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()));
((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
// ExportUtility.export(analysisData, rawData);
} catch (Exception e) {
Log.toLog(this.getClass().getName(), e);
((BukkitInformationManager) plugin.getInfoManager()).cacheAnalysisHtml(new InternalErrorResponse(e, "Analysis").getContent());
Log.debug("Analysis", "Error: " + e);
Log.logDebug("Analysis");
Log.logDebug("Analysis", "Error: " + e);
return false;
} finally {
long time = Benchmark.stop("Analysis", "Analysis");
Log.logDebug("Analysis");
Log.info(Locale.get(Msg.ANALYSIS_FINISHED).parse(time, ""));
}
return true;
}
@ -166,7 +165,7 @@ public class Analysis {
};
final AnalysisType bool = AnalysisType.BOOLEAN_PERCENTAGE;
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 -> {
try {
Benchmark.start("Source " + StringUtils.remove(source.getPlaceholder(), '%'));
@ -250,7 +249,7 @@ public class Analysis {
tpsTable.getPeakPlayerCount(now - (TimeAmount.DAY.ms() * 2)).ifPresent(tpsPart::setLastPeak);
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());

View File

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

View File

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

View File

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