Log File Location
Logs are written toharpoon.log in your Neovim cache directory. To find the exact location:
{cache_path}/harpoon.log.
Common locations:
- Linux/macOS:
~/.cache/nvim/harpoon.log - Windows:
%LOCALAPPDATA%\nvim-data\harpoon.log
Log Levels
Harpoon supports six log levels, from most verbose to least:| Level | Purpose | When to Use |
|---|---|---|
trace | Most detailed logging | Deep debugging, following execution flow |
debug | Detailed debugging information | Troubleshooting mark behavior, configuration issues |
info | Informational messages | General monitoring |
warn | Warning messages (default) | Potential issues that don’t break functionality |
error | Error messages | When operations fail |
fatal | Fatal errors | Critical failures |
The default log level is
warn. Higher verbosity levels (trace, debug) will significantly increase log file size.Setting the Log Level
There are two ways to configure the log level:Method 1: Using Vim Global Variable
Set the log level before callingsetup():
Method 2: Using Environment Variable
TheHARPOON_LOG environment variable takes precedence over vim.g.harpoon_log_level:
- One-time debugging sessions
- Testing without modifying your config
- CI/CD environments
Validation
If you set an invalid log level, Harpoon will default back towarn:
trace, debug, info, warn, error, fatal
Viewing Logs
You can view logs in real-time while using Neovim:What Gets Logged
Different operations log at different levels:Trace Level
- Function entry/exit
- Configuration details
- Mark list operations
- All debug information plus execution flow
Debug Level
- Mark creation and updates
- File path normalization
- Configuration merging
- Project key generation
- Cursor position storage
Warn Level (Default)
- Potential issues (e.g., could not store offset)
- Missing configurations
- Deprecated usage
Error Level
- Invalid operations (e.g., adding harpoon to itself)
- Validation failures
- File operation errors
Common Debugging Scenarios
Marks not persisting between sessions
Marks not persisting between sessions
Set log level to Look for messages about:
debug and check for:save(): Whether marks are being savedensure_correct_config(): Configuration validation- File paths being normalized
save_on_change = falsein config- File permission issues in cache directory
Marks pointing to wrong files
Marks pointing to wrong files
Enable debug logging and check:Look for:
normalize_path()callsproject_key()orbranch_key()output- Path resolution in
create_mark()
- Working directory changes
- Symbolic links
mark_branch = truewith git branch switching
Tabline not updating
Tabline not updating
Set to debug level:Monitor:
emit_changed()calls- Tabline setup messages
- Redraw commands
save_on_change = truein config- No other plugins overriding tabline
Performance issues
Performance issues
Use info or debug level:Watch for:
- Excessive
save()calls - Repeated config reads
- Mark validation operations
- Ensure
save_on_toggle = falseunless needed - Reduce number of marks if very large
Example Debug Session
Here’s a complete example of debugging mark issues:- Add a file to harpoon
- Navigate away and back
- Check the log output
Disabling Logging
To minimize logging (e.g., in production):Even with minimal logging, the log file will still be created. Harpoon uses plenary.log for its logging implementation.