Browse Source

REPORT-23038 修复部分插件与日志输出死锁的问题

feature/big-screen
vito 5 years ago
parent
commit
e3c464758a
  1. 20
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

20
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils;
import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory;
@ -199,6 +200,7 @@ public class DesignerLogHandler {
jTextArea.addMouseListener(new MouseAdapter() {
// check for right click
@Override
public void mousePressed(MouseEvent event) {
if (event.getButton() == MouseEvent.BUTTON3) {
@ -219,6 +221,7 @@ public class DesignerLogHandler {
ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
resultPane.setText("");
@ -260,21 +263,25 @@ public class DesignerLogHandler {
printMessage(message, intLevel, date, null);
}
private void printMessage(String msg, int intLevel, Date date, Throwable e) {
this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0);
private void printMessage(final String msg, final int intLevel, final Date date, final Throwable e) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
LogHandlerArea.this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0);
String message = appendLocaleMark(msg, intLevel);
this.log(message, intLevel);
LogHandlerArea.this.log(message, intLevel);
setMessage(message, intLevel);
if (e == null) {
return;
}
StackTraceElement[] traceElements = e.getStackTrace();
for (int i = 0; i < traceElements.length; i++) {
this.log("\t" + "at " + traceElements[i].toString() + "\n", 0);
for (StackTraceElement traceElement : traceElements) {
LogHandlerArea.this.log("\t" + "at " + traceElement.toString() + "\n", 0);
}
}
});
}
private void log(String str, int style) {
@ -346,6 +353,7 @@ public class DesignerLogHandler {
ActionListener popupListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.selectAll.getText())) {

Loading…
Cancel
Save