---
title: "Observing a Running Spring Boot App from Neovim"
canonical: "https://mnafshin.info/devtools/18-observing-a-running-app/"
author: "Afshin Amini"
date: 2026-12-02
---
# Observing a Running Spring Boot App from Neovim

A running app can tell you how it is doing, if you ask. Spring Boot Actuator is the part of Boot that answers: a set of HTTP endpoints under `/actuator` that report health, metrics, the beans and request mappings that really exist, and the log levels in use. The other source is the log itself. Neovim has no dashboard for either, but both are plain text, and Neovim is good at text.

## Add Actuator without editing the project

Actuator is the `spring-boot-starter-actuator` dependency. Module 9 does not have it, and we left the companion code untouched, so we added the jars at run time. A throwaway `pom.xml` in `~/shop-extras`, outside the repository, lists the starter, plus the PostgreSQL driver that Part 19 needs:

```xml
<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId><version>4.1.2</version>
</parent>
<!-- dependencies: spring-boot-starter-actuator and org.postgresql:postgresql -->
```

From the repository root, copy its jars once, then pass them to `spring-boot:run`:

```bash
./mvnw -q -B -f ~/shop-extras/pom.xml dependency:copy-dependencies -DoutputDirectory=$HOME/shop-extras/lib
./mvnw -B -pl module-09-catalog spring-boot:run \
  -Dspring-boot.run.additional-classpath-elements="$(ls ~/shop-extras/lib/*.jar | paste -sd, -)"
```

The option wants a comma-separated list of jars. Pointing it at the folder compiled and started the app, but `/actuator` answered 404. In your own project, simply add the dependency to `pom.xml`.

## Expose what you need

By default only `health` is on the web. In our run `info`, `metrics`, `env`, `loggers`, `beans` and `mappings` all answered 404. Switch them on for local work:

```text
--management.endpoints.web.exposure.include=health,info,metrics,loggers,env,beans,mappings
--management.endpoint.health.show-details=always
```

Keep this on a development machine. The endpoints show configuration and can change log levels.

## Read the answers with curl and jq

Run these in a Neovim terminal (`<leader>ft`) or a tmux pane from Part 14. They ran against the catalog app on port 8091:

```bash
curl -s localhost:8091/actuator/health | jq -c .status          # "UP"
curl -s localhost:8091/actuator/metrics | jq '.names | length'   # 67
curl -s localhost:8091/actuator/mappings | jq -r '[.. | objects
  | select(has("handler") and (.handler|tostring|test("CatalogController")))]
  | .[].handler'          # ...CatalogController#catalog(Pageable)
```

`health` with details listed a `db` component and its status. `beans` listed our five beans, such as `catalogController` and the two repositories. This differs from `:SpringBoot Beans` in Part 4: that reads the source, and this asks the running app. The `env` endpoint hides property values as `******`; `--management.endpoint.env.show-values=always` shows them.

To keep an answer, read it into a buffer: `:read !curl -s localhost:8091/actuator/health | jq` and `:set ft=json`.

## Change a log level while the app runs

The `loggers` endpoint reads and sets levels. We switched on SQL logging without a restart:

```bash
curl -s -X POST localhost:8091/actuator/loggers/org.hibernate.SQL \
  -H 'Content-Type: application/json' -d '{"configuredLevel":"DEBUG"}'
```

The answer was 204. The next request to `/catalog` wrote `DEBUG ... org.hibernate.SQL` lines to the log. Posting `{"configuredLevel":null}` reset the logger to `INFO`.

## Live hovers and an HTTP client

The VS Code Spring Boot extension shows live bean data from a running app over JMX, as the Spring Tools wiki describes. `spring-boot.nvim` does not: its source says it has no equivalent for the server's live information, so use the endpoints above. We did not test the `startup` endpoint, which needs code changes in the app. LazyVim's `util.rest` extra installs kulala.nvim for `.http` files. Since version 6 that plugin needs a licence token, and LazyVim issue 7270 about it was still open when we looked, so we used curl.

## Write the log as JSON and follow it

Two properties write the log to a file in the ECS JSON format, one object per line; use `logging.structured.format.console=ecs` for the console instead:

```text
--logging.file.name=logs/shop.log --logging.structured.format.file=ecs
```

The file appeared in the module folder, and its timestamps are UTC while the plain console log shows local time. `jq` finds problems:

```bash
jq -r 'select(.log.level=="ERROR") | [.["@timestamp"], .message] | @tsv' logs/shop.log
```

In Neovim, `:terminal tail -F logs/shop.log` followed new lines once we pressed `i` for terminal mode. Add `| jq --unbuffered -r '[.log.level, .message] | @tsv'` for readable lines. A file already open in a buffer reloads with `:checktime`; press `G` for the end. `<leader>sg` greps the whole project: `servlet.service` found four lines in the log. If you exclude `logs/` in `.git/info/exclude`, press `<a-i>` in the picker to include ignored files again; ours found 0 matches until then.

`lnav`, a terminal log viewer, also opened a Spring log inside a Neovim terminal and recognised its levels. Its keys are in its own documentation.

## Recap

- Actuator needs `spring-boot-starter-actuator`; without editing `pom.xml`, pass the jars with `-Dspring-boot.run.additional-classpath-elements`, as a comma-separated list.
- Only `health` is exposed by default; set `management.endpoints.web.exposure.include` for local work and read answers with `curl` and `jq`.
- `POST /actuator/loggers/<name>` changes a log level at runtime, and `null` resets it.
- `spring-boot.nvim` has no live data; we tested curl, not an HTTP-client plugin.
- Structured file logs are JSON lines that `jq` filters; `tail -F` in a Neovim terminal follows them and `<leader>sg` searches them.

**Series: Neovim as a Java IDE.** Previous: [Flame graphs from Java Flight Recorder recordings](/devtools/17-flame-graphs-from-jfr/) · Next: [A complete development loop in Neovim](/devtools/19-a-complete-development-loop/)

## Sources

Official documentation and well-known tutorials read while writing this article. The wording here is our own.

- [Spring Boot reference: Actuator endpoints](https://docs.spring.io/spring-boot/reference/actuator/endpoints.html)
- [Spring Boot reference: Loggers endpoint](https://docs.spring.io/spring-boot/reference/actuator/loggers.html)
- [Spring Boot reference: Metrics](https://docs.spring.io/spring-boot/reference/actuator/metrics.html)
- [Spring Boot reference: Logging and structured logging](https://docs.spring.io/spring-boot/reference/features/logging.html)
- [Spring Boot Maven plugin: Running your application](https://docs.spring.io/spring-boot/maven-plugin/run.html)
- [Spring Tools wiki: Live Application Information](https://github.com/spring-projects/spring-tools/wiki/Live-Application-Information)
- [LazyVim issue 7270: kulala.nvim 6.0.0 licence change](https://github.com/LazyVim/LazyVim/issues/7270)
- [lnav documentation](https://docs.lnav.org/en/latest/)
- [Baeldung: Spring Boot Actuator](https://www.baeldung.com/spring-boot-actuators)
- [Reflectoring: Exploring a Spring Boot app with Actuator and jq](https://reflectoring.io/exploring-a-spring-boot-app-with-actuator-and-jq/)
- [Baeldung: Structured Logging in Spring Boot](https://www.baeldung.com/spring-boot-structured-logging)
