Browse Source

Merge pull request #1368 in BA/design from ~DANIEL/finereport_design:release/9.0 to release/9.0

* commit '901cbd0938f8f48eb0a28c5fe921cc9cd65746a4':
  PFC-1053 log调整
master
superman 7 years ago
parent
commit
88854d9e12
  1. 10
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
  2. 15
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  3. 2
      designer_base/src/com/fr/design/DesignerEnvManager.java
  4. 16
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  5. 12
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java
  6. 20
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

10
designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java

@ -13,11 +13,11 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.apache.log4j.AppenderSkeleton;
import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.web.core.SessionDealWith;
import com.fr.web.core.SessionIDInfor;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;
import java.io.InputStream;
@ -36,7 +36,7 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
private String activekey;
public ErrorInfoLogAppender() {
this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
this.layout = new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
this.username = ConfigManager.getProviderInstance().getBbsUsername();
@ -63,7 +63,7 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
public void subAppend(LoggingEvent event) {
Level level = event.getLevel();
// 只分析上传记录error以上的.
if (level.isGreaterOrEqual(FRLogLevel.ERROR)) {
if (level.isGreaterOrEqual(Level.ERROR)) {
String msg = this.layout.format(event);
// 这个id并不是一定会有的, 有就记录下, 说明是预览模板出的错.
String templateid = readTemplateID();

15
designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -10,6 +10,7 @@ import com.fr.general.http.HttpClient;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.license.function.VT4FR;
import com.fr.log.LogHandler;
import com.fr.stable.CodeUtils;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
@ -40,7 +41,12 @@ public class ErrorInfoUploader {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
FRLogger.getLogger().addLogAppender(new ErrorInfoLogAppender());
FRLogger.getLogger().addLogAppender(new LogHandler<ErrorInfoLogAppender>() {
@Override
public ErrorInfoLogAppender getHandler() {
return new ErrorInfoLogAppender();
}
});
}
});
@ -49,7 +55,12 @@ public class ErrorInfoUploader {
}
private ErrorInfoUploader() {
FRLogger.getLogger().addLogAppender(new ErrorInfoLogAppender());
FRLogger.getLogger().addLogAppender(new LogHandler<ErrorInfoLogAppender>() {
@Override
public ErrorInfoLogAppender getHandler() {
return new ErrorInfoLogAppender();
}
});
}
public static ErrorInfoUploader getInstance() {

2
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -33,7 +33,6 @@ import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import org.apache.log4j.Level;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
@ -54,6 +53,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
/**
* The manager of Designer GUI.

16
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -10,19 +10,23 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.third.fr.pdf.kernel.utils.CompareTool;
import com.sap.conn.jco.JCo;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS;

12
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogAppender.java

@ -1,8 +1,10 @@
package com.fr.design.mainframe.loghandler;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;
import com.fr.general.FRLogLevel;
import com.fr.third.apache.log4j.AppenderSkeleton;
import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import java.util.Date;
@ -12,7 +14,7 @@ import java.util.Date;
public class DesignerLogAppender extends AppenderSkeleton {
public DesignerLogAppender() {
this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
this.layout = new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
}
protected void append(LoggingEvent event) {
@ -35,7 +37,7 @@ public class DesignerLogAppender extends AppenderSkeleton {
synchronized (DesignerLogHandler.getInstance()) {
Level level = event.getLevel();
String msg = this.layout.format(event);
DesignerLogHandler.getInstance().printRemoteLog(msg, level, new Date());
DesignerLogHandler.getInstance().printRemoteLog(msg, FRLogLevel.convertLog4jToJava(level), new Date());
}
}
}

20
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -7,9 +7,9 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.*;
import com.fr.log.LogHandler;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.LogRecordTimeProvider;
import org.apache.log4j.Level;
import javax.swing.*;
import javax.swing.text.*;
@ -17,14 +17,15 @@ import java.awt.*;
import java.awt.event.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class DesignerLogHandler {
protected static final int INFO_INT = FRLogLevel.INFO.toInt();
protected static final int ERRO_INT = FRLogLevel.ERROR.toInt();
protected static final int SERVER_INT = FRLogLevel.SEVERE.toInt();
protected static final int INFO_INT = FRLogLevel.INFO.intValue();
protected static final int ERRO_INT = FRLogLevel.ERROR.intValue();
protected static final int SERVER_INT = FRLogLevel.SEVERE.intValue();
private static final int GAP_X = -150;
private static final int INFO_GAP_Y = -60;
private static final int ERRO_GAP_Y = -40;
@ -35,7 +36,12 @@ public class DesignerLogHandler {
@Override
public void envChanged() {
// envchange后需要重新读取webinf里的log4j配置, 重新添加appender
FRLogger.getLogger().addLogAppender(new DesignerLogAppender());
FRLogger.getLogger().addLogAppender(new LogHandler<DesignerLogAppender>() {
@Override
public DesignerLogAppender getHandler() {
return new DesignerLogAppender();
}
});
}
});
}
@ -99,7 +105,7 @@ public class DesignerLogHandler {
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu showsetPopup = new JPopupMenu();
int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().toInt();
int logLevelvalue = DesignerEnvManager.getEnvManager().getLogLevel().intValue();
if (logLevelvalue <= INFO_INT) {
showsetPopup.add(showInfo);
showsetPopup.add(showError);
@ -211,7 +217,7 @@ public class DesignerLogHandler {
}
public void printStackTrace(String message, Level level, Date date) {
int logLevelvalue = level.toInt();
int logLevelvalue = level.intValue();
if (logLevelvalue == INFO_INT && showInfo.isSelected()) {
printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == ERRO_INT && showError.isSelected()) {

Loading…
Cancel
Save