Add agent version to startup logs
@@ -21,6 +21,7 @@ package co.elastic.apm.configuration;
import co.elastic.apm.context.LifecycleListener;
import co.elastic.apm.impl.ElasticApmTracer;
+import co.elastic.apm.util.VersionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.stagemonitor.configuration.ConfigurationOption;
@@ -35,6 +36,16 @@ import org.stagemonitor.configuration.ConfigurationOption;
public class StartupInfo implements LifecycleListener {
private static final Logger logger = LoggerFactory.getLogger(StartupInfo.class);
+ private final String elasticApmVersion;
+
+ public StartupInfo() {
+ final String version = VersionUtils.getVersionFromPomProperties(getClass(), "co.elastic.apm", "elastic-apm-agent");
+ if (version != null) {
+ elasticApmVersion = version;
+ } else {
+ elasticApmVersion = "(unknown version)";
+ }
+ }
private static String getJvmAndOsVersionString() {
return "Java " + System.getProperty("java.version") + " (" + System.getProperty("java.vendor") + ") " +
@@ -43,7 +54,7 @@ public class StartupInfo implements LifecycleListener {
@Override
public void start(ElasticApmTracer tracer) {
- logger.info("Starting Elastic APM on {}", getJvmAndOsVersionString());
+ logger.info("Starting Elastic APM {} on {}", elasticApmVersion, getJvmAndOsVersionString());
for (ConfigurationOption<?> option : tracer.getConfigurationRegistry().getConfigurationOptionsByKey().values()) {
if (!option.isDefault()) {
logger.debug("{}: '{}' (source: {})", option.getKey(),
