Skip to content

feat: log requests, errors and exits - #17

Merged
turegjorup merged 6 commits into
mainfrom
feature/8293-logging
Sep 24, 2026
Merged

turegjorup merged 6 commits into
mainfrom
feature/8293-logging

Conversation

@turegjorup

@turegjorup turegjorup commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Adds logging to app.js, and runs Express in production mode on the server.

https://leantime.itkdev.dk/#/tickets/showTicket/8293

Changes

  • One line per request: method, path, status, duration, row count, client IP.
  • A line for requests the client aborted before the response was sent (req GET ... aborted after 30012ms). finish never fires for those, and they disappear entirely once nginx is gone (refactor: route traefik straight to node and drop nginx #23).
  • Route errors logged with message and stack.
  • A warning when an empty result falls back to the cache, naming the route and the cache age.
  • Exit cause logged for uncaughtException, unhandledRejection, SIGTERM and SIGINT.
  • docker-compose.server.yml: NODE_ENV=production. It was unset, so Express ran in development mode: its default error handler logged the stack a second time and put the stack trace, server names included, in the 500 response body.

Console only. No new dependency.

Verify

cp config.dev.js.dist config.js
docker compose run --rm node yarn install
docker compose --profile db up --detach
docker compose run --rm node node .docker/mssql/seed.js
docker compose run --rm node node test.js
docker compose logs node

Expected: 7/7 passed, and lines of the form req GET /posidryeartsl.csv 200 142ms rows=500 ip=... in the node log.

Stacked on #16.

@turegjorup
turegjorup added this pull request to stack #32 September 24, 2026 11:12
Base automatically changed from feature/8293-test-baseline to main September 24, 2026 11:27
@turegjorup
turegjorup merged commit 9a7019b into main Sep 24, 2026
1 check passed
@turegjorup
turegjorup deleted the feature/8293-logging branch September 24, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants