Go agent logging

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.

Logrus integration

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 github.com/Sirupsen/logrus and github.com/newrelic/go-agent/_integrations/nrlogrus.

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 config variable means, and for more about the Go agent configuration process, see Go agent configuration.

For more help

Join the discussion about Go monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.