Add warning message if the Java agent is in the class path
This commit is contained in:
Родитель
8c2d9e6116
Коммит
a3e3d0489e
|
@ -118,9 +118,19 @@ public class FirstEntryPoint implements LoggingCustomizer {
|
|||
startupLogger.debug("JAVA_TOOL_OPTIONS: " + System.getenv("JAVA_TOOL_OPTIONS"));
|
||||
}
|
||||
|
||||
String classPath = System.getProperty("java.class.path");
|
||||
// class path null with a Spring Boot executable JAR
|
||||
if (classPath != null
|
||||
&& classPath.contains(
|
||||
"applicationinsights-agent")) { // JAR name in Maven central, the user could have
|
||||
// renamed it
|
||||
startupLogger.warn(
|
||||
"The applicationinsights-agent JAR is in the class path. You should remove it because it could lead to unexpected results. You should configure the Java agent with -javaagent. You can also use the runtime attachment with Spring Boot applications.");
|
||||
}
|
||||
|
||||
if (startupLogger.isTraceEnabled()) {
|
||||
startupLogger.trace("OS: " + System.getProperty("os.name"));
|
||||
startupLogger.trace("Classpath: " + System.getProperty("java.class.path"));
|
||||
startupLogger.trace("Classpath: " + classPath);
|
||||
startupLogger.trace("Netty versions: " + NettyVersions.extract());
|
||||
startupLogger.trace("Env: " + System.getenv());
|
||||
startupLogger.trace("System properties: " + findSystemProperties());
|
||||
|
|
Загрузка…
Ссылка в новой задаче