Contains utilities for logging.
To create a project:
- go here
- enter the service name and select Eastern as the timezone
- after clicking "create", select "Java" as the primary SDK
Then, to add the Rollbar logger to a project:
- Make sure you depend on a recent version of lib-play
- Set the Rollbar token:
dev env set --keyval ROLLBAR_TOKEN=ACCESS_TOKEN_GOES_HERE --env production --app APP_NAME_GOES_HERE
- This is the project access token and can be generated at
https://rollbar.com/flow.io/{project name}/settings/access_tokens/
. The scope must bepost_server_item
or higher (e.g.write
).
- This is the project access token and can be generated at
- Add logback.xml and logback-test.xml to
api/conf
Lastly, to use Rollbar:
- Inject
logger: RollbarLogger
and use it instead of the default Play logger - Look at an example here on how to use it
- Look at the source code to see how it works under the hood
- Note that currently only
warn
anderror
log levels are sent to the Rollbar API. Other log statements continue to get logged in the logs (and Sumo) - We recommend replacing all calls to
Play.api.logger
w/RollbarLogger
- makes it easy to see there is a single logger plus will give us consistency in our log statements.