New Relic for Go logging uses the standard Go log package and a New Relic
logger package. Logging is useful for troubleshooting your New Relic integration. For the Go agent methods for writing log and audit files, see log.go on the agent Github repo.
For basic information about how to make changes to your New Relic integration, see Go agent configuration.
There is an integration for the logging system Logrus available. Here's an example of using the New Relic Logrus integration in an application:
- New Relic Logrus integration example
First, import both
Next, set the log level and assign the Logger output to Logrus. For example:
logrus.SetLevel(logrus.DebugLevel) config.Logger = nrlogrus.StandardLogger()
For more on what the
configvariable means, and for more about the Go agent configuration process, see Go agent configuration.