diff --git a/src/main/java/com/profiler/bootstrap/ClassPathResolver.java b/src/main/java/com/profiler/bootstrap/ClassPathResolver.java index 46e1b0ce9..2c6d67aa6 100644 --- a/src/main/java/com/profiler/bootstrap/ClassPathResolver.java +++ b/src/main/java/com/profiler/bootstrap/ClassPathResolver.java @@ -109,6 +109,10 @@ public class ClassPathResolver { return this.agentDirPath + File.separator + "lib"; } + public String getAgentLogFilePath() { + return this.agentDirPath + File.separator + "log"; + } + public List resolveLib() { String agentLibPath = getAgentLibPath(); File libDir = new File(agentLibPath); diff --git a/src/main/java/com/profiler/bootstrap/TomcatBootStrap.java b/src/main/java/com/profiler/bootstrap/TomcatBootStrap.java index 4f6b62871..adb409140 100644 --- a/src/main/java/com/profiler/bootstrap/TomcatBootStrap.java +++ b/src/main/java/com/profiler/bootstrap/TomcatBootStrap.java @@ -38,16 +38,16 @@ public class TomcatBootStrap { // 설정파일을 못찾으므로 종료. return; } + // 로그가 저장될 위치를 시스템 properties로 저장한다. + saveLogFilePath(classPathResolver); - // 이게 로드할 lib List임. - try { // 설정파일 로드 이게 bootstrap에 있어야 되나는게 맞나? ProfilerConfig profilerConfig = new ProfilerConfig(); profilerConfig.readConfigFile(configPath); - + // 이게 로드할 lib List임. List libUrlList = resolveLib(classPathResolver); AgentClassLoader agentClassLoader = new AgentClassLoader(libUrlList.toArray(new URL[libUrlList.size()])); agentClassLoader.setBootClass("com.profiler.DefaultAgent"); @@ -59,6 +59,13 @@ public class TomcatBootStrap { } + private static void saveLogFilePath(ClassPathResolver classPathResolver) { + String agentLogFilePath = classPathResolver.getAgentLogFilePath(); + logger.info("logPath:" + agentLogFilePath); + + System.setProperty(ProductInfo.NAME + "." + "log", agentLogFilePath); + } + private static String getConfigPath(ClassPathResolver classPathResolver) { final String configName = ProductInfo.NAME + ".config"; String hippoConfigFormSystemProperty = System.getProperty(configName);