拆分appium和agent的日志

master
yineng.huang 2024-08-06 16:44:05 +08:00
parent b56418e3b9
commit 2fa3e721df
2 changed files with 8 additions and 2 deletions

View File

@ -484,7 +484,9 @@ public class AndroidDeviceInitThread extends Thread {
if (!dir.exists()) {
dir.mkdirs();
}
File agentFile = new File(dir.getAbsolutePath() + "/" + adbDevice.getSerial().replaceAll(":", ".") + "_agent.log");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
String format = simpleDateFormat.format(new Date());
File agentFile = new File(dir.getAbsolutePath() + "/" + adbDevice.getSerial().replaceAll(":", ".") + "_" +format+ "_agent.log");
FileWriter fileWriter = null;
BufferedWriter writer = null;
try {

View File

@ -5,7 +5,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
/**
* @author : yineng.huang
@ -36,7 +38,9 @@ public class AppiumEnvironmentThread extends Thread {
if (!logPath.exists()) {
logPath.mkdirs();
}
File logFile = new File(logPath.getAbsolutePath() + "/appium.log");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
String format = simpleDateFormat.format(new Date());
File logFile = new File(logPath.getAbsolutePath() + "/appium-" + format + ".log");
FileWriter fileWriter = null;
BufferedWriter writer = null;
BufferedReader reader = null;