github.com/decred/dcrlnd@v0.7.6/docs/debugging_lnd.md (about)

     1  # Table of Contents
     2  1. [Overview](#overview)
     3  1. [Debug Logging](#debug-logging)
     4  1. [Capturing pprof data with `dcrlnd`](#capturing-pprof-data-with-dcrlnd)
     5  
     6  ## Overview
     7  
     8  `dcrlnd` ships with a few useful features for debugging, such as a built-in
     9  profiler and tunable logging levels. If you need to submit a bug report
    10  for `dcrlnd`, it may be helpful to capture debug logging and performance
    11  data ahead of time.
    12  
    13  ## Debug Logging
    14  
    15  You can enable debug logging in `dcrlnd` by passing the `--debuglevel` flag. For
    16  example, to increase the log level from `info` to `debug`:
    17  
    18  ```
    19  $ dcrlnd --debuglevel=debug
    20  ```
    21  
    22  You may also specify logging per-subsystem, like this:
    23  
    24  ```
    25  $ dcrlnd --debuglevel=<subsystem>=<level>,<subsystem2>=<level>,...
    26  ```
    27  
    28  ## Capturing pprof data with `dcrlnd`
    29  
    30  `dcrlnd` has a built-in feature which allows you to capture profiling data at
    31  runtime using [pprof](https://golang.org/pkg/runtime/pprof/), a profiler for
    32  Go. The profiler has negligible performance overhead during normal operations
    33  (unless you have explicitly enabled CPU profiling).
    34  
    35  To enable this ability, start `dcrlnd` with the `--profile` option using a free port.
    36  
    37  ```
    38  $ dcrlnd --profile=9736
    39  ```
    40  
    41  Now, with `dcrlnd` running, you can use the pprof endpoint on port 9736 to collect
    42  runtime profiling data. You can fetch this data using `curl` like so:
    43  
    44  ```
    45  $ curl http://localhost:9736/debug/pprof/goroutine?debug=1
    46  ...
    47  ```