Skip to content

Commit 90abbc2

Browse files
authored
reduce install framework logging during startup (#1230)
* reduce cf push logging, consolidated, moved info to debug, added version numbers where applicable * remove redundant debug version logging * remove large mapping method, add DependencyIdentifier() per framework, used to consistent log version numbers * added your kit version, lowered framework completion logging from info to debug * constistent jre version reporting (<version>) * fix integration test with constisten JRE version log, use brackets for tomcat version in log * Revert extra logging for visual debug purposes.
1 parent 5644ebf commit 90abbc2

52 files changed

Lines changed: 253 additions & 132 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/IMPLEMENTING_CONTAINERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ func (t *TomcatContainer) Supply() error {
663663
return fmt.Errorf("failed to install Tomcat: %w", err)
664664
}
665665

666-
t.context.Log.Info("Installed Tomcat version %s", dep.Version)
666+
t.context.Log.Info("Installed Tomcat (%s)", dep.Version)
667667

668668
// Write profile.d script
669669
depsIdx := t.context.Stager.DepsIdx()

src/integration/dist_zip_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func testDistZip(platform switchblade.Platform, fixtures string) func(*testing.T
7171
Expect(err).NotTo(HaveOccurred(), logs.String)
7272

7373
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
74-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 8."))
74+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (8."))
7575
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
7676
})
7777

@@ -84,7 +84,7 @@ func testDistZip(platform switchblade.Platform, fixtures string) func(*testing.T
8484
Expect(err).NotTo(HaveOccurred(), logs.String)
8585

8686
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
87-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17."))
87+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17."))
8888
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
8989
})
9090
})

src/integration/ratpack_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func testRatpack(platform switchblade.Platform, fixtures string) func(*testing.T
7171
Expect(err).NotTo(HaveOccurred(), logs.String)
7272

7373
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
74-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17."))
74+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17."))
7575
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
7676
})
7777
})

src/integration/spring_boot_cli_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func testSpringBootCLI(platform switchblade.Platform, fixtures string) func(*tes
107107
Expect(err).NotTo(HaveOccurred(), logs.String)
108108

109109
Expect(logs.String()).To(ContainSubstring("Java Buildpack"))
110-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17."))
110+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17."))
111111
Eventually(deployment).Should(matchers.Serve(Not(BeEmpty())))
112112
})
113113
})

src/integration/tomcat_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
170170
Execute(name, filepath.Join(fixtures, "containers", "tomcat_javax"))
171171
Expect(err).NotTo(HaveOccurred(), logs.String)
172172

173-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 8."))
173+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (8."))
174174
Expect(logs.String()).To(ContainSubstring("Tomcat 9"))
175175
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
176176
})
@@ -184,7 +184,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
184184
Execute(name, filepath.Join(fixtures, "containers", "tomcat_javax"))
185185
Expect(err).NotTo(HaveOccurred(), logs.String)
186186

187-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 11."))
187+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (11."))
188188
Expect(logs.String()).To(ContainSubstring("Tomcat 9"))
189189
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
190190
})
@@ -197,7 +197,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
197197
Execute(name, filepath.Join(fixtures, "containers", "tomcat_javax"))
198198
Expect(err).NotTo(HaveOccurred(), logs.String)
199199

200-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17."))
200+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17."))
201201
Expect(logs.String()).To(ContainSubstring("Tomcat 9"))
202202
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
203203
})
@@ -223,7 +223,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
223223
Execute(name, filepath.Join(fixtures, "containers", "tomcat_jakarta"))
224224
Expect(err).NotTo(HaveOccurred(), logs.String)
225225

226-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 11."))
226+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (11."))
227227
Expect(logs.String()).To(ContainSubstring("Tomcat 10"))
228228
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
229229
})
@@ -236,7 +236,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
236236
Execute(name, filepath.Join(fixtures, "containers", "tomcat_jakarta"))
237237
Expect(err).NotTo(HaveOccurred(), logs.String)
238238

239-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17."))
239+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17."))
240240
Expect(logs.String()).To(ContainSubstring("Tomcat 10"))
241241
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
242242
})
@@ -257,7 +257,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
257257

258258
Expect(err).NotTo(HaveOccurred(), logs.String)
259259

