检查 logpath 入参

This commit is contained in:
cheney 2025-07-08 13:56:04 +08:00
parent dcd4b91b57
commit d950ae74db
4 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,6 @@
# 应用配置
# 调试模式 (true/false)
debug=false
debug=true
# 地址列表 (格式: addX=ip:port)
addr1=172.1.41.129:8889

View File

@ -62,7 +62,7 @@ public class LogFactory {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// 日志打印方式输出为文件   
Appender appender = FileAppender.createAppender(
String.format( pcLogPath +"sydapi_"+ format.format(new Date()) + ".log"),
String.format( pcLogPath + "sydapi_"+ format.format(new Date()) + ".log"),
"true", "false",
logName, null, "true", "true", null, layout, null, null, null, config);
@ -96,6 +96,13 @@ public class LogFactory {
* @return Logger
*/
public static Logger createLogger(String pcLogPath, int iLogLevel) {
if( null == pcLogPath || pcLogPath.trim().equals("") ) {
pcLogPath = "./";
}
if( ! pcLogPath.endsWith("/") ) {
pcLogPath = pcLogPath + "/";
}
LogFactory.pcLogPath = pcLogPath;
LogFactory.iLogLevel = iLogLevel;
start();

View File

@ -111,12 +111,14 @@ public class TestAll {
switch (choise.getAsInt()) {
case 1:
SydApi.SYD_SetLogConfig("./logs", 3);
funcMenu(config, choise, test);
break;
case 2:
test.funcAll();
break;
case 3:
SydApi.SYD_SetLogConfig("./logs", 0);
perfMenu(config, choise, test);
break;
case 4:
@ -1212,7 +1214,7 @@ public class TestAll {
public static void funcMenu(Config config, Choise choise, TestAll test) throws Exception{
boolean flag = true;
SydApi.SYD_SetLogConfig("./logs", 3);
while (flag) {
System.out.println("请选择测试项:");
System.out.println("1. 日志测试");
@ -1397,4 +1399,10 @@ public class TestAll {
menu1(config, choise, test);
}
void testComm(){
String hex = "0436000000000000000E453030383130534B303030303030303030303030303030303030413030303030303030303031303030303234303000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
}
}

Binary file not shown.