diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index b0524289e..fa4a053c8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -85,6 +85,8 @@ public class Configuration { public static final ConfigurationItem useRibbonInterface = null; @ConfigurationDefaultBoolean(false) public static final ConfigurationItem openFolderAfterFlaExport = null; + @ConfigurationDefaultBoolean(true) + public static final ConfigurationItem 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; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java index 69cc13bfe..192527c19 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java @@ -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); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 724064bc3..e6a257fdc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -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) {