lnd.xprv/docs/debugging_lnd.md

48 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

# Table of Contents
1. [Overview](#overview)
1. [Debug Logging](#debug-logging)
1. [Capturing pprof data with `lnd`](#capturing-pprof-data-with-lnd)
## Overview
`lnd` ships with a few useful features for debugging, such as a built-in
profiler and tunable logging levels. If you need to submit a bug report
for `lnd`, it may be helpful to capture debug logging and performance
data ahead of time.
## Debug Logging
You can enable debug logging in `lnd` by passing the `--debuglevel` flag. For
example, to increase the log level from `info` to `debug`:
2021-01-17 16:58:57 +03:00
```shell
⛰ lnd --debuglevel=debug
```
You may also specify logging per-subsystem, like this:
2021-01-17 16:58:57 +03:00
```shell
⛰ lnd --debuglevel=<subsystem>=<level>,<subsystem2>=<level>,...
```
## Capturing pprof data with `lnd`
`lnd` has a built-in feature which allows you to capture profiling data at
runtime using [pprof](https://golang.org/pkg/runtime/pprof/), a profiler for
Go. The profiler has negligible performance overhead during normal operations
2018-09-06 11:48:46 +03:00
(unless you have explicitly enabled CPU profiling).
To enable this ability, start `lnd` with the `--profile` option using a free port.
2021-01-17 16:58:57 +03:00
```shell
⛰ lnd --profile=9736
```
Now, with `lnd` running, you can use the pprof endpoint on port 9736 to collect
runtime profiling data. You can fetch this data using `curl` like so:
2021-01-17 16:58:57 +03:00
```shell
⛰ curl http://localhost:9736/debug/pprof/goroutine?debug=1
...
```