{"id":19199649,"url":"https://github.com/aaroncoplan/spring-request-logging","last_synced_at":"2026-04-20T04:02:05.697Z","repository":{"id":67336534,"uuid":"177028437","full_name":"AaronCoplan/spring-request-logging","owner":"AaronCoplan","description":"Configurable, multi-mode library for logging request traffic in applications using the Spring Framework.","archived":false,"fork":false,"pushed_at":"2019-04-11T16:20:48.000Z","size":119,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T05:22:54.616Z","etag":null,"topics":["java","java-library","logging","spring","spring-boot","spring-framework"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AaronCoplan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-21T21:46:19.000Z","updated_at":"2019-04-11T16:22:22.000Z","dependencies_parsed_at":"2023-02-23T12:30:18.147Z","dependency_job_id":null,"html_url":"https://github.com/AaronCoplan/spring-request-logging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AaronCoplan/spring-request-logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCoplan%2Fspring-request-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCoplan%2Fspring-request-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCoplan%2Fspring-request-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCoplan%2Fspring-request-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AaronCoplan","download_url":"https://codeload.github.com/AaronCoplan/spring-request-logging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronCoplan%2Fspring-request-logging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32032302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","java-library","logging","spring","spring-boot","spring-framework"],"created_at":"2024-11-09T12:28:16.318Z","updated_at":"2026-04-20T04:02:05.654Z","avatar_url":"https://github.com/AaronCoplan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring-request-logging\nThis package provides a configurable, multi-mode library for logging request traffic in applications using the Spring Framework.  The **spring-request-logging** package automatically extracts metadata from every request and provides you with a simple interface to handle those results using one of two modes: **single**, or **batched**.  The following two sections detail how to use each of these modes.  \n\nThe code for the library can be found in the `library/` directory, and a sample Spring Boot application using the library can be found in the `sample-application/` directory.\n\n## Single Mode\n\nA request logger that runs in **single mode** will execute once for each request, after the response has been flushed to the client.  To create a `SingleRequestLogger`, implement the [SingleRequestLogger](https://github.com/AaronCoplan/spring-request-logging/blob/master/library/src/main/java/com/aaroncoplan/springrequestlogging/SingleRequestLogger.java) interface and then [add it to your interceptor registry](https://github.com/AaronCoplan/spring-request-logging/blob/master/sample-application/src/main/java/com/aaroncoplan/Application.java#L28).  This requires you to implement the following function:\n\n```java\nvoid processSingleRequest(RequestData requestData)\n```\n\nOptionally, you may override the following function to extract the request pattern from the handler:\n\n```java\nString extractRequestPattern(Object handler)\n```\nFor more information about what data is contained within a `RequestData` object, see [its implementation](https://github.com/AaronCoplan/spring-request-logging/blob/master/library/src/main/java/com/aaroncoplan/springrequestlogging/RequestData.java).\n\n## Batched Mode\n\nA request logger that runs in **batched mode** will add `RequestData` objects to a batch until it reaches the defined **batch size**, at which point it will execute the handler function for the entire batch, after the response has been flushed to the client.  To create a `BatchedRequestLogger`, implement the [BatchedRequestLogger](https://github.com/AaronCoplan/spring-request-logging/blob/master/library/src/main/java/com/aaroncoplan/springrequestlogging/BatchedRequestLogger.java) interface and then [add it to your interceptor registry](https://github.com/AaronCoplan/spring-request-logging/blob/master/sample-application/src/main/java/com/aaroncoplan/Application.java#L28).  This requires you to implement the following functions:\n\n```java\nint getBatchSize()\nvoid processRequestBatch(List\u003cRequestData\u003e batch)\n```\nOptionally, you may override the following function to extract the request pattern from the handler:\n\n```java\nString extractRequestPattern(Object handler)\n```\n\nFor more information about what data is contained within a `RequestData` object, see [its implementation](https://github.com/AaronCoplan/spring-request-logging/blob/master/library/src/main/java/com/aaroncoplan/springrequestlogging/RequestData.java).\n\n## Performance Benchmarks\n\nIn the performance benchmarks that were run, the **spring-request-logging framework itself** introduces no significant measurable overhead to processing requests. However, writing a slow `SingleRequestLogger` will reduce your server's throughput, so if your processing of request metadata involves anything with significant computational cost or overhead, it is recommended to use a `BatchedRequestLogger`.  The results from the benchmarks can be found below, as well as the methodology used to conduct them.  You can see that in some instances, the applications using the benchmark loggers run faster than applications without using the **spring-request-logging** package.  In other instances, the benchmark loggers are slower on the scale of microseconds.  Thus, no conclusive, significant overhead is measured.\n\n### Small Server Benchmark (1 vCPU, 3.75 GB RAM, results in mean ms/request)\n\n| Logger Type | 100k Requests, 1 Concurrent Request | 100k Requests, 50 Concurrent Requests | 100k Requests, 250 Concurrent Requests |\n| ---------------- | -------------------- | ---------------------- | ----------------------- |\n| Without spring-request-logging framework        | 0.632                | 0.469                  | 0.525                   |\n| Single Logger    | 0.620                | 0.479                  | 0.507                   |\n| Batch Logger with batch size of 10  | 0.637                | 0.486                  | 0.514                   |\n| Batch Logger with batch size of 250 | 0.644                | 0.475                  | 0.557                   |\n\n### Large Server Benchmark (4 vCPU, 15 GB RAM, results in mean ms/request)\n\n| Logger Type  | 100k Requests, 1 Concurrent Request |  100k Requests, 50 Concurrent Requests | 100k Requests, 250 Concurrent Requests |\n| ---------------- | -------------------- | ---------------------- | ----------------------- |\n| Without spring-request-logging framework        | 0.711                | 0.176                  | 0.165                   |\n| Single Logger    | 0.719                | 0.173                  | 0.156                   |\n| Batch Logger with batch size of 10  | 0.736                | 0.169                  | 0.161                   |\n| Batch Logger with batch size of 250 | 0.725                | 0.174                  | 0.164                   |\n\n### Methodology\n\n* Ran on Google Compute Engine in the us-central1-c region\n* 1 client benchmark server using Apache Benchmark, n1-standard-4 (4 vCPUs, 15 GB memory), Ubuntu 16.04 LTS\n* 1 small server running the example request loggers, n1-standard-1 (1 vCPU, 3.75 GB memory), Ubuntu 16.04 LTS\n* 1 larger server running the example request loggers, n1-standard-4 (4 vCPUs, 15 GB memory), Ubuntu 16.04 LTS\n* Used internal Google Cloud IPs\n* Single endpoint serving a constant string\n* Process for each benchmark:\n   1. Start the server\n   2. Warm the server up with 10 requests\n   3. Run the Apache Benchmark command on the benchmark server, making requests to the application\n   4. Kill the server\n* Command for benchmarking with no concurrent connections --\u003e ab -n 100000 -c 1 http://\u003cip\u003e:\u003cport\u003e/\n* Command for medium concurrency --\u003e ab -n 100000 -c 50 http://\u003cip\u003e:\u003cport\u003e/\n* Command for high concurrency --\u003e ab -n 100000 -c 250 http://\u003cip\u003e:\u003cport\u003e/\n* Results are in mean ms/request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaroncoplan%2Fspring-request-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaroncoplan%2Fspring-request-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaroncoplan%2Fspring-request-logging/lists"}