{"id":16119657,"url":"https://github.com/piomin/spring-boot-logging","last_synced_at":"2025-04-08T14:06:55.392Z","repository":{"id":41137536,"uuid":"184273819","full_name":"piomin/spring-boot-logging","owner":"piomin","description":"A library for logging HTTP request/response for Spring Boot application and integration with Elastic Stack","archived":false,"fork":false,"pushed_at":"2025-03-21T06:37:10.000Z","size":251,"stargazers_count":248,"open_issues_count":10,"forks_count":81,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-01T12:07:53.727Z","etag":null,"topics":["elasticstack","logback","logging-library","logstash","openfeign","reactor","resttemplate","spring-boot","spring-rest","spring-webf"],"latest_commit_sha":null,"homepage":"https://piotrminkowski.com/","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/piomin.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-04-30T14:09:23.000Z","updated_at":"2025-03-22T09:34:58.000Z","dependencies_parsed_at":"2023-10-13T07:13:53.891Z","dependency_job_id":"5a5f4a14-0a61-4b5b-808f-64cc657d789f","html_url":"https://github.com/piomin/spring-boot-logging","commit_stats":{"total_commits":213,"total_committers":8,"mean_commits":26.625,"dds":0.4460093896713615,"last_synced_commit":"288b919ace5fc7249d059e391dd30586048af6b7"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fspring-boot-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fspring-boot-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fspring-boot-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fspring-boot-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piomin","download_url":"https://codeload.github.com/piomin/spring-boot-logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247856541,"owners_count":21007620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["elasticstack","logback","logging-library","logstash","openfeign","reactor","resttemplate","spring-boot","spring-rest","spring-webf"],"created_at":"2024-10-09T20:54:43.436Z","updated_at":"2025-04-08T14:06:55.373Z","avatar_url":"https://github.com/piomin.png","language":"Java","readme":"## Logging with Spring Boot and Elastic Stack  [![Twitter](https://img.shields.io/twitter/follow/piotr_minkowski.svg?style=social\u0026logo=twitter\u0026label=Follow%20Me)](https://twitter.com/piotr_minkowski)\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.piomin/logstash-logging-spring-boot-starter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.piomin/logstash-logging-spring-boot-starter)\n[![CircleCI](https://circleci.com/gh/piomin/spring-boot-logging.svg?style=svg)](https://circleci.com/gh/piomin/spring-boot-logging)\n\n[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-black.svg)](https://sonarcloud.io/dashboard?id=piomin_spring-boot-logging)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=piomin_spring-boot-logging\u0026metric=bugs)](https://sonarcloud.io/dashboard?id=piomin_spring-boot-logging)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=piomin_spring-boot-logging\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=piomin_spring-boot-logging)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=piomin_spring-boot-logging\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=piomin_spring-boot-logging)\n\n## Main purpose\n\nThis library is created for logging incoming HTTP requests and outgoing HTTP responses and send these logs automatically to Logstash.\n\n## Articles\n \nDetailed description can be found here:\n1. [Logging with Spring Boot and Elastic Stack](https://piotrminkowski.com/2019/05/07/logging-with-spring-boot-and-elastic-stack/)\n2. [Using logstash-logging-spring-boot-starter for logging with Spring Boot and Logstash](https://piotrminkowski.com/2019/10/02/using-logstash-logging-spring-boot-starter-for-logging-with-spring-boot-and-logstash/)\n\n## Features\nIn short, let’s begin from a brief review of main features provided by logstash-logging-spring-boot-starter:\n          \n1. It is able to log all incoming HTTP requests and outgoing HTTP responses with full body, and send those logs to Logstash with the proper tags\n2. It is able to calculate and store an execution time for each request\n3. It generates and propagates correlationId for downstream services calling with Spring RestTemplate or OpenFeign\n4. It is auto-configurable Spring Boot library – you don’t have to do anything more than including it as a dependency to your application to make it work\n\n## Getting started\nThe current version of library is `2.0.3`.\\\nFor logging with Spring WebMvc and Logstash:\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.piomin\u003c/groupId\u003e\n  \u003cartifactId\u003elogstash-logging-spring-boot-starter\u003c/artifactId\u003e\n  \u003cversion\u003e2.0.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor logging with Spring WebMvc and Loki:\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.piomin\u003c/groupId\u003e\n  \u003cartifactId\u003eloki-logging-spring-boot-starter\u003c/artifactId\u003e\n  \u003cversion\u003e2.0.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor logging with Spring WebFlux:\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.piomin\u003c/groupId\u003e\n  \u003cartifactId\u003ereactive-logstash-logging-spring-boot-starter\u003c/artifactId\u003e\n  \u003cversion\u003e2.0.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nBy default, the library is enabled, but tries to locate Logback configuration inside your application to settings for Logstash appender. If such appender won’t be found, the library uses Spring Boot default logging configuration, which does not include Logstash appender. To force it use auto-configured appender definition inside library we have to set property `logging.logstash.enabled` to `true`.\n```\nlogging.logstash:\n  enabled: true\n  url: loki.example.com:5000\n```\n\n## Manual add jar to pom.xml\n\nAdd `reactive-logstash-logging-spring-boot-starter-2.0.3.pom` to `${basedir}/dependencies`\n\nAdd `pom.xml` to `${basedir}/dependencies` and rename to `reactive-logstash-logging-spring-boot-starter-2.0.3.pom`\n\nAdd this script to `pom.xml` in plugins section.\n\n```\n\u003cplugin\u003e\n  \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n  \u003cartifactId\u003emaven-install-plugin\u003c/artifactId\u003e\n  \u003cversion\u003e2.5.1\u003c/version\u003e\n  \u003cconfiguration\u003e\n      \u003cgroupId\u003ecom.github.piomin\u003c/groupId\u003e\n      \u003cartifactId\u003ereactive-logstash-logging-spring-boot-starter\u003c/artifactId\u003e\n      \u003cversion\u003e2.0.3\u003c/version\u003e\n      \u003cpackaging\u003ejar\u003c/packaging\u003e\n      \u003cfile\u003e${basedir}/dependencies/reactive-logstash-logging-spring-boot-starter-1.3.1.RELEASE.jar\u003c/file\u003e\n      \u003cgeneratePom\u003efalse\u003c/generatePom\u003e\n      \u003cpomFile\u003e${basedir}/dependencies/reactive-logstash-logging-spring-boot-starter-1.3.1.RELEASE.pom\u003c/pomFile\u003e\n  \u003c/configuration\u003e\n  \u003cexecutions\u003e\n      \u003cexecution\u003e\n      \u003cid\u003einstall-jar-lib\u003c/id\u003e\n      \u003cgoals\u003e\n        \u003cgoal\u003einstall-file\u003c/goal\u003e\n      \u003c/goals\u003e\n      \u003cphase\u003evalidate\u003c/phase\u003e\n      \u003c/execution\u003e\n  \u003c/executions\u003e\n  \u003c/plugin\u003e\n```","funding_links":[],"categories":["日志库"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiomin%2Fspring-boot-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiomin%2Fspring-boot-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiomin%2Fspring-boot-logging/lists"}