260-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17."))
260+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17."))
261261
Expect(logs.String()).To(ContainSubstring("Tomcat 10.1."))
262262
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
263263
})
@@ -274,7 +274,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
274274

275275
Expect(err).NotTo(HaveOccurred(), logs.String)
276276

277-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 11."))
277+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (11."))
278278
Expect(logs.String()).To(ContainSubstring("memory"))
279279
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
280280
})
@@ -320,7 +320,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
320320

321321
Expect(err).NotTo(HaveOccurred(), logs.String)
322322

323-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 21."))
323+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (21."))
324324
Expect(logs.String()).To(ContainSubstring("Tomcat"))
325325

326326
// If deployment succeeds, it means:
@@ -343,7 +343,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
343343

344344
Expect(err).NotTo(HaveOccurred(), logs.String)
345345

346-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 17."))
346+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (17."))
347347
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
348348
})
349349

@@ -356,7 +356,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
356356

357357
Expect(err).NotTo(HaveOccurred(), logs.String)
358358

359-
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK 21."))
359+
Expect(logs.String()).To(ContainSubstring("Installing OpenJDK (21."))
360360
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
361361
})
362362
})
@@ -371,7 +371,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
371371

372372
Expect(err).NotTo(HaveOccurred(), logs.String)
373373

374-
Expect(logs.String()).To(ContainSubstring("Installing SAP Machine 17."))
374+
Expect(logs.String()).To(ContainSubstring("Installing SAP Machine (17."))
375375
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
376376
})
377377

@@ -384,7 +384,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
384384

385385
Expect(err).NotTo(HaveOccurred(), logs.String)
386386

387-
Expect(logs.String()).To(ContainSubstring("Installing SAP Machine 21."))
387+
Expect(logs.String()).To(ContainSubstring("Installing SAP Machine (21."))
388388
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
389389
})
390390

@@ -397,7 +397,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
397397

398398
Expect(err).NotTo(HaveOccurred(), logs.String)
399399

400-
Expect(logs.String()).To(ContainSubstring("Installing SAP Machine 25."))
400+
Expect(logs.String()).To(ContainSubstring("Installing SAP Machine (25."))
401401
Eventually(deployment).Should(matchers.Serve(ContainSubstring("OK")))
402402
})
403403
})

src/java/containers/tomcat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (t *TomcatContainer) Supply() error {
120120
return fmt.Errorf("failed to install Tomcat: %w", err)
121121
}
122122

123-
t.context.Log.Info("Installed Tomcat version %s", dep.Version)
123+
t.context.Log.Info("Installed Tomcat (%s)", dep.Version)
124124

125125
// Get buildpack index for multi-buildpack support
126126
depsIdx := t.context.Stager.DepsIdx()

src/java/finalize/finalize.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,12 @@ func (f *Finalizer) finalizeJRE() error {
153153
return fmt.Errorf("failed to finalize JRE %s: %w", f.JREName, err)
154154
}
155155

156-
f.Log.Info("JRE finalization complete")
156+
f.Log.Debug("JRE finalization complete")
157157
return nil
158158
}
159159

