Skip to content

Commit 68e07d5

Browse files
committed
and config dir
1 parent deb4dbc commit 68e07d5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

agent/runtime-attach/src/main/java/com/microsoft/applicationinsights/attach/ApplicationInsights.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static void attach() {
5656
try {
5757
Optional<String> jsonConfig = findJsonConfigFromClasspath();
5858
if (!jsonConfig.isPresent()) {
59-
jsonConfig = findJsonConfigFromDefaultFileInCurrentDir();
59+
jsonConfig = findJsonConfigFromFileSystem();
6060
}
6161
if (jsonConfig.isPresent()) {
6262
System.setProperty(RUNTIME_ATTACHED_JSON_PROPERTY, jsonConfig.get());
@@ -85,7 +85,7 @@ private static Optional<String> findJsonConfigFromClasspath() {
8585
return Optional.of(json);
8686
}
8787

88-
private static Optional<String> findJsonConfigFromDefaultFileInCurrentDir() {
88+
private static Optional<String> findJsonConfigFromFileSystem() {
8989

9090
InputStream configContentAsInputStream = findDefaultFileInCurrentDirAsStream();
9191

@@ -118,7 +118,10 @@ private static InputStream findResourceAsStream(String fileName) {
118118
}
119119

120120
private static InputStream findDefaultFileInCurrentDirAsStream() {
121-
File defaultFile = new File("applicationinsights.json");
121+
File defaultFile = new File("config/applicationinsights.json");
122+
if (!defaultFile.exists()) {
123+
defaultFile = new File("applicationinsights.json");
124+
}
122125
if (!defaultFile.exists()) {
123126
return null;
124127
}

0 commit comments

Comments
 (0)