reference Flags

--debug

Accepted by
opengrep scan, opengrep ci, opengrep test, opengrep validate, opengrep show, opengrep lsp
See also
--verbose, --quiet, OPENGREP_LOG_LEVEL, OPENGREP_LOG_SRCS, OPENGREP_LOG_FILE

Sets the log level on standard error to debug. In addition to what --verbose shows, the logs include the internals of the run: the targets as they are selected, the rules as they are prepared, and the progress of the engine. Even a scan of one file logs hundreds of lines.

OPENGREP_LOG_SRCS and OPENGREP_LOG_TAGS restrict the output to parts of Opengrep. OPENGREP_LOG_FILE writes a copy of the logs to a file.

Examples

A higher log level

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
app.py
eval(1)
Command and result
$ opengrep scan --config rule.yaml --verbose app.py 2>&1 >/dev/null | grep -c setup_logging
0
$ opengrep scan --config rule.yaml --debug app.py 2>&1 >/dev/null | grep -c setup_logging
1

The counted line is logged by the engine while it starts up: --verbose does not show it, and --debug does.