diff --git a/docs/IMPLEMENTING_CONTAINERS.md b/docs/IMPLEMENTING_CONTAINERS.md index 518610215..929607b50 100644 --- a/docs/IMPLEMENTING_CONTAINERS.md +++ b/docs/IMPLEMENTING_CONTAINERS.md @@ -663,7 +663,7 @@ func (t *TomcatContainer) Supply() error { return fmt.Errorf("failed to install Tomcat: %w", err) } - t.context.Log.Info("Installed Tomcat version %s", dep.Version) + t.context.Log.Info("Installed Tomcat (%s)", dep.Version) // Write profile.d script depsIdx := t.context.Stager.DepsIdx() diff --git a/src/integration/dist_zip_test.go b/src/integration/dist_zip_test.go index 9d5090c9e..75e22c275 100644 --- a/src/integration/dist_zip_test.go +++ b/src/integration/dist_zip_test.go @@ -71,7 +71,7 @@ func testDistZip(platform switchblade.Platform, fixtures string) func(*testing.T Expect(err).NotTo(HaveOccurred(), logs.String) Expect(logs.String()).To(ContainSubstring("Java Buildpack")) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 8.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (8.")) Eventually(deployment).Should(matchers.Serve(Not(BeEmpty()))) }) @@ -84,7 +84,7 @@ func testDistZip(platform switchblade.Platform, fixtures string) func(*testing.T Expect(err).NotTo(HaveOccurred(), logs.String) Expect(logs.String()).To(ContainSubstring("Java Buildpack")) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17.")) Eventually(deployment).Should(matchers.Serve(Not(BeEmpty()))) }) }) diff --git a/src/integration/ratpack_test.go b/src/integration/ratpack_test.go index fbca2e65e..8a849f8f6 100644 --- a/src/integration/ratpack_test.go +++ b/src/integration/ratpack_test.go @@ -71,7 +71,7 @@ func testRatpack(platform switchblade.Platform, fixtures string) func(*testing.T Expect(err).NotTo(HaveOccurred(), logs.String) Expect(logs.String()).To(ContainSubstring("Java Buildpack")) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17.")) Eventually(deployment).Should(matchers.Serve(Not(BeEmpty()))) }) }) diff --git a/src/integration/spring_boot_cli_test.go b/src/integration/spring_boot_cli_test.go index d89f787bf..83b1699c8 100644 --- a/src/integration/spring_boot_cli_test.go +++ b/src/integration/spring_boot_cli_test.go @@ -107,7 +107,7 @@ func testSpringBootCLI(platform switchblade.Platform, fixtures string) func(*tes Expect(err).NotTo(HaveOccurred(), logs.String) Expect(logs.String()).To(ContainSubstring("Java Buildpack")) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17.")) Eventually(deployment).Should(matchers.Serve(Not(BeEmpty()))) }) }) diff --git a/src/integration/tomcat_test.go b/src/integration/tomcat_test.go index eb8bddecf..6e0aa362a 100644 --- a/src/integration/tomcat_test.go +++ b/src/integration/tomcat_test.go @@ -170,7 +170,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Execute(name, filepath.Join(fixtures, "containers", "tomcat_javax")) Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 8.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (8.")) Expect(logs.String()).To(ContainSubstring("Tomcat 9")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -184,7 +184,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Execute(name, filepath.Join(fixtures, "containers", "tomcat_javax")) Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 11.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (11.")) Expect(logs.String()).To(ContainSubstring("Tomcat 9")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -197,7 +197,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Execute(name, filepath.Join(fixtures, "containers", "tomcat_javax")) Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17.")) Expect(logs.String()).To(ContainSubstring("Tomcat 9")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -223,7 +223,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Execute(name, filepath.Join(fixtures, "containers", "tomcat_jakarta")) Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 11.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (11.")) Expect(logs.String()).To(ContainSubstring("Tomcat 10")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -236,7 +236,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Execute(name, filepath.Join(fixtures, "containers", "tomcat_jakarta")) Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17.")) Expect(logs.String()).To(ContainSubstring("Tomcat 10")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -257,7 +257,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17.")) Expect(logs.String()).To(ContainSubstring("Tomcat 10.1.")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -274,7 +274,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 11.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (11.")) Expect(logs.String()).To(ContainSubstring("memory")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -320,7 +320,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 21.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (21.")) Expect(logs.String()).To(ContainSubstring("Tomcat")) // If deployment succeeds, it means: @@ -343,7 +343,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17.")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -356,7 +356,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 21.")) + Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (21.")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) }) @@ -371,7 +371,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing SAP Machine 17.")) + Expect(logs.String()).To(ContainSubstring("Installing SAP Machine (17.")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -384,7 +384,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing SAP Machine 21.")) + Expect(logs.String()).To(ContainSubstring("Installing SAP Machine (21.")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) @@ -397,7 +397,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T, Expect(err).NotTo(HaveOccurred(), logs.String) - Expect(logs.String()).To(ContainSubstring("Installing SAP Machine 25.")) + Expect(logs.String()).To(ContainSubstring("Installing SAP Machine (25.")) Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK"))) }) }) diff --git a/src/java/containers/tomcat.go b/src/java/containers/tomcat.go index 5b4aeefff..fab4713ee 100644 --- a/src/java/containers/tomcat.go +++ b/src/java/containers/tomcat.go @@ -120,7 +120,7 @@ func (t *TomcatContainer) Supply() error { return fmt.Errorf("failed to install Tomcat: %w", err) } - t.context.Log.Info("Installed Tomcat version %s", dep.Version) + t.context.Log.Info("Installed Tomcat (%s)", dep.Version) // Get buildpack index for multi-buildpack support depsIdx := t.context.Stager.DepsIdx() diff --git a/src/java/finalize/finalize.go b/src/java/finalize/finalize.go index 30ae68844..9cb7d444c 100644 --- a/src/java/finalize/finalize.go +++ b/src/java/finalize/finalize.go @@ -153,14 +153,12 @@ func (f *Finalizer) finalizeJRE() error { return fmt.Errorf("failed to finalize JRE %s: %w", f.JREName, err) } - f.Log.Info("JRE finalization complete") + f.Log.Debug("JRE finalization complete") return nil } // finalizeFrameworks finalizes framework components (APM agents, etc.) func (f *Finalizer) finalizeFrameworks(ctx *common.Context) error { - f.Log.BeginStep("Finalizing frameworks") - registry := frameworks.NewRegistry(ctx) registry.RegisterStandardFrameworks() @@ -175,10 +173,10 @@ func (f *Finalizer) finalizeFrameworks(ctx *common.Context) error { return nil } - f.Log.Info("Finalizing frameworks: [%v]", strings.Join(frameworkNames, ",")) + f.Log.BeginStep("Finalizing frameworks [%v]", strings.Join(frameworkNames, ", ")) for i, framework := range detectedFrameworks { - f.Log.Info("Finalizing framework: %s", frameworkNames[i]) + f.Log.Debug("Finalizing framework: %s", frameworkNames[i]) if err := framework.Finalize(); err != nil { f.Log.Warning("Failed to finalize framework %s: %s", frameworkNames[i], err.Error()) // Continue with other frameworks even if one fails diff --git a/src/java/frameworks/app_dynamics.go b/src/java/frameworks/app_dynamics.go index 6c42d17d1..4c94264cc 100644 --- a/src/java/frameworks/app_dynamics.go +++ b/src/java/frameworks/app_dynamics.go @@ -47,7 +47,7 @@ func (a *AppDynamicsFramework) findAppDynamicsAgent(agentDir string) (string, er // Supply installs the AppDynamics agent func (a *AppDynamicsFramework) Supply() error { - a.context.Log.BeginStep("Installing AppDynamics Agent") + a.context.Log.Debug("Installing AppDynamics Agent") // Get AppDynamics agent dependency from manifest dep, err := a.context.Manifest.DefaultVersion("appdynamics") @@ -70,7 +70,7 @@ func (a *AppDynamicsFramework) Supply() error { a.context.Log.Warning("Could not install default AppDynamics configuration: %s", err.Error()) } - a.context.Log.Info("Installed AppDynamics Agent version %s", dep.Version) + a.context.Log.Debug("Installed AppDynamics Agent version %s", dep.Version) return nil } @@ -102,7 +102,7 @@ func (a *AppDynamicsFramework) installDefaultConfiguration(agentDir string) erro return fmt.Errorf("failed to write app-agent-config.xml: %w", err) } - a.context.Log.Info("Installed default AppDynamics configuration") + a.context.Log.Debug("Installed default AppDynamics configuration") a.context.Log.Debug(" - app-agent-config.xml (agent settings and filters)") return nil } @@ -189,3 +189,7 @@ func (a *AppDynamicsFramework) Finalize() error { a.context.Log.Info("Configured AppDynamics Agent for runtime (priority 11)") return nil } + +func (a *AppDynamicsFramework) DependencyIdentifier() string { + return "appdynamics" +} diff --git a/src/java/frameworks/aspectj_weaver_agent.go b/src/java/frameworks/aspectj_weaver_agent.go index e1c2b142c..afebdad80 100644 --- a/src/java/frameworks/aspectj_weaver_agent.go +++ b/src/java/frameworks/aspectj_weaver_agent.go @@ -99,7 +99,7 @@ func (a *AspectJWeaverAgentFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - a.context.Log.Info("AspectJ Weaver Agent configured successfully (priority 12)") + a.context.Log.Debug("AspectJ Weaver Agent configured successfully (priority 12)") return nil } diff --git a/src/java/frameworks/azure_application_insights_agent.go b/src/java/frameworks/azure_application_insights_agent.go index b80f47530..c03a56f97 100644 --- a/src/java/frameworks/azure_application_insights_agent.go +++ b/src/java/frameworks/azure_application_insights_agent.go @@ -82,7 +82,7 @@ func (a *AzureApplicationInsightsAgentFramework) Detect() (string, error) { // Supply downloads and installs the Azure Application Insights agent func (a *AzureApplicationInsightsAgentFramework) Supply() error { - a.context.Log.BeginStep("Installing Azure Application Insights agent") + a.context.Log.Debug("Installing Azure Application Insights agent") // Get dependency from manifest dep, err := a.context.Manifest.DefaultVersion("azure-application-insights") @@ -134,7 +134,7 @@ func (a *AzureApplicationInsightsAgentFramework) installDefaultConfiguration(age return fmt.Errorf("failed to write AI-Agent.xml: %w", err) } - a.context.Log.Info("Installed default Azure Application Insights configuration") + a.context.Log.Debug("Installed default Azure Application Insights configuration") a.context.Log.Debug(" - AI-Agent.xml (instrumentation settings)") return nil } @@ -185,7 +185,7 @@ func (a *AzureApplicationInsightsAgentFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for Azure Application Insights: %w", err) } - a.context.Log.Info("Azure Application Insights agent configured") + a.context.Log.Debug("Azure Application Insights agent configured") return nil } @@ -289,3 +289,7 @@ func (a *AzureApplicationInsightsAgentFramework) constructJarPath(agentDir strin a.jarPath = matches[0] return nil } + +func (a *AzureApplicationInsightsAgentFramework) DependencyIdentifier() string { + return "azure-application-insights" +} diff --git a/src/java/frameworks/checkmarx_iast_agent.go b/src/java/frameworks/checkmarx_iast_agent.go index 1cef5b317..36e853e3f 100644 --- a/src/java/frameworks/checkmarx_iast_agent.go +++ b/src/java/frameworks/checkmarx_iast_agent.go @@ -62,7 +62,7 @@ func (c *CheckmarxIASTAgentFramework) Detect() (string, error) { // Supply downloads and installs the Checkmarx IAST agent func (c *CheckmarxIASTAgentFramework) Supply() error { - c.context.Log.BeginStep("Installing Checkmarx IAST agent") + c.context.Log.Debug("Installing Checkmarx IAST agent") // Get credentials from service binding credentials := c.getCredentials() @@ -126,7 +126,7 @@ func (c *CheckmarxIASTAgentFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for Checkmarx IAST: %w", err) } - c.context.Log.Info("Checkmarx IAST agent configured") + c.context.Log.Debug("Checkmarx IAST agent configured") return nil } diff --git a/src/java/frameworks/client_certificate_mapper.go b/src/java/frameworks/client_certificate_mapper.go index f0fae5ed4..60e820730 100644 --- a/src/java/frameworks/client_certificate_mapper.go +++ b/src/java/frameworks/client_certificate_mapper.go @@ -39,7 +39,7 @@ func (c *ClientCertificateMapperFramework) Detect() (string, error) { // Supply installs the client certificate mapper JAR func (c *ClientCertificateMapperFramework) Supply() error { - c.context.Log.BeginStep("Installing Client Certificate Mapper") + c.context.Log.Debug("Installing Client Certificate Mapper") // Get client-certificate-mapper dependency from manifest dep, err := c.context.Manifest.DefaultVersion("client-certificate-mapper") @@ -53,7 +53,7 @@ func (c *ClientCertificateMapperFramework) Supply() error { return fmt.Errorf("failed to install Client Certificate Mapper: %w", err) } - c.context.Log.Info("Installed Client Certificate Mapper version %s", dep.Version) + c.context.Log.Debug("Installed Client Certificate Mapper version %s", dep.Version) return nil } @@ -71,15 +71,15 @@ func (c *ClientCertificateMapperFramework) Finalize() error { depsIdx := c.context.Stager.DepsIdx() runtimePath := fmt.Sprintf("$DEPS_DIR/%s/client_certificate_mapper/%s", depsIdx, filepath.Base(matches[0])) - + profileScript := fmt.Sprintf("export CLASSPATH=\"%s${CLASSPATH:+:$CLASSPATH}\"\n", runtimePath) if err := c.context.Stager.WriteProfileD("client_certificate_mapper.sh", profileScript); err != nil { return fmt.Errorf("failed to write client_certificate_mapper.sh profile.d script: %w", err) } - + c.context.Log.Debug("Client Certificate Mapper JAR will be added to classpath at runtime: %s", runtimePath) - + return nil } @@ -111,3 +111,7 @@ type clientCertificateMapperConfig struct { func (c *clientCertificateMapperConfig) isEnabled() bool { return c.Enabled } + +func (c *ClientCertificateMapperFramework) DependencyIdentifier() string { + return "client-certificate-mapper" +} diff --git a/src/java/frameworks/container_customizer.go b/src/java/frameworks/container_customizer.go index 97b5dbeae..ffebb57fa 100644 --- a/src/java/frameworks/container_customizer.go +++ b/src/java/frameworks/container_customizer.go @@ -79,7 +79,7 @@ func (c *ContainerCustomizerFramework) hasSpringBootJars(buildDir string) bool { // Supply installs the Container Customizer library func (c *ContainerCustomizerFramework) Supply() error { - c.context.Log.BeginStep("Installing Container Customizer") + c.context.Log.Debug("Installing Container Customizer") // Get container-customizer dependency from manifest dep, err := c.context.Manifest.DefaultVersion("container-customizer") @@ -93,7 +93,7 @@ func (c *ContainerCustomizerFramework) Supply() error { return fmt.Errorf("failed to install Container Customizer: %w", err) } - c.context.Log.Info("Installed Container Customizer version %s", dep.Version) + c.context.Log.Debug("Installed Container Customizer version %s", dep.Version) return nil } @@ -134,3 +134,7 @@ export CLASSPATH="%s:${CLASSPATH:-}" return nil } + +func (c *ContainerCustomizerFramework) DependencyIdentifier() string { + return "container-customizer" +} diff --git a/src/java/frameworks/container_security_provider.go b/src/java/frameworks/container_security_provider.go index 4773390e6..473656d65 100644 --- a/src/java/frameworks/container_security_provider.go +++ b/src/java/frameworks/container_security_provider.go @@ -28,7 +28,7 @@ func (c *ContainerSecurityProviderFramework) Detect() (string, error) { // Supply installs the container security provider JAR func (c *ContainerSecurityProviderFramework) Supply() error { - c.context.Log.BeginStep("Installing Container Security Provider") + c.context.Log.Debug("Installing Container Security Provider") // Get container-security-provider dependency from manifest dep, err := c.context.Manifest.DefaultVersion("container-security-provider") @@ -42,7 +42,7 @@ func (c *ContainerSecurityProviderFramework) Supply() error { return fmt.Errorf("failed to install Container Security Provider: %w", err) } - c.context.Log.Info("Installed Container Security Provider version %s", dep.Version) + c.context.Log.Debug("Installed Container Security Provider version %s", dep.Version) return nil } @@ -257,3 +257,7 @@ type containerSecurityProviderConfig struct { KeyManagerEnabled string `yaml:"key_manager_enabled"` TrustManagerEnabled string `yaml:"trust_manager_enabled"` } + +func (c *ContainerSecurityProviderFramework) DependencyIdentifier() string { + return "container-security-provider" +} diff --git a/src/java/frameworks/contrast_security_agent.go b/src/java/frameworks/contrast_security_agent.go index 2cc024311..ab17f1865 100644 --- a/src/java/frameworks/contrast_security_agent.go +++ b/src/java/frameworks/contrast_security_agent.go @@ -59,7 +59,7 @@ func (c *ContrastSecurityAgentFramework) findContrastAgent(frameworkDir string) // Supply downloads and installs the Contrast Security agent func (c *ContrastSecurityAgentFramework) Supply() error { - c.context.Log.Info("Installing Contrast Security Agent") + c.context.Log.Debug("Installing Contrast Security Agent") dep, err := c.context.Manifest.DefaultVersion("contrast-security") if err != nil { @@ -157,7 +157,7 @@ func (c *ContrastSecurityAgentFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - c.context.Log.Info("Contrast Security Agent configured successfully (priority 18)") + c.context.Log.Debug("Contrast Security Agent configured successfully (priority 18)") return nil } @@ -237,3 +237,7 @@ func (c *ContrastSecurityAgentFramework) getCredential(key string) string { } return "" } + +func (c *ContrastSecurityAgentFramework) DependencyIdentifier() string { + return "contrast-security" +} diff --git a/src/java/frameworks/datadog_javaagent.go b/src/java/frameworks/datadog_javaagent.go index f767dd1c5..06954e74d 100644 --- a/src/java/frameworks/datadog_javaagent.go +++ b/src/java/frameworks/datadog_javaagent.go @@ -77,7 +77,7 @@ func (d *DatadogJavaagentFramework) Detect() (string, error) { // Supply downloads and installs the Datadog Java agent func (d *DatadogJavaagentFramework) Supply() error { - d.context.Log.BeginStep("Installing Datadog Java agent") + d.context.Log.Debug("Installing Datadog Java agent") // Note: Datadog buildpack is optional but recommended for full functionality if d.hasDatadogBuildpack() { @@ -152,7 +152,7 @@ func (d *DatadogJavaagentFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for Datadog: %w", err) } - d.context.Log.Info("Datadog Java agent configured") + d.context.Log.Debug("Datadog Java agent configured") return nil } @@ -322,3 +322,7 @@ func (d *DatadogJavaagentFramework) constructJarPathAndFixClassCount(datadogDir } return nil } + +func (d *DatadogJavaagentFramework) DependencyIdentifier() string { + return "datadog-javaagent" +} diff --git a/src/java/frameworks/elastic_apm_agent.go b/src/java/frameworks/elastic_apm_agent.go index 16f55ca90..c2b4d8b36 100644 --- a/src/java/frameworks/elastic_apm_agent.go +++ b/src/java/frameworks/elastic_apm_agent.go @@ -59,7 +59,7 @@ func (e *ElasticApmAgentFramework) Detect() (string, error) { // Supply downloads and installs the Elastic APM agent func (e *ElasticApmAgentFramework) Supply() error { - e.context.Log.BeginStep("Installing Elastic APM agent") + e.context.Log.Debug("Installing Elastic APM agent") // Get dependency from manifest dep, err := e.context.Manifest.DefaultVersion("elastic-apm-agent") @@ -133,7 +133,7 @@ func (e *ElasticApmAgentFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for Elastic APM: %w", err) } - e.context.Log.Info("Elastic APM agent configured") + e.context.Log.Debug("Elastic APM agent configured") return nil } @@ -273,3 +273,7 @@ func (e *ElasticApmAgentFramework) constructJarPath(elasticDir string) error { e.jarPath = matches[0] return nil } + +func (e *ElasticApmAgentFramework) DependencyIdentifier() string { + return "elastic-apm-agent" +} diff --git a/src/java/frameworks/framework.go b/src/java/frameworks/framework.go index 6e7a67c04..bf51010af 100644 --- a/src/java/frameworks/framework.go +++ b/src/java/frameworks/framework.go @@ -9,6 +9,12 @@ import ( ) // Framework represents a cross-cutting concern (APM agents, security providers, etc.) +// DependencyIdentifierProvider optionally exposes a manifest dependency identifier +// for frameworks that install a specific dependency artifact. +type DependencyIdentifierProvider interface { + DependencyIdentifier() string +} + type Framework interface { // Detect returns true if this framework should be included // Returns the framework name and version if detected diff --git a/src/java/frameworks/google_stackdriver_profiler.go b/src/java/frameworks/google_stackdriver_profiler.go index d02f2ea89..15c7483f4 100644 --- a/src/java/frameworks/google_stackdriver_profiler.go +++ b/src/java/frameworks/google_stackdriver_profiler.go @@ -70,7 +70,7 @@ func (g *GoogleStackdriverProfilerFramework) Detect() (string, error) { // Supply downloads and installs the Google Stackdriver Profiler func (g *GoogleStackdriverProfilerFramework) Supply() error { - g.context.Log.BeginStep("Installing Google Stackdriver Profiler") + g.context.Log.Debug("Installing Google Stackdriver Profiler") // Get dependency from manifest dep, err := g.context.Manifest.DefaultVersion("google-stackdriver-profiler") @@ -155,7 +155,7 @@ func (g *GoogleStackdriverProfilerFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for Google Stackdriver Profiler: %w", err) } - g.context.Log.Info("Google Stackdriver Profiler configured") + g.context.Log.Debug("Google Stackdriver Profiler configured") return nil } @@ -285,3 +285,7 @@ type googleStackDriveConfig struct { ApplicationName string `yaml:"application_name"` ApplicationVersion string `yaml:"application_version"` } + +func (g *GoogleStackdriverProfilerFramework) DependencyIdentifier() string { + return "google-stackdriver-profiler" +} diff --git a/src/java/frameworks/introscope_agent.go b/src/java/frameworks/introscope_agent.go index 98a71c0cd..a29ed753a 100644 --- a/src/java/frameworks/introscope_agent.go +++ b/src/java/frameworks/introscope_agent.go @@ -49,7 +49,7 @@ func (i *IntroscopeAgentFramework) Detect() (string, error) { // Supply downloads and installs the Introscope agent func (i *IntroscopeAgentFramework) Supply() error { - i.context.Log.BeginStep("Installing Introscope agent") + i.context.Log.Debug("Installing Introscope agent") // Get dependency from manifest dep, err := i.context.Manifest.DefaultVersion("introscope-agent") @@ -126,7 +126,7 @@ func (i *IntroscopeAgentFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for Introscope: %w", err) } - i.context.Log.Info("Introscope agent configured") + i.context.Log.Debug("Introscope agent configured") return nil } @@ -253,3 +253,7 @@ func (i *IntroscopeAgentFramework) constructAgentPath(agentDir string) error { i.agentPath = agentPattern return nil } + +func (i *IntroscopeAgentFramework) DependencyIdentifier() string { + return "introscope-agent" +} diff --git a/src/java/frameworks/jacoco_agent.go b/src/java/frameworks/jacoco_agent.go index 6fe894ff0..791648960 100644 --- a/src/java/frameworks/jacoco_agent.go +++ b/src/java/frameworks/jacoco_agent.go @@ -53,7 +53,7 @@ func (j *JacocoAgentFramework) Detect() (string, error) { // Supply installs the JaCoCo agent func (j *JacocoAgentFramework) Supply() error { - j.context.Log.BeginStep("Installing JaCoCo Agent") + j.context.Log.Debug("Installing JaCoCo Agent") // Get JaCoCo agent dependency from manifest dep, err := j.context.Manifest.DefaultVersion("jacoco") @@ -71,7 +71,7 @@ func (j *JacocoAgentFramework) Supply() error { return fmt.Errorf("failed to install JaCoCo agent: %w", err) } - j.context.Log.Info("Installed JaCoCo Agent version %s", dep.Version) + j.context.Log.Debug("Installed JaCoCo Agent version %s", dep.Version) return nil } @@ -169,6 +169,10 @@ func (j *JacocoAgentFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - j.context.Log.Info("JaCoCo Agent configured (priority 26)") + j.context.Log.Debug("JaCoCo Agent configured (priority 26)") return nil } + +func (j *JacocoAgentFramework) DependencyIdentifier() string { + return "jacoco" +} diff --git a/src/java/frameworks/java_cf_env.go b/src/java/frameworks/java_cf_env.go index 63f4576ad..eb0bd5e23 100644 --- a/src/java/frameworks/java_cf_env.go +++ b/src/java/frameworks/java_cf_env.go @@ -46,7 +46,7 @@ func (j *JavaCfEnvFramework) Detect() (string, error) { // Supply installs the java-cfenv JAR func (j *JavaCfEnvFramework) Supply() error { - j.context.Log.BeginStep("Installing Java CF Env") + j.context.Log.Debug("Installing Java CF Env") // Get java-cfenv dependency from manifest dep, err := j.context.Manifest.DefaultVersion("java-cfenv") @@ -64,7 +64,7 @@ func (j *JavaCfEnvFramework) Supply() error { return fmt.Errorf("failed to install Java CF Env: %w", err) } - j.context.Log.Info("Installed Java CF Env version %s", dep.Version) + j.context.Log.Debug("Installed Java CF Env version %s", dep.Version) return nil } @@ -188,3 +188,7 @@ func (j *JavaCfEnvFramework) hasJavaCfEnv() bool { return false } + +func (j *JavaCfEnvFramework) DependencyIdentifier() string { + return "java-cfenv" +} diff --git a/src/java/frameworks/java_memory_assistant.go b/src/java/frameworks/java_memory_assistant.go index cb29abc52..7b9212f49 100644 --- a/src/java/frameworks/java_memory_assistant.go +++ b/src/java/frameworks/java_memory_assistant.go @@ -39,7 +39,7 @@ func (j *JavaMemoryAssistantFramework) Detect() (string, error) { // Supply installs the Java Memory Assistant agent and cleanup utility func (j *JavaMemoryAssistantFramework) Supply() error { - j.context.Log.BeginStep("Installing Java Memory Assistant") + j.context.Log.Debug("Installing Java Memory Assistant") // Get java-memory-assistant agent dependency from manifest agentDep, err := j.context.Manifest.DefaultVersion("java-memory-assistant") @@ -53,7 +53,7 @@ func (j *JavaMemoryAssistantFramework) Supply() error { return fmt.Errorf("failed to install Java Memory Assistant: %w", err) } - j.context.Log.Info("Installed Java Memory Assistant version %s", agentDep.Version) + j.context.Log.Debug("Installed Java Memory Assistant version %s", agentDep.Version) // Get cleanup utility dependency (optional) cleanupDep, err := j.context.Manifest.DefaultVersion("java-memory-assistant-cleanup") @@ -62,7 +62,7 @@ func (j *JavaMemoryAssistantFramework) Supply() error { if err := j.context.Installer.InstallDependency(cleanupDep, cleanupDir); err != nil { j.context.Log.Warning("Failed to install Java Memory Assistant cleanup utility: %s", err.Error()) } else { - j.context.Log.Info("Installed Java Memory Assistant cleanup utility version %s", cleanupDep.Version) + j.context.Log.Debug("Installed Java Memory Assistant cleanup utility version %s", cleanupDep.Version) } } @@ -111,7 +111,7 @@ func (j *JavaMemoryAssistantFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - j.context.Log.Info("Java Memory Assistant configured (priority 28)") + j.context.Log.Debug("Java Memory Assistant configured (priority 28)") return nil } @@ -282,3 +282,7 @@ type Thresholds struct { type CleanUp struct { MaxDumpCount int `yaml:"max_dump_count"` } + +func (j *JavaMemoryAssistantFramework) DependencyIdentifier() string { + return "java-memory-assistant" +} diff --git a/src/java/frameworks/jprofiler_profiler.go b/src/java/frameworks/jprofiler_profiler.go index 43627e25b..cefd9e190 100644 --- a/src/java/frameworks/jprofiler_profiler.go +++ b/src/java/frameworks/jprofiler_profiler.go @@ -65,7 +65,7 @@ func (f *JProfilerProfilerFramework) Supply() error { // Install directory installDir := filepath.Join(f.context.Stager.DepDir(), "jprofiler_profiler") - f.context.Log.BeginStep("Installing JProfiler Profiler %s", dep.Version) + f.context.Log.Debug("Installing JProfiler Profiler %s", dep.Version) // Download and extract tarball if err := f.context.Installer.InstallDependency(dep, installDir); err != nil { @@ -121,7 +121,7 @@ func (f *JProfilerProfilerFramework) Finalize() error { // Default options: port=8849, nowait (don't wait for profiler UI to connect) port := config.Port nowait := config.NoWait - + // Build agent path with options var agentOptions string if nowait { @@ -137,7 +137,7 @@ func (f *JProfilerProfilerFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - f.context.Log.Info("JProfiler Profiler configured (priority 30)") + f.context.Log.Debug("JProfiler Profiler configured (priority 30)") return nil } diff --git a/src/java/frameworks/jrebel_agent.go b/src/java/frameworks/jrebel_agent.go index dc096c0d2..cc83936c4 100644 --- a/src/java/frameworks/jrebel_agent.go +++ b/src/java/frameworks/jrebel_agent.go @@ -49,7 +49,7 @@ func (j *JRebelAgentFramework) Detect() (string, error) { // Supply downloads and installs the JRebel agent func (j *JRebelAgentFramework) Supply() error { - j.context.Log.Info("Installing JRebel Agent") + j.context.Log.Debug("Installing JRebel Agent") dep, err := j.context.Manifest.DefaultVersion("jrebel") if err != nil { @@ -125,7 +125,7 @@ func (j *JRebelAgentFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - j.context.Log.Info("JRebel Agent configured successfully (priority 31)") + j.context.Log.Debug("JRebel Agent configured successfully (priority 31)") return nil } @@ -157,3 +157,7 @@ type jrebelConfig struct { func (j *jrebelConfig) isEnabled() bool { return j.Enabled } + +func (j *JRebelAgentFramework) DependencyIdentifier() string { + return "jrebel" +} diff --git a/src/java/frameworks/luna_security_provider.go b/src/java/frameworks/luna_security_provider.go index 7524a40c7..f376fa3b6 100644 --- a/src/java/frameworks/luna_security_provider.go +++ b/src/java/frameworks/luna_security_provider.go @@ -42,7 +42,7 @@ func (l *LunaSecurityProviderFramework) Detect() (string, error) { // Supply installs the Luna security provider tarball and credentials func (l *LunaSecurityProviderFramework) Supply() error { - l.context.Log.BeginStep("Installing Luna Security Provider") + l.context.Log.Debug("Installing Luna Security Provider") // Get luna-security-provider dependency from manifest dep, err := l.context.Manifest.DefaultVersion("luna-security-provider") @@ -83,7 +83,7 @@ func (l *LunaSecurityProviderFramework) Supply() error { return fmt.Errorf("failed to write Luna credentials: %w", err) } - l.context.Log.Info("Installed Luna Security Provider version %s", dep.Version) + l.context.Log.Debug("Installed Luna Security Provider version %s", dep.Version) return nil } @@ -109,7 +109,7 @@ func (l *LunaSecurityProviderFramework) installDefaultConfiguration(lunaDir stri return fmt.Errorf("failed to write Chrystoki.conf: %w", err) } - l.context.Log.Info("Installed default Luna configuration") + l.context.Log.Debug("Installed default Luna configuration") l.context.Log.Debug(" - Chrystoki.conf (timeout and connection settings)") return nil } @@ -161,7 +161,7 @@ func (l *LunaSecurityProviderFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - l.context.Log.Info("Luna Security Provider configured (priority 32)") + l.context.Log.Debug("Luna Security Provider configured (priority 32)") return nil } @@ -493,3 +493,7 @@ type lunaSecurityProviderConfig struct { LoggingEnabled bool `yaml:"logging_enabled"` TCPKeepAliveEnabled bool `yaml:"tcp_keep_alive_enabled"` } + +func (l *LunaSecurityProviderFramework) DependencyIdentifier() string { + return "luna-security-provider" +} diff --git a/src/java/frameworks/maria_db_jdbc.go b/src/java/frameworks/maria_db_jdbc.go index 3867494f4..0b76c7c46 100644 --- a/src/java/frameworks/maria_db_jdbc.go +++ b/src/java/frameworks/maria_db_jdbc.go @@ -53,7 +53,7 @@ func (f *MariaDBJDBCFramework) Detect() (string, error) { // Supply downloads and installs the MariaDB JDBC driver func (f *MariaDBJDBCFramework) Supply() error { - f.context.Log.BeginStep("Installing MariaDB JDBC driver") + f.context.Log.Debug("Installing MariaDB JDBC driver") // Get dependency from manifest dep, err := f.context.Manifest.DefaultVersion("mariadb-jdbc") @@ -205,3 +205,7 @@ func (f *MariaDBJDBCFramework) constructJarPath(mariadbDir string) error { f.jarPath = matches[0] return nil } + +func (m *MariaDBJDBCFramework) DependencyIdentifier() string { + return "mariadb-jdbc" +} diff --git a/src/java/frameworks/metric_writer.go b/src/java/frameworks/metric_writer.go index bd4b4294c..d1b3e0d9e 100644 --- a/src/java/frameworks/metric_writer.go +++ b/src/java/frameworks/metric_writer.go @@ -82,7 +82,7 @@ func (m *MetricWriterFramework) hasMicrometer() bool { // Supply installs the Metric Writer library func (m *MetricWriterFramework) Supply() error { - m.context.Log.BeginStep("Installing Metric Writer") + m.context.Log.Debug("Installing Metric Writer") // Get metric-writer dependency from manifest dep, err := m.context.Manifest.DefaultVersion("metric-writer") @@ -96,7 +96,7 @@ func (m *MetricWriterFramework) Supply() error { return fmt.Errorf("failed to install Metric Writer: %w", err) } - m.context.Log.Info("Installed Metric Writer version %s", dep.Version) + m.context.Log.Debug("Installed Metric Writer version %s", dep.Version) return nil } @@ -200,3 +200,7 @@ type metricWriterConfig struct { func (m *metricWriterConfig) isEnabled() bool { return m.Enabled } + +func (m *MetricWriterFramework) DependencyIdentifier() string { + return "metric-writer" +} diff --git a/src/java/frameworks/new_relic.go b/src/java/frameworks/new_relic.go index e3c427004..d9c100809 100644 --- a/src/java/frameworks/new_relic.go +++ b/src/java/frameworks/new_relic.go @@ -55,7 +55,7 @@ func (n *NewRelicFramework) findNewRelicAgent(agentDir string) (string, error) { // Supply installs the New Relic agent func (n *NewRelicFramework) Supply() error { - n.context.Log.BeginStep("Installing New Relic Agent") + n.context.Log.Debug("Installing New Relic Agent") // Get New Relic agent dependency from manifest dep, err := n.context.Manifest.DefaultVersion("newrelic") @@ -78,7 +78,7 @@ func (n *NewRelicFramework) Supply() error { n.context.Log.Warning("Could not install default New Relic configuration: %s", err.Error()) } - n.context.Log.Info("Installed New Relic Agent version %s", dep.Version) + n.context.Log.Debug("Installed New Relic Agent version %s", dep.Version) return nil } @@ -115,7 +115,7 @@ func (n *NewRelicFramework) installDefaultConfiguration(agentDir string) error { return fmt.Errorf("failed to write newrelic.yml: %w", err) } - n.context.Log.Info("Installed default New Relic configuration") + n.context.Log.Debug("Installed default New Relic configuration") n.context.Log.Debug(" - newrelic.yml (license key and app name will be configured via JAVA_OPTS)") return nil } @@ -168,6 +168,10 @@ func (n *NewRelicFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - n.context.Log.Info("New Relic Agent configured (priority 35)") + n.context.Log.Debug("New Relic Agent configured (priority 35)") return nil } + +func (n *NewRelicFramework) DependencyIdentifier() string { + return "newrelic" +} diff --git a/src/java/frameworks/open_telemetry_javaagent.go b/src/java/frameworks/open_telemetry_javaagent.go index 7b80c1fa5..baa65ad53 100644 --- a/src/java/frameworks/open_telemetry_javaagent.go +++ b/src/java/frameworks/open_telemetry_javaagent.go @@ -48,7 +48,7 @@ func (o *OpenTelemetryJavaagentFramework) Detect() (string, error) { // Supply installs the OpenTelemetry Javaagent func (o *OpenTelemetryJavaagentFramework) Supply() error { - o.context.Log.BeginStep("Installing OpenTelemetry Javaagent") + o.context.Log.Debug("Installing OpenTelemetry Javaagent") // Get OpenTelemetry agent dependency from manifest dep, err := o.context.Manifest.DefaultVersion("open-telemetry-javaagent") @@ -66,7 +66,7 @@ func (o *OpenTelemetryJavaagentFramework) Supply() error { return fmt.Errorf("failed to install OpenTelemetry agent: %w", err) } - o.context.Log.Info("Installed OpenTelemetry Javaagent version %s", dep.Version) + o.context.Log.Debug("Installed OpenTelemetry Javaagent version %s", dep.Version) return nil } @@ -121,6 +121,10 @@ func (o *OpenTelemetryJavaagentFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - o.context.Log.Info("OpenTelemetry Javaagent configured (priority 36)") + o.context.Log.Debug("OpenTelemetry Javaagent configured (priority 36)") return nil } + +func (o *OpenTelemetryJavaagentFramework) DependencyIdentifier() string { + return "open-telemetry-javaagent" +} diff --git a/src/java/frameworks/postgresql_jdbc.go b/src/java/frameworks/postgresql_jdbc.go index 8d9310a4a..b99b26c43 100644 --- a/src/java/frameworks/postgresql_jdbc.go +++ b/src/java/frameworks/postgresql_jdbc.go @@ -38,7 +38,7 @@ func (p *PostgresqlJdbcFramework) Detect() (string, error) { // Supply installs the PostgreSQL JDBC driver func (p *PostgresqlJdbcFramework) Supply() error { - p.context.Log.BeginStep("Installing PostgreSQL JDBC driver") + p.context.Log.Debug("Installing PostgreSQL JDBC driver") // Get PostgreSQL JDBC dependency from manifest dep, err := p.context.Manifest.DefaultVersion("postgresql-jdbc") @@ -56,7 +56,7 @@ func (p *PostgresqlJdbcFramework) Supply() error { return fmt.Errorf("failed to install PostgreSQL JDBC driver: %w", err) } - p.context.Log.Info("Installed PostgreSQL JDBC driver version %s", dep.Version) + p.context.Log.Debug("Installed PostgreSQL JDBC driver version %s", dep.Version) return nil } @@ -146,3 +146,7 @@ func (p *PostgresqlJdbcFramework) hasPostgresDriver() bool { return false } + +func (p *PostgresqlJdbcFramework) DependencyIdentifier() string { + return "postgresql-jdbc" +} diff --git a/src/java/frameworks/protect_app_security_provider.go b/src/java/frameworks/protect_app_security_provider.go index 784ac2f88..171c9d89f 100644 --- a/src/java/frameworks/protect_app_security_provider.go +++ b/src/java/frameworks/protect_app_security_provider.go @@ -56,7 +56,7 @@ func (p *ProtectAppSecurityProviderFramework) Detect() (string, error) { // Supply installs the ProtectApp security provider JAR func (p *ProtectAppSecurityProviderFramework) Supply() error { - p.context.Log.BeginStep("Installing ProtectApp Security Provider") + p.context.Log.Debug("Installing ProtectApp Security Provider") // Get protect-app-security-provider dependency from manifest dep, err := p.context.Manifest.DefaultVersion("protect-app-security-provider") @@ -75,7 +75,7 @@ func (p *ProtectAppSecurityProviderFramework) Supply() error { p.context.Log.Warning("Could not install default ProtectApp configuration: %s", err.Error()) } - p.context.Log.Info("Installed ProtectApp Security Provider version %s", dep.Version) + p.context.Log.Debug("Installed ProtectApp Security Provider version %s", dep.Version) return nil } @@ -101,7 +101,7 @@ func (p *ProtectAppSecurityProviderFramework) installDefaultConfiguration(protec return fmt.Errorf("failed to write IngrianNAE.properties: %w", err) } - p.context.Log.Info("Installed default ProtectApp configuration") + p.context.Log.Debug("Installed default ProtectApp configuration") p.context.Log.Debug(" - IngrianNAE.properties (connection and cache settings)") return nil } @@ -342,3 +342,7 @@ func (p *ProtectAppSecurityProviderFramework) findProtectAppService() (map[strin return nil, fmt.Errorf("no ProtectApp service found") } + +func (p *ProtectAppSecurityProviderFramework) DependencyIdentifier() string { + return "protect-app-security-provider" +} diff --git a/src/java/frameworks/riverbed_appinternals_agent.go b/src/java/frameworks/riverbed_appinternals_agent.go index 3f76a0a53..74b3b5aa8 100644 --- a/src/java/frameworks/riverbed_appinternals_agent.go +++ b/src/java/frameworks/riverbed_appinternals_agent.go @@ -49,7 +49,7 @@ func (r *RiverbedAppInternalsAgentFramework) Detect() (string, error) { // Supply downloads and installs the Riverbed AppInternals agent func (r *RiverbedAppInternalsAgentFramework) Supply() error { - r.context.Log.BeginStep("Installing Riverbed AppInternals agent") + r.context.Log.Debug("Installing Riverbed AppInternals agent") // Get dependency from manifest dep, err := r.context.Manifest.DefaultVersion("riverbed-appinternals-agent") @@ -121,7 +121,7 @@ func (r *RiverbedAppInternalsAgentFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for Riverbed AppInternals: %w", err) } - r.context.Log.Info("Riverbed AppInternals agent configured") + r.context.Log.Debug("Riverbed AppInternals agent configured") return nil } @@ -226,3 +226,7 @@ func (r *RiverbedAppInternalsAgentFramework) constructAgentJarPath(agentDir stri r.agentPath = agentJarPath return nil } + +func (r *RiverbedAppInternalsAgentFramework) DependencyIdentifier() string { + return "riverbed-appinternals-agent" +} diff --git a/src/java/frameworks/sealights_agent.go b/src/java/frameworks/sealights_agent.go index 50defbeb6..6b93db803 100644 --- a/src/java/frameworks/sealights_agent.go +++ b/src/java/frameworks/sealights_agent.go @@ -66,7 +66,7 @@ func (f *SealightsAgentFramework) Supply() error { // Install directory installDir := filepath.Join(f.context.Stager.DepDir(), "sealights_agent") - f.context.Log.BeginStep("Installing Sealights Agent %s", dep.Version) + f.context.Log.Debug("Installing Sealights Agent %s", dep.Version) // Download and extract ZIP with JAR agent if err := f.context.Installer.InstallDependency(dep, installDir); err != nil { @@ -211,7 +211,7 @@ func (f *SealightsAgentFramework) Finalize() error { return fmt.Errorf("failed to create log directory: %w", err) } - f.context.Log.Info("Sealights Agent configured (priority 39)") + f.context.Log.Debug("Sealights Agent configured (priority 39)") return nil } diff --git a/src/java/frameworks/seeker_security_provider.go b/src/java/frameworks/seeker_security_provider.go index 363215c69..7b77304d0 100644 --- a/src/java/frameworks/seeker_security_provider.go +++ b/src/java/frameworks/seeker_security_provider.go @@ -48,7 +48,7 @@ func (s *SeekerSecurityProviderFramework) Detect() (string, error) { // Supply installs the Seeker agent by downloading from Seeker server func (s *SeekerSecurityProviderFramework) Supply() error { - s.context.Log.BeginStep("Installing Synopsys Seeker Security Provider") + s.context.Log.Debug("Installing Synopsys Seeker Security Provider") // Get Seeker service credentials seekerService, err := s.findSeekerService() @@ -81,7 +81,7 @@ func (s *SeekerSecurityProviderFramework) Supply() error { return fmt.Errorf("failed to download Seeker agent: %w", err) } - s.context.Log.Info("Installed Synopsys Seeker Security Provider from %s", serverURL) + s.context.Log.Debug("Installed Synopsys Seeker Security Provider from %s", serverURL) return nil } @@ -169,7 +169,7 @@ export SEEKER_SERVER_URL="%s" return fmt.Errorf("failed to write Seeker profile.d script: %w", err) } - s.context.Log.Info("Seeker Security Provider configured (priority 40)") + s.context.Log.Debug("Seeker Security Provider configured (priority 40)") return nil } diff --git a/src/java/frameworks/sky_walking_agent.go b/src/java/frameworks/sky_walking_agent.go index b70897fbf..283ccdc59 100644 --- a/src/java/frameworks/sky_walking_agent.go +++ b/src/java/frameworks/sky_walking_agent.go @@ -67,7 +67,7 @@ func (s *SkyWalkingAgentFramework) Detect() (string, error) { // Supply downloads and installs the SkyWalking agent func (s *SkyWalkingAgentFramework) Supply() error { - s.context.Log.BeginStep("Installing SkyWalking agent") + s.context.Log.Debug("Installing SkyWalking agent") // Get dependency from manifest dep, err := s.context.Manifest.DefaultVersion("skywalking-agent") @@ -136,7 +136,7 @@ func (s *SkyWalkingAgentFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for SkyWalking: %w", err) } - s.context.Log.Info("SkyWalking agent configured") + s.context.Log.Debug("SkyWalking agent configured") return nil } @@ -246,3 +246,7 @@ func (s *SkyWalkingAgentFramework) loadConfig() (*skyWalkingAgentConfig, error) type skyWalkingAgentConfig struct { DefaultApplicationName string `yaml:"default_application_name"` } + +func (s *SkyWalkingAgentFramework) DependencyIdentifier() string { + return "skywalking-agent" +} diff --git a/src/java/frameworks/splunk_otel_java_agent.go b/src/java/frameworks/splunk_otel_java_agent.go index 7a3785a1b..3f67c7381 100644 --- a/src/java/frameworks/splunk_otel_java_agent.go +++ b/src/java/frameworks/splunk_otel_java_agent.go @@ -76,7 +76,7 @@ func (s *SplunkOtelJavaAgentFramework) Detect() (string, error) { // Supply downloads and installs the Splunk OTEL Java agent func (s *SplunkOtelJavaAgentFramework) Supply() error { - s.context.Log.BeginStep("Installing Splunk OTEL Java agent") + s.context.Log.Debug("Installing Splunk OTEL Java agent") // Get dependency from manifest dep, err := s.context.Manifest.DefaultVersion("splunk-otel-javaagent") @@ -154,7 +154,7 @@ func (s *SplunkOtelJavaAgentFramework) Finalize() error { return fmt.Errorf("failed to write JAVA_OPTS for Splunk OTEL: %w", err) } - s.context.Log.Info("Splunk OTEL Java agent configured") + s.context.Log.Debug("Splunk OTEL Java agent configured") return nil } @@ -265,3 +265,7 @@ func (s *SplunkOtelJavaAgentFramework) constructJarPath(agentDir string) error { s.jarPath = jarPattern return nil } + +func (s *SplunkOtelJavaAgentFramework) DependencyIdentifier() string { + return "splunk-otel-javaagent" +} diff --git a/src/java/frameworks/spring_auto_reconfiguration.go b/src/java/frameworks/spring_auto_reconfiguration.go index 8d4d66885..35a5c3e93 100644 --- a/src/java/frameworks/spring_auto_reconfiguration.go +++ b/src/java/frameworks/spring_auto_reconfiguration.go @@ -52,7 +52,7 @@ func (s *SpringAutoReconfigurationFramework) Supply() error { s.context.Log.Debug("java-cfenv present, skipping Spring Auto-reconfiguration installation") return nil } - s.context.Log.BeginStep("Installing Spring Auto-reconfiguration") + s.context.Log.Debug("Installing Spring Auto-reconfiguration") // Log deprecation warnings if s.hasSpringCloudConnectors() { @@ -85,7 +85,7 @@ func (s *SpringAutoReconfigurationFramework) Supply() error { s.context.Log.Warning("For migration instructions, see https://via.vmw.com/EiBW. Once you migrate to java-cfenv, " + "these warnings will disappear.") - s.context.Log.Info("Installed Spring Auto-reconfiguration version %s", dep.Version) + s.context.Log.Debug("Installed Spring Auto-reconfiguration version %s", dep.Version) return nil } @@ -205,3 +205,7 @@ func (s *SpringAutoReconfigurationFramework) hasSpringCloudConnectors() bool { return false } + +func (s *SpringAutoReconfigurationFramework) DependencyIdentifier() string { + return "auto-reconfiguration" +} diff --git a/src/java/frameworks/your_kit_profiler.go b/src/java/frameworks/your_kit_profiler.go index ca3fd70a3..093b2d2d6 100644 --- a/src/java/frameworks/your_kit_profiler.go +++ b/src/java/frameworks/your_kit_profiler.go @@ -34,6 +34,10 @@ func NewYourKitProfilerFramework(ctx *common.Context) *YourKitProfilerFramework return &YourKitProfilerFramework{context: ctx} } +func (f *YourKitProfilerFramework) DependencyIdentifier() string { + return "your-kit-profiler" +} + // Detect returns the framework name if YourKit is explicitly enabled func (f *YourKitProfilerFramework) Detect() (string, error) { // YourKit is disabled by default @@ -64,14 +68,14 @@ func (f *YourKitProfilerFramework) Supply() error { // Install directory installDir := filepath.Join(f.context.Stager.DepDir(), "your_kit_profiler") - f.context.Log.BeginStep("Installing YourKit Profiler %s", dep.Version) + f.context.Log.Debug("Installing YourKit Profiler %s", dep.Version) // Download and extract native library if err := f.context.Installer.InstallDependency(dep, installDir); err != nil { return fmt.Errorf("failed to install your-kit-profiler: %w", err) } - f.context.Log.Info("YourKit Profiler installed successfully") + f.context.Log.Debug("YourKit Profiler installed successfully") return nil } @@ -141,6 +145,6 @@ func (f *YourKitProfilerFramework) Finalize() error { return fmt.Errorf("failed to write java_opts file: %w", err) } - f.context.Log.Info("YourKit Profiler configured (priority 45)") + f.context.Log.Debug("YourKit Profiler configured (priority 45)") return nil } diff --git a/src/java/jres/graalvm.go b/src/java/jres/graalvm.go index c4155b0a3..17ecdcfc5 100644 --- a/src/java/jres/graalvm.go +++ b/src/java/jres/graalvm.go @@ -50,7 +50,7 @@ func (g *GraalVMJRE) Supply() error { } g.version = dep.Version - g.ctx.Log.Info("Installing GraalVM %s", g.version) + g.ctx.Log.Info("Installing GraalVM (%s)", g.version) // Install JRE if err := g.ctx.Installer.InstallDependency(dep, g.jreDir); err != nil { diff --git a/src/java/jres/ibm.go b/src/java/jres/ibm.go index 2f75e1bba..5b61d4b4d 100644 --- a/src/java/jres/ibm.go +++ b/src/java/jres/ibm.go @@ -52,7 +52,7 @@ func (i *IBMJRE) Supply() error { } i.version = dep.Version - i.ctx.Log.Info("Installing IBM JRE %s", i.version) + i.ctx.Log.Info("Installing IBM JRE (%s)", i.version) // Install JRE if err := i.ctx.Installer.InstallDependency(dep, i.jreDir); err != nil { diff --git a/src/java/jres/jvmkill.go b/src/java/jres/jvmkill.go index 05d965894..277207bd4 100644 --- a/src/java/jres/jvmkill.go +++ b/src/java/jres/jvmkill.go @@ -34,8 +34,6 @@ func (j *JVMKillAgent) Name() string { // Supply installs the JVMKill agent func (j *JVMKillAgent) Supply() error { - j.ctx.Log.Info("Installing JVMKill Agent") - // Get JVMKill version from manifest dep, err := j.ctx.Manifest.DefaultVersion("jvmkill") if err != nil { @@ -43,7 +41,7 @@ func (j *JVMKillAgent) Supply() error { } j.version = dep.Version - j.ctx.Log.Debug("JVMKill version: %s", j.version) + j.ctx.Log.Info("Installing JVMKill Agent (%s)", j.version) // Install to bin directory binDir := filepath.Join(j.jreDir, "bin") @@ -108,7 +106,7 @@ func (j *JVMKillAgent) Supply() error { } j.agentPath = finalPath - j.ctx.Log.Info("JVMKill Agent installed to %s", finalPath) + j.ctx.Log.Debug("JVMKill Agent installed to %s", finalPath) return nil } @@ -173,7 +171,7 @@ func (j *JVMKillAgent) Finalize() error { return fmt.Errorf("failed to add JVMKill to JAVA_OPTS: %w", err) } - j.ctx.Log.Info("JVMKill Agent added to JAVA_OPTS") + j.ctx.Log.Debug("JVMKill Agent added to JAVA_OPTS") return nil } diff --git a/src/java/jres/memory_calculator.go b/src/java/jres/memory_calculator.go index 30c601ac7..b1777ce62 100644 --- a/src/java/jres/memory_calculator.go +++ b/src/java/jres/memory_calculator.go @@ -45,8 +45,6 @@ func (m *MemoryCalculator) Name() string { // Supply installs the memory calculator func (m *MemoryCalculator) Supply() error { - m.ctx.Log.Info("Installing Memory Calculator") - // Get memory calculator version from manifest dep, err := m.ctx.Manifest.DefaultVersion("memory-calculator") if err != nil { @@ -54,7 +52,7 @@ func (m *MemoryCalculator) Supply() error { } m.version = dep.Version - m.ctx.Log.Debug("Memory Calculator version: %s", m.version) + m.ctx.Log.Info("Installing Memory Calculator (%s)", m.version) // Create bin directory binDir := filepath.Join(m.jreDir, "bin") @@ -194,7 +192,7 @@ export MALLOC_ARENA_MAX=2 return fmt.Errorf("failed to write memory calculator script: %w", err) } - m.ctx.Log.Info("Memory Calculator configured") + m.ctx.Log.Debug("Memory Calculator configured") return nil } diff --git a/src/java/jres/openjdk.go b/src/java/jres/openjdk.go index 51894cb89..cf32acc91 100644 --- a/src/java/jres/openjdk.go +++ b/src/java/jres/openjdk.go @@ -51,7 +51,7 @@ func (o *OpenJDKJRE) Supply() error { } o.version = dep.Version - o.ctx.Log.Info("Installing OpenJDK %s", o.version) + o.ctx.Log.Info("Installing OpenJDK (%s)", o.version) // Install JRE if err := o.ctx.Installer.InstallDependency(dep, o.jreDir); err != nil { @@ -119,13 +119,13 @@ func (o *OpenJDKJRE) Supply() error { // Non-fatal - continue without memory calculator } - o.ctx.Log.Info("OpenJDK JRE installation complete") + o.ctx.Log.Debug("OpenJDK JRE installation complete") return nil } // Finalize performs final JRE configuration func (o *OpenJDKJRE) Finalize() error { - o.ctx.Log.BeginStep("Finalizing OpenJDK JRE configuration") + o.ctx.Log.Debug("Finalizing OpenJDK JRE configuration") // Find the actual JAVA_HOME (needed if finalize is called on a fresh instance) if o.javaHome == "" { @@ -193,7 +193,7 @@ func (o *OpenJDKJRE) Finalize() error { // Non-fatal } - o.ctx.Log.Info("OpenJDK JRE finalization complete") + o.ctx.Log.Debug("OpenJDK JRE finalization complete") return nil } diff --git a/src/java/jres/oracle.go b/src/java/jres/oracle.go index 78519921d..58c822f2b 100644 --- a/src/java/jres/oracle.go +++ b/src/java/jres/oracle.go @@ -51,7 +51,7 @@ func (o *OracleJRE) Supply() error { } o.version = dep.Version - o.ctx.Log.Info("Installing Oracle JRE %s", o.version) + o.ctx.Log.Info("Installing Oracle JRE (%s)", o.version) // Install JRE if err := o.ctx.Installer.InstallDependency(dep, o.jreDir); err != nil { diff --git a/src/java/jres/sapmachine.go b/src/java/jres/sapmachine.go index 8c747f186..117ca3b19 100644 --- a/src/java/jres/sapmachine.go +++ b/src/java/jres/sapmachine.go @@ -50,7 +50,7 @@ func (s *SapMachineJRE) Supply() error { } s.version = dep.Version - s.ctx.Log.Info("Installing SAP Machine %s", s.version) + s.ctx.Log.Info("Installing SAP Machine (%s)", s.version) // Install JRE if err := s.ctx.Installer.InstallDependency(dep, s.jreDir); err != nil { diff --git a/src/java/jres/zing.go b/src/java/jres/zing.go index f0b1616ad..3abf07f97 100644 --- a/src/java/jres/zing.go +++ b/src/java/jres/zing.go @@ -51,7 +51,7 @@ func (z *ZingJRE) Supply() error { } z.version = dep.Version - z.ctx.Log.Info("Installing Zing JRE %s", z.version) + z.ctx.Log.Info("Installing Zing JRE (%s)", z.version) // Install JRE if err := z.ctx.Installer.InstallDependency(dep, z.jreDir); err != nil { diff --git a/src/java/jres/zulu.go b/src/java/jres/zulu.go index 2fa0ff5a9..2ad1bc675 100644 --- a/src/java/jres/zulu.go +++ b/src/java/jres/zulu.go @@ -50,7 +50,7 @@ func (z *ZuluJRE) Supply() error { } z.version = dep.Version - z.ctx.Log.Info("Installing Zulu %s", z.version) + z.ctx.Log.Info("Installing Zulu (%s)", z.version) // Install JRE if err := z.ctx.Installer.InstallDependency(dep, z.jreDir); err != nil { diff --git a/src/java/supply/supply.go b/src/java/supply/supply.go index 95fb4032c..afcd8d094 100644 --- a/src/java/supply/supply.go +++ b/src/java/supply/supply.go @@ -119,14 +119,12 @@ func (s *Supplier) installJRE() (jres.JRE, string, error) { return nil, "", err } - s.Log.Info("JRE installation complete: %s %s", jreName, jre.Version()) + s.Log.Debug("JRE installation complete: %s %s", jreName, jre.Version()) return jre, jreName, nil } // installFrameworks installs framework components (APM agents, etc.) func (s *Supplier) installFrameworks() error { - s.Log.BeginStep("Installing frameworks") - // Create framework context ctx := &common.Context{ Stager: s.Stager, @@ -152,13 +150,13 @@ func (s *Supplier) installFrameworks() error { return nil } - s.Log.Info("Detected frameworks: [%v]", strings.Join(frameworkNames, ",")) + s.Log.BeginStep("Installing frameworks [%v]", strings.Join(frameworkNames, ", ")) // Install all detected frameworks // Framework installation errors are fatal and will abort the build, // matching the behavior of the Ruby buildpack for i, framework := range detectedFrameworks { - s.Log.Info("Installing framework: %s", frameworkNames[i]) + s.Log.Info("Installing %s%s", frameworkNames[i], s.frameworkVersionSuffix(framework)) if err := framework.Supply(); err != nil { return fmt.Errorf("failed to install framework %s: %w", frameworkNames[i], err) } @@ -166,3 +164,22 @@ func (s *Supplier) installFrameworks() error { return nil } + +func (s *Supplier) frameworkVersionSuffix(framework frameworks.Framework) string { + provider, ok := framework.(frameworks.DependencyIdentifierProvider) + if !ok { + return "" + } + + dependencyName := strings.TrimSpace(provider.DependencyIdentifier()) + if dependencyName == "" { + return "" + } + + dependency, err := s.Manifest.DefaultVersion(dependencyName) + if err != nil || strings.TrimSpace(dependency.Version) == "" { + return "" + } + + return fmt.Sprintf(" (%s)", dependency.Version) +} diff --git a/src/java/supply/supply_test.go b/src/java/supply/supply_test.go index 18a6086e2..f27985f5b 100644 --- a/src/java/supply/supply_test.go +++ b/src/java/supply/supply_test.go @@ -126,9 +126,9 @@ dependencies: [] Expect(os.MkdirAll(filepath.Join(cspInstallDir), 0755)).To(Succeed()) depClientCertificateMapper := libbuildpack.Dependency{Name: "client-certificate-mapper", Version: "2.0.1"} - mockManifest.EXPECT().DefaultVersion("client-certificate-mapper").Return(depClientCertificateMapper, nil) + mockManifest.EXPECT().DefaultVersion("client-certificate-mapper").Return(depClientCertificateMapper, nil).Times(2) depContainerSecProvider := libbuildpack.Dependency{Name: "container-security-provider", Version: "1.20.0"} - mockManifest.EXPECT().DefaultVersion("container-security-provider").Return(depContainerSecProvider, nil) + mockManifest.EXPECT().DefaultVersion("container-security-provider").Return(depContainerSecProvider, nil).Times(2) mockInstaller.EXPECT().InstallDependency(depClientCertificateMapper, ccmInstallDir).Return(nil) mockInstaller.EXPECT().InstallDependency(depContainerSecProvider, cspInstallDir).Return(nil) @@ -193,7 +193,7 @@ dependencies: [] Expect(os.MkdirAll(filepath.Join(javaCfEnvInstallDir), 0755)).To(Succeed()) depJavaCfEnv := libbuildpack.Dependency{Name: "java-cfenv", Version: "3.5.0"} - mockManifest.EXPECT().DefaultVersion("java-cfenv").Return(depJavaCfEnv, nil) + mockManifest.EXPECT().DefaultVersion("java-cfenv").Return(depJavaCfEnv, nil).Times(2) mockInstaller.EXPECT().InstallDependency(depJavaCfEnv, javaCfEnvInstallDir).Return(nil) }) diff --git a/vendor/github.com/cloudfoundry/libbuildpack/installer.go b/vendor/github.com/cloudfoundry/libbuildpack/installer.go index 365b8d11b..357941047 100644 --- a/vendor/github.com/cloudfoundry/libbuildpack/installer.go +++ b/vendor/github.com/cloudfoundry/libbuildpack/installer.go @@ -45,7 +45,7 @@ func (i *Installer) InstallDependency(dep Dependency, outputDir string) error { // This is useful for archives that extract to a top-level directory // (e.g., apache-tomcat-9.0.98.tar.gz extracts to apache-tomcat-9.0.98/) func (i *Installer) InstallDependencyWithStrip(dep Dependency, outputDir string, stripComponents int) error { - i.manifest.log.BeginStep("Installing %s %s", dep.Name, dep.Version) + i.manifest.log.Debug("Installing %s %s", dep.Name, dep.Version) tmpDir, err := ioutil.TempDir("", "downloads") if err != nil { @@ -258,7 +258,7 @@ func (i *Installer) fetchAppCachedBuildpackDependency(entry *ManifestEntry, outp } if foundCacheFile { - i.manifest.log.Info("Copy [%s]", cacheFile) + i.manifest.log.Debug("Copy [%s]", cacheFile) if err := CopyFile(cacheFile, outputFile); err != nil { return err } diff --git a/vendor/github.com/cloudfoundry/libbuildpack/manifest.go b/vendor/github.com/cloudfoundry/libbuildpack/manifest.go index 0629e0533..6f3043070 100644 --- a/vendor/github.com/cloudfoundry/libbuildpack/manifest.go +++ b/vendor/github.com/cloudfoundry/libbuildpack/manifest.go @@ -262,7 +262,7 @@ func fetchCachedBuildpackDependency(entry *ManifestEntry, outputFile, manifestRo if !filepath.IsAbs(source) { source = filepath.Join(manifestRootDir, source) } - manifestLog.Info("Copy [%s]", source) + manifestLog.Debug("Copy [%s]", source) if err := CopyFile(source, outputFile); err != nil { return err } @@ -282,7 +282,7 @@ func downloadDependency(entry *ManifestEntry, outputFile string, logger *Logger, if err != nil { return err } - logger.Info("Download [%s]", filteredURI) + logger.Debug("Download [%s]", filteredURI) err = downloadFile(entry.URI, outputFile, retryTimeLimit, retryTimeInitialInterval, logger) if err != nil { return err