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 example, with installation or configuration problems.
Write log files
To use the Go agent methods for writing log and audit files, see log.go on the agent GitHub repo.
Logrus integration example
New Relic offers an integration for the Logrus logging system. Here is an example of using the New Relic Logrus integration in an application:
Import both
github.com/sirupsen/logrus
andgithub.com/newrelic/go-agent/v3/integrations/nrlogrus
.Set the log level and assign the Logger output to Logrus. For example:
app, err := newrelic.NewApplication( newrelic.ConfigAppName("Your Application Name"), newrelic.ConfigLicense("__YOUR_NEW_RELIC_LICENSE_KEY__"), func(config *newrelic.Config) { logrus.SetLevel(logrus.DebugLevel) config.Logger = nrlogrus.StandardLogger() }, )
その他のヘルプ
さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:
- Explorers Hubでは、コミュニティからのサポートを受けたり、ディスカッションに参加したりすることができます。
- 当社サイトで答えを見つけて、サポートポータルの使用方法を確認してください。
- Linux、Windows、およびmacOS向けトラブルシューティングツールであるNew Relic Diagnosticsを実行してください。
- New Relicの とandドキュメント をご確認ください。