Some documentation may refer to the.java-buildpack.log file as a helpful tool for diagnosing issues with the Java Buildpack. This article provides instructions on how to generate and retrieve this file for applications deployed using the TPCF Java Buildpack.
Tanzu Platform for Cloud Foundry
To generate the .java-buildpack.log file, the environment variable enable_log_file must be enabled. This can be accomplished by either setting the variable directly in the application manifest, or by using the `cf set-env` command:
JBP_CONFIG_LOGGING entry to the applications section of the manifest.yml file, then run `cf push` to deploy the changesenv:
JBP_CONFIG_LOGGING: '{enable_log_file: true}'
An example manifest.yml file will appear similar to:
---
applications:
- name: <APP_NAME>
memory: 512M
instances: 1
path: path/java-app.war
env:
JBP_CONFIG_LOGGING: '{enable_log_file: true}'
cf set-env` command to update the configuration, followed by `cf restage` to apply the changescf set-env <APP_NAME> JBP_CONFIG_LOGGING '{ enable_log_file: true}'
cf restage <APP_NAME>
After `cf push` or `cf restage`, access the app container via `cf ssh <APP_NAME>`, or login to an app container as a root.
Log file .java-buildpack.log can be found under app/ directory:
ubuntu@opsmanager-3-1:~$ cf ssh<APP_NAME>
vcap@b7#################d3fd:~$ cd app
vcap@b7#################d3fd:~/app$ ll
total 304
drwxr-xr-x 1 vcap vcap 99 Sep 10 08:19 ./
drwx------ 1 vcap vcap 93 Sep 10 08:19 ../
drwxr-xr-x 4 vcap vcap 71 Sep 10 08:19 BOOT-INF/
drwxr-xr-x 7 vcap vcap 132 Sep 10 08:19 .java-buildpack/
-rw-r--r-- 1 vcap vcap 308443 Sep 10 08:19 .java-buildpack.log
drwxr-xr-x 2 vcap vcap 25 May 16 2023 META-INF/
drwxr-xr-x 3 vcap vcap 29 Feb 1 1980 org/
Please note that the debug log is only useful for applications that stage successfully but behave unexpectedly — for example, when an expected framework is missing. Once debugging is complete, it’s recommended to disable the debug log to reduce overhead and avoid potential security risks.