{"id":27437560,"url":"https://github.com/polarfish/datasource-proxy-log-formatter","last_synced_at":"2025-10-08T03:38:44.634Z","repository":{"id":71655458,"uuid":"417264915","full_name":"polarfish/datasource-proxy-log-formatter","owner":"polarfish","description":"Extracts, interpolates, formats and pretty prints SQL from datasource-proxy json logs.","archived":false,"fork":false,"pushed_at":"2025-03-20T12:00:55.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T20:38:56.625Z","etag":null,"topics":["datasource-proxy","java","spring-boot","sql"],"latest_commit_sha":null,"homepage":"https://formatlog.polarfish.nl","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polarfish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-10-14T19:55:48.000Z","updated_at":"2025-03-20T12:00:59.000Z","dependencies_parsed_at":"2025-03-21T14:16:32.534Z","dependency_job_id":null,"html_url":"https://github.com/polarfish/datasource-proxy-log-formatter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/polarfish/datasource-proxy-log-formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarfish%2Fdatasource-proxy-log-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarfish%2Fdatasource-proxy-log-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarfish%2Fdatasource-proxy-log-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarfish%2Fdatasource-proxy-log-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polarfish","download_url":"https://codeload.github.com/polarfish/datasource-proxy-log-formatter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polarfish%2Fdatasource-proxy-log-formatter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278886365,"owners_count":26062972,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"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":["datasource-proxy","java","spring-boot","sql"],"created_at":"2025-04-14T20:29:45.756Z","updated_at":"2025-10-08T03:38:44.617Z","avatar_url":"https://github.com/polarfish.png","language":"HTML","readme":"# datasource-proxy-log-formatter\nExtracts, interpolates, formats and pretty prints SQL from [datasource-proxy](https://github.com/ttddyy/datasource-proxy) json logs.\n\n## Implementation details\n\n- parses raw SLF4J logs using RegEx\n- extracts and interpolates queries logged by [datasource-proxy](https://github.com/ttddyy/datasource-proxy) in JSON format\n- formats the queries using [sql-formatter](https://github.com/zeroturnaround/sql-formatter)\n- highlights the queries using [highlight.js](https://github.com/highlightjs/highlight.js)\n\n## Screenshots\n\n![image](https://user-images.githubusercontent.com/1070579/141092105-873e98f6-84ef-48d0-94d8-ab38778ae5a1.png)\n\n\n## Configuring Datasource Proxy for Spring Boot Tests\n\n#### pom.xml\n```xml\n \u003cdependency\u003e\n    \u003cgroupId\u003enet.ttddyy\u003c/groupId\u003e\n    \u003cartifactId\u003edatasource-proxy\u003c/artifactId\u003e\n    \u003cversion\u003e1.7\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n#### DatasourceProxyConfig.java\n```java\npackage my.app;\n\n// imports skipped\n\n@TestConfiguration\nclass DatasourceProxyConfig implements BeanPostProcessor {\n\n    @Override\n    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {\n\n        if (bean instanceof DataSource) {\n            return ProxyDataSourceBuilder\n                .create((DataSource) bean)\n                .name(\"dataSource-proxy\")\n                .logQueryBySlf4j(SLF4JLogLevel.DEBUG)\n                .asJson()\n                .build();\n        }\n\n        return bean;\n    }\n}\n```\n\n#### BaseIT.java\n```java\npackage my.app;\n\n// imports skipped\n\n@SpringBootTest(classes = {\n    Application.class,\n    DatasourceProxyConfig.class\n})\n@RunWith(SpringRunner.class)\n@ActiveProfiles(\"integration\")\npublic abstract class BaseIT {\n    // ...\n}\n```\n\n#### application-integration.yml\n```yaml\n# ...\nlogging:\n  level:\n    # Set SLF4JQueryLoggingListener log level to \"debug\" to enable Datasource Proxy Query logging\n    net.ttddyy.dsproxy.listener.logging.SLF4JQueryLoggingListener: off\n# ...\n```\n\nFor more configuration examples check [datasource-proxy-examples](https://github.com/ttddyy/datasource-proxy-examples)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolarfish%2Fdatasource-proxy-log-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolarfish%2Fdatasource-proxy-log-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolarfish%2Fdatasource-proxy-log-formatter/lists"}