日志
This commit is contained in:
@@ -5,6 +5,12 @@ public class Consts {
|
||||
public static final int ECB_ENC = 1;
|
||||
|
||||
|
||||
public static final int LogLevelOFF = 0;
|
||||
public static final int LogLevelError = 1;
|
||||
public static final int LogLevelInfo = 2;
|
||||
public static final int LogLevelDebug = 3;
|
||||
|
||||
|
||||
// 唯一包
|
||||
public static final int PkgNumAll = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.sunyard.sge.database;
|
||||
|
||||
import com.sunyard.sge.log.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import racal.sunyard.main.SydApi4j;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,6 +27,8 @@ public interface SydApi {
|
||||
String pcLogPath,
|
||||
int iLogLevel) {
|
||||
|
||||
Logger logger = LogFactory.createLogger(pcLogPath, iLogLevel);
|
||||
SydApi4j.setLogger( logger );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,14 @@ public class SydApi4Database implements SydApi {
|
||||
|
||||
private SydApi4j[] hsms = null;
|
||||
|
||||
@Deprecated
|
||||
public SydApi4Database() {
|
||||
}
|
||||
|
||||
public SydApi4Database(SydApi4j[] hsms) {
|
||||
this.hsms = hsms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SydApi SYD_Connect_Ex(String[] pcIpList, int[] iPortList, int iConnectTimeOut, int iDealTimeOut) {
|
||||
SydApi4j api = (SydApi4j) new SydApi4j().connect(pcIpList[0], iPortList[0], null, iConnectTimeOut);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.sunyard.sge.database.pool;
|
||||
|
||||
import com.sunyard.sge.database.SydApi;
|
||||
import com.sunyard.sge.database.SydApi4Database;
|
||||
import com.sunyard.sge.pool.ThreadBasedConnectPool;
|
||||
import racal.sunyard.main.SydApi4j;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class SydApiPool extends ThreadBasedConnectPool<SydApi> {
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return new SydApi4Database( apis );
|
||||
}
|
||||
|
||||
// 保活接口
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sunyard.sge.log;
|
||||
|
||||
import com.sunyard.sge.database.Consts;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.core.Appender;
|
||||
@@ -27,11 +28,7 @@ public class LogFactory {
|
||||
public static final String logName = "sge-hsm-sydapi-log";
|
||||
|
||||
// 日志级别
|
||||
public static final int LogLevelOFF = 0;
|
||||
public static final int LogLevelError = 1;
|
||||
public static final int LogLevelInfo = 2;
|
||||
public static final int LogLevelDebug = 3;
|
||||
public static int iLogLevel = LogLevelDebug;
|
||||
public static int iLogLevel = Consts.LogLevelOFF;
|
||||
|
||||
// Levels
|
||||
public static final Level[] levels = new Level[]{ Level.OFF, Level.ERROR, Level.INFO, Level.DEBUG };
|
||||
@@ -100,7 +97,9 @@ public class LogFactory {
|
||||
* 创建 Logger
|
||||
* @return Logger
|
||||
*/
|
||||
public static Logger createLogger() {
|
||||
public static Logger createLogger(String pcLogPath, int iLogLevel) {
|
||||
LogFactory.pcLogPath = pcLogPath;
|
||||
LogFactory.iLogLevel = iLogLevel;
|
||||
start();
|
||||
return LoggerFactory.getLogger( logName );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user