Browse Source

REPORT-15183 10.0远程日志输出接口(日志分类插件需求)

bugfix/10.0
zack 6 years ago
parent
commit
5f66ef3f08
  1. 16
      designer-base/src/main/java/com/fr/design/fun/DesignerLoggingProcessor.java
  2. 17
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractDesignerLoggingProcessor.java
  3. 7
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

16
designer-base/src/main/java/com/fr/design/fun/DesignerLoggingProcessor.java

@ -0,0 +1,16 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Immutable;
import com.fr.third.apache.log4j.spi.LoggingEvent;
public interface DesignerLoggingProcessor extends Immutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "DesignerLoggingProcessor";
/**
* 输出日志对象
* @param loggingEvent 日志对象
*/
void printLoggingEvent(LoggingEvent loggingEvent);
}

17
designer-base/src/main/java/com/fr/design/fun/impl/AbstractDesignerLoggingProcessor.java

@ -0,0 +1,17 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.DesignerLoggingProcessor;
import com.fr.stable.fun.mark.API;
@API(level = DesignerLoggingProcessor.CURRENT_LEVEL)
public abstract class AbstractDesignerLoggingProcessor implements DesignerLoggingProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

7
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -3,6 +3,8 @@ package com.fr.design.mainframe.socketio;
import com.fr.config.RemoteConfigEvent; import com.fr.config.RemoteConfigEvent;
import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.EnvChangeEntrance; import com.fr.design.EnvChangeEntrance;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.DesignerLoggingProcessor;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.design.mainframe.loghandler.DesignerLogHandler;
@ -46,7 +48,12 @@ public class DesignerSocketIO {
if (ArrayUtils.isNotEmpty(objects)) { if (ArrayUtils.isNotEmpty(objects)) {
try { try {
LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]); LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]);
DesignerLoggingProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerLoggingProcessor.XML_TAG);
if (processor != null) {
processor.printLoggingEvent(event);
}else {
DesignerLogHandler.getInstance().printLoggingEvent(event); DesignerLogHandler.getInstance().printLoggingEvent(event);
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

Loading…
Cancel
Save