1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.dy.rtuMw.server.forTcp;
 
import org.apache.logging.log4j.*;
 
import com.dy.rtuMw.resource.ResourceUnit;
import com.dy.rtuMw.resource.rtuLog.RtuLogNode;
 
 
public class RtuLogDealer {
    private static Logger log = LogManager.getLogger(RtuLogDealer.class.getName()) ;
    /**
     * 记录Rtu日志
     * @param rtuAddr
     * @param content
     */
    public static void log(String rtuAddr, String content){
        if(rtuAddr == null || rtuAddr.trim().equals("")){
            log.error("严重错误,记录Rtu日志时,rtu地址未提供!") ;
            return ;
        }
        if(content == null || content.equals("")){
            log.error("严重错误,记录Rtu日志时,日志内容未提供!") ;
            return ;
        }
        RtuLogNode logNode = new RtuLogNode(rtuAddr, content) ;
        
        ResourceUnit.getInstance().rtuLog(logNode);
        
        /////////////////////
        // 或者向消息中间件发消息
        ////////////////////
    }
 
}