mac 支持 /home 文件夹,无需特殊处理
client 调整,将中文去除掉
This commit is contained in:
@@ -7,7 +7,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -30,11 +29,17 @@ public class LogService {
|
||||
session.connect(3000);
|
||||
}
|
||||
ChannelSftp sftp = (ChannelSftp) session.openChannel("sftp");
|
||||
File file = new File("/home/venue/logs/common-default.log");
|
||||
if (file.exists()) {
|
||||
File file1 = new File("/home/venue/logs/common-default.log");
|
||||
File file2 = new File("/home/venue/logs/common-error.log");
|
||||
if (file1.exists() || file2.exists()) {
|
||||
sftp.connect();
|
||||
sftp.put(new FileInputStream(file), "/home/uploadlog/" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client.log");
|
||||
logger.info("上传日志成功");
|
||||
if (file1.exists()){
|
||||
sftp.put(new FileInputStream(file1), "/home/uploadlog/" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client-common.log");
|
||||
}
|
||||
if (file2.exists()) {
|
||||
sftp.put(new FileInputStream(file2), "/home/uploadlog/" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client-error.log");
|
||||
}
|
||||
logger.info("upload logs success");
|
||||
}
|
||||
if (sftp != null) {
|
||||
sftp.disconnect();
|
||||
@@ -43,7 +48,7 @@ public class LogService {
|
||||
session.disconnect();
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("上传日志失败",e);
|
||||
logger.error("upload log fail",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user