Browse Source

CORE-113 Session管理中心改进+删除侵入性强的日志代码,待重构,不影响基本功能

master
richie 6 years ago
parent
commit
3724be47b6
  1. 24
      designer-base/src/main/java/com/fr/file/FileFILE.java
  2. 12
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java

24
designer-base/src/main/java/com/fr/file/FileFILE.java

@ -1,23 +1,22 @@
package com.fr.file; package com.fr.file;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import javax.swing.Icon;
import javax.swing.filechooser.FileSystemView;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.gui.itree.filetree.FileComparator; import com.fr.design.gui.itree.filetree.FileComparator;
import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.gui.itree.filetree.FileTreeIcon;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogManager; import com.fr.general.SessionLocalManager;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.filechooser.FileSystemView;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
public class FileFILE implements FILE { public class FileFILE implements FILE {
private File file; private File file;
@ -199,12 +198,11 @@ public class FileFILE implements FILE {
if (file == null || !file.exists()) { if (file == null || !file.exists()) {
return null; return null;
} }
FRLogManager.declareResourceWriteStart(file.getAbsolutePath());
java.io.OutputStream out = null; java.io.OutputStream out = null;
try { try {
out = new FileOutputStream(file); out = new FileOutputStream(file);
} catch (Exception e) { } catch (Exception e) {
throw FRLogManager.createLogPackedException(e); throw SessionLocalManager.createLogPackedException(e);
} }
return out; return out;
} }

12
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java

@ -4,19 +4,19 @@ import com.fr.base.io.IOFile;
import com.fr.base.io.XMLReadHelper; import com.fr.base.io.XMLReadHelper;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.general.FRLogManager; import com.fr.general.SessionLocalManager;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.LogDuration;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.web.SessionProvider;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.apache.log4j.AppenderSkeleton; import com.fr.third.apache.log4j.AppenderSkeleton;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent; import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.web.core.SessionDealWith; import com.fr.web.core.SessionPoolManager;
import com.fr.web.core.SessionIDInfor; import com.fr.web.core.TemplateSessionIDInfo;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -96,13 +96,13 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
} }
private String readTemplateID() { private String readTemplateID() {
LogDuration logDuration = FRLogManager.getSession(); SessionProvider logDuration = SessionLocalManager.getSession();
if (logDuration == null) { if (logDuration == null) {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
String sessionID = logDuration.getSessionID(); String sessionID = logDuration.getSessionID();
SessionIDInfor infor = SessionDealWith.getSessionIDInfor(sessionID); TemplateSessionIDInfo infor = SessionPoolManager.getSessionIDInfor(sessionID, TemplateSessionIDInfo.class);
if (infor == null) { if (infor == null) {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }

Loading…
Cancel
Save