mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 21:20:45 +00:00
loglevels:
errorframe: warning console: debug ? config : warning file: debug || detaillog ? config : warning
This commit is contained in:
@@ -85,6 +85,8 @@ public class Configuration {
|
||||
public static final ConfigurationItem<Boolean> useRibbonInterface = null;
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
public static final ConfigurationItem<Boolean> openFolderAfterFlaExport = null;
|
||||
@ConfigurationDefaultBoolean(true)
|
||||
public static final ConfigurationItem<Boolean> useDetailedLogging = null;
|
||||
|
||||
/**
|
||||
* Debug mode = throwing an error when comparing original file and
|
||||
@@ -446,7 +448,7 @@ public class Configuration {
|
||||
|
||||
static {
|
||||
setConfigurationFields();
|
||||
if (debugMode.get()) {
|
||||
if (useDetailedLogging.get() || debugMode.get()) {
|
||||
logLevel = Level.CONFIG;
|
||||
} else {
|
||||
logLevel = Level.WARNING;
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.util.Date;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
@@ -112,9 +113,13 @@ public class ErrorLogFrame extends AppFrame {
|
||||
|
||||
cnt.add(new JScrollPane(logView), BorderLayout.CENTER);
|
||||
handler = new Handler() {
|
||||
SimpleFormatter formatter = new SimpleFormatter();
|
||||
|
||||
@Override
|
||||
public void publish(LogRecord record) {
|
||||
log(record.getLevel(), record.getMessage(), record.getThrown());
|
||||
if (getLevel().intValue() <= record.getLevel().intValue()) {
|
||||
log(record.getLevel(), formatter.formatMessage(record), record.getThrown());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,6 +130,7 @@ public class ErrorLogFrame extends AppFrame {
|
||||
public void close() throws SecurityException {
|
||||
}
|
||||
};
|
||||
handler.setLevel(Level.WARNING);
|
||||
}
|
||||
|
||||
public void clearErrorState() {
|
||||
@@ -180,7 +186,6 @@ public class ErrorLogFrame extends AppFrame {
|
||||
detailTextArea.setOpaque(false);
|
||||
detailTextArea.setFont(new JLabel().getFont());
|
||||
detailTextArea.setBackground(Color.white);
|
||||
//detailTextAre
|
||||
detailComponent = detailTextArea;
|
||||
}
|
||||
JPanel header = new JPanel();
|
||||
@@ -238,7 +243,6 @@ public class ErrorLogFrame extends AppFrame {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (detailComponent != null) {
|
||||
header.add(expandButton);
|
||||
}
|
||||
@@ -248,7 +252,6 @@ public class ErrorLogFrame extends AppFrame {
|
||||
header.add(dateLabel);
|
||||
|
||||
|
||||
|
||||
JLabel levelLabel = new JLabel(level.getName());
|
||||
levelLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
header.add(levelLabel);
|
||||
|
||||
@@ -671,6 +671,8 @@ public class Main {
|
||||
|
||||
public static void initLang() {
|
||||
Locale.setDefault(Locale.forLanguageTag(Configuration.locale.get()));
|
||||
AppStrings.updateLanguage();
|
||||
|
||||
UIManager.put("OptionPane.okButtonText", AppStrings.translate("button.ok"));
|
||||
UIManager.put("OptionPane.yesButtonText", AppStrings.translate("button.yes"));
|
||||
UIManager.put("OptionPane.noButtonText", AppStrings.translate("button.no"));
|
||||
@@ -1036,7 +1038,7 @@ public class Main {
|
||||
|
||||
try {
|
||||
fileName = Configuration.getFFDecHome() + File.separator + "logs" + File.separator;
|
||||
if (Configuration.logLevel.intValue() < Level.WARNING.intValue()) {
|
||||
if (Configuration.useDetailedLogging.get()) {
|
||||
fileName += "log-" + sdf.format(new Date()) + ".txt";
|
||||
} else {
|
||||
fileName += "log.txt";
|
||||
@@ -1070,12 +1072,16 @@ public class Main {
|
||||
try {
|
||||
Logger logger = Logger.getLogger("");
|
||||
logger.setLevel(Configuration.logLevel);
|
||||
if (debug) {
|
||||
ConsoleHandler conHan = new ConsoleHandler();
|
||||
SimpleFormatter formatterTxt = new SimpleFormatter();
|
||||
conHan.setFormatter(formatterTxt);
|
||||
logger.addHandler(conHan);
|
||||
|
||||
int handlerCount = logger.getHandlers().length;
|
||||
for (int i = handlerCount - 1; i >= 0; i--) {
|
||||
logger.removeHandler(logger.getHandlers()[i]);
|
||||
}
|
||||
ConsoleHandler conHan = new ConsoleHandler();
|
||||
conHan.setLevel(debug ? Level.CONFIG : Level.WARNING);
|
||||
SimpleFormatter formatterTxt = new SimpleFormatter();
|
||||
conHan.setFormatter(formatterTxt);
|
||||
logger.addHandler(conHan);
|
||||
clearLogFile();
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
Reference in New Issue
Block a user