The Java buildpack logs all messages, regardless of severity to <app dir>/.java-buildpack.log
. It also logs messages to $stderr
, filtered by a configured severity.
If the buildpack fails with an exception, the exception message is logged with a log level of ERROR
whereas the exception stack trace is logged with a log level of DEBUG
to prevent users from seeing stack traces by default.
The Java buildpack logs sensitive information, such as environment variables which may contain security credentials.
You should be careful not to expose this information inadvertently, for example by posting standard error stream contents or the contents of <app dir>/.java-buildpack.log
to a public discussion list.
The JavaBuildpack::Logging::LoggerFactory
class manages instances that meet the contract of the standard Ruby Logger
. In normal usage, the Buildpack
class configures the LoggerFactory
. Logger
instances are then retrieved for classes that require them:
@logger = JavaBuildpack::Logging::LoggerFactory.get_logger DownloadCache
This logger is used like the standard Ruby logger and supports both parameter and block forms:
logger.info('success')
logger.debug { "#{costly_method}" }
For general information on configuring the buildpack, refer to Configuration and Extension.
The console logging severity filter is set to DEBUG
, INFO
, WARN
, ERROR
, FATAL
using the following strategies in descending priority:
$JBP_LOG_LEVEL
environment variable. This can be set using thecf set-env <app name> JBP_LOG_LEVEL DEBUG
command.- Ruby
--verbose
and--debug
flags. Setting either of these is the equivalent of setting the log severity level toDEBUG
. default_log_level
value inconfig/logging.yml
.- Fallback to
INFO
if none of the above are set.