If your Java applications are deployed to AWS Elastic Beanstalk, you may want to configure the logging to make error diagnostics much easier. We can use Beanstalk console to request and download log files, but you need to configure the app first to make your log files available for download.
Configure app logging
You should first configure the logging framework to log entries to files. You can put the log files to /var/log directory.
For example, you can set an environment variable that only set for Beanstalk and use different logging appenders. Logback supports using if in the configuration file.
Add your own logging files
To make your log files available to Beanstalk, you need to add custom configurations. Create a new directory .ebextensions in the src/main/resources directory and add following file tail-logs.config.