160160
// finalizeFrameworks finalizes framework components (APM agents, etc.)
161161
func (f *Finalizer) finalizeFrameworks(ctx *common.Context) error {
162-
f.Log.BeginStep("Finalizing frameworks")
163-
164162
registry := frameworks.NewRegistry(ctx)
165163
registry.RegisterStandardFrameworks()
166164

@@ -175,10 +173,10 @@ func (f *Finalizer) finalizeFrameworks(ctx *common.Context) error {
175173
return nil
176174
}
177175

178-
f.Log.Info("Finalizing frameworks: [%v]", strings.Join(frameworkNames, ","))
176+
f.Log.BeginStep("Finalizing frameworks [%v]", strings.Join(frameworkNames, ", "))
179177

180178
for i, framework := range detectedFrameworks {
181-
f.Log.Info("Finalizing framework: %s", frameworkNames[i])
179+
f.Log.Debug("Finalizing framework: %s", frameworkNames[i])
182180
if err := framework.Finalize(); err != nil {
183181
f.Log.Warning("Failed to finalize framework %s: %s", frameworkNames[i], err.Error())
184182
// Continue with other frameworks even if one fails

src/java/frameworks/app_dynamics.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (a *AppDynamicsFramework) findAppDynamicsAgent(agentDir string) (string, er
4747

4848
// Supply installs the AppDynamics agent
4949
func (a *AppDynamicsFramework) Supply() error {
50-
a.context.Log.BeginStep("Installing AppDynamics Agent")
50+
a.context.Log.Debug("Installing AppDynamics Agent")
5151

5252
// Get AppDynamics agent dependency from manifest
5353
dep, err := a.context.Manifest.DefaultVersion("appdynamics")
@@ -70,7 +70,7 @@ func (a *AppDynamicsFramework) Supply() error {
7070
a.context.Log.Warning("Could not install default AppDynamics configuration: %s", err.Error())
7171
}
7272

73-
a.context.Log.Info("Installed AppDynamics Agent version %s", dep.Version)
73+
a.context.Log.Debug("Installed AppDynamics Agent version %s", dep.Version)
7474
return nil
7575
}
7676

@@ -102,7 +102,7 @@ func (a *AppDynamicsFramework) installDefaultConfiguration(agentDir string) erro
102102
return fmt.Errorf("failed to write app-agent-config.xml: %w", err)
103103
}
104104

105-
a.context.Log.Info("Installed default AppDynamics configuration")
105+
a.context.Log.Debug("Installed default AppDynamics configuration")
106106
a.context.Log.Debug(" - app-agent-config.xml (agent settings and filters)")
107107
return nil
108108
}
@@ -189,3 +189,7 @@ func (a *AppDynamicsFramework) Finalize() error {
189189
a.context.Log.Info("Configured AppDynamics Agent for runtime (priority 11)")
190190
return nil
191191
}
192+
193+
func (a *AppDynamicsFramework) DependencyIdentifier() string {
194+
return "appdynamics"
195+
}

src/java/frameworks/aspectj_weaver_agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (a *AspectJWeaverAgentFramework) Finalize() error {
9999
return fmt.Errorf("failed to write java_opts file: %w", err)
100100
}
101101

102-
a.context.Log.Info("AspectJ Weaver Agent configured successfully (priority 12)")
102+
a.context.Log.Debug("AspectJ Weaver Agent configured successfully (priority 12)")
103103
return nil
104104
}
105105

src/java/frameworks/azure_application_insights_agent.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (a *AzureApplicationInsightsAgentFramework) Detect() (string, error) {
8282

8383
// Supply downloads and installs the Azure Application Insights agent
8484
func (a *AzureApplicationInsightsAgentFramework) Supply() error {
85-
a.context.Log.BeginStep("Installing Azure Application Insights agent")
85+
a.context.Log.Debug("Installing Azure Application Insights agent")
8686

8787
// Get dependency from manifest
8888
dep, err := a.context.Manifest.DefaultVersion("azure-application-insights")
@@ -134,7 +134,7 @@ func (a *AzureApplicationInsightsAgentFramework) installDefaultConfiguration(age
134134
return fmt.Errorf("failed to write AI-Agent.xml: %w", err)
135135
}
136136

137-
a.context.Log.Info("Installed default Azure Application Insights configuration")
137+
a.context.Log.Debug("Installed default Azure Application Insights configuration")
138138
a.context.Log.Debug(" - AI-Agent.xml (instrumentation settings)")
139139
return nil
140140
}
@@ -185,7 +185,7 @@ func (a *AzureApplicationInsightsAgentFramework) Finalize() error {
185185
return fmt.Errorf("failed to write JAVA_OPTS for Azure Application Insights: %w", err)
186186
}
187187

188-
a.context.Log.Info("Azure Application Insights agent configured")
188+
a.context.Log.Debug("Azure Application Insights agent configured")
189189
return nil
190190
}
191191

@@ -289,3 +289,7 @@ func (a *AzureApplicationInsightsAgentFramework) constructJarPath(agentDir strin
289289
a.jarPath = matches[0]
290290
return nil
291291
}
292+
293+
func (a *AzureApplicationInsightsAgentFramework) DependencyIdentifier() string {
294+
return "azure-application-insights"
295+
}

0 commit comments

Comments
 (0)