首页 > 编程知识 正文

springboot log配置

时间:2023-05-06 18:11:05 阅读:186104 作者:4784

gradle引入logbook相关设置:

compile (org.zalando : logbook-spring-boot-starter :1.13.0 ) (Excludegroup: ) org.zalando,modando

logbook.format.style=http logbook.write.level=info logging.level.org.zalando.logbook=trace #以下是增值配置上的三者logbook.write.max-body-size=5000 logbook.write.chunk-size=5000 logbook.obfuscate.headers=app-users在实现中/swagger-ui.html Logbook配置项目快乐卡无p跳线/p快乐卡p logbook.format.style每个免配置效果跳线无p跳线strong logbook.format.style=无curl跳线PC URL-v-xpost ' 愚人节50 charset=utf-8 '-h ' accept-encoding : gzip,deflate,br' -H 'accept-language: zh-CN,zh; q=0.9 '-h ' connection : keep-alive '-h ' content-length :105 '-h ' content-type : application/Jon '-h ' host : localhost :9013 '-h ' origin :3358 localhost 33609013 '-h ' referer :3358 localhost 33609013 '-h A Brand '; v='99 ',' Chromium '; v=' 93 ' '-h ' sec-ch-ua-mobile : 0 '-h ' sec-ch-ua-platform 3360 ' MAC OS '-h ' sec-fetch-dest 3360 empty '-h ' sec-fetch-mode 3360 CORS '-mode like gecko (chrome/93.0.4577.63 safari/537.36 '-- data-binary ' { ' end _ time ' : ' 2021-12-31233333333333333333666660599 ’logbook.format.style=JSON的自由跳跃糖/p { ' origin ' 3360 ' rer or ' correlation ' : ' 957 da 04 C4 ea7ffbc ',' protococod ' uri ' : ' http://localhost :9013/ccapi/work/getworkorderlist ',' headers ' : { ' accept ' 3360 [ ' appplica ' accept-encoding':['gzip,deflate,br'],' accept-language':['zh-CN,zh] q=0.9'],' connnennet ' content-type ' : [ ] ' origin ' : [ ' http://localhost 33609013 ' ]、' referer ' : [ ' http://localhost 33609013 ] A Brand'; v='99','Chromium'; v='93' ',' sec-ch-ua-mobile ' : [?] 0']、' sec-ch-ua-platform ' : [ '' MAC OS' ]、' sec-fetch-dest':['empty']、' sec、' fetc

h-site":["same-origin"],"user-agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"]},"body":{"end_time":"2021-12-31 23:59:59","page":0,"rows":10,"start_time":"2021-10-01 00:00:00"}} logbook.format.style= http完全按http格式输出日志

POST http://localhost:9013/ccapi/work/getWorkOrderList HTTP/1.1sec-fetch-mode: corsreferer: http://localhost:9013/swagger-ui.htmlcontent-length: 105sec-fetch-site: same-originaccept-language: zh-CN,zh;q=0.9origin: http://localhost:9013accept: application/json;charset=UTF-8sec-ch-ua: "Google Chrome";v="93", " Not;A Brand";v="99", "Chromium";v="93"sec-ch-ua-mobile: ?0sec-ch-ua-platform: "macOS"host: localhost:9013content-type: application/jsonconnection: keep-aliveaccept-encoding: gzip, deflate, bruser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36sec-fetch-dest: empty{  "end_time": "2021-12-31 23:59:59",  "page": 0,  "rows": 10,  "start_time": "2021-10-01 00:00:00"} logbook.format.style= splunk origin=remote type=request correlation=cb441ddf6c94dcc1 protocol=HTTP/1.1 remote=0:0:0:0:0:0:0:1 method=POST uri=http://localhost:9013/ccapi/work/getWorkOrderList headers={accept=[application/json;charset=UTF-8], accept-encoding=[gzip, deflate, br], accept-language=[zh-CN,zh;q=0.9], connection=[keep-alive], content-length=[105], content-type=[application/json], host=[localhost:9013], origin=[http://localhost:9013], referer=[http://localhost:9013/swagger-ui.html], sec-ch-ua=["Google Chrome";v="93", " Not;A Brand";v="99", "Chromium";v="93"], sec-ch-ua-mobile=[?0], sec-ch-ua-platform=["macOS"], sec-fetch-dest=[empty], sec-fetch-mode=[cors], sec-fetch-site=[same-origin], user-agent=碧蓝的舞蹈/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36]} body={  "end_time": "2021-12-31 23:59:59",  "page": 0,  "rows": 10,  "start_time": "2021-10-01 00:00:00"} logbook.write.max-body-size=10最大body长度效果如下,超过10的部分会按…显示(请求 返回的body都会受这个配置影响)

POST http://localhost:9013/ccapi/work/getWorkOrderList HTTP/1.1sec-fetch-mode: corsreferer: http://localhost:9013/swagger-ui.htmlcontent-length: 105sec-fetch-site: same-originaccept-language: zh-CN,zh;q=0.9origin: http://localhost:9013accept: application/json;charset=UTF-8sec-ch-ua: "Google Chrome";v="93", " Not;A Brand";v="99", "Chromium";v="93"sec-ch-ua-mobile: ?0sec-ch-ua-platform: "macOS"host: localhost:9013content-type: application/jsonconnection: keep-aliveaccept-encoding: gzip, deflate, bruser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36sec-fetch-dest: empty{  "end_t... logbook.obfuscate.headers = app-user混淆请求中特定的key这里支持多个,用逗号分隔效果类似打码,原始的header内容变成了xxx

GET http://localhost:9013/ccapi/maicai/getUserInfo?mobile=15250502950 HTTP/1.1sec-fetch-mode: corsreferer: http://localhost:9013/swagger-ui.htmlsec-fetch-site: same-originaccept-language: zh-CN,zh;q=0.9app-user: XXXaccept: application/json;charset=UTF-8sec-ch-ua: "Google Chrome";v="93", " Not;A Brand";v="99", "Chromium";v="93"sec-ch-ua-mobile: ?0sec-ch-ua-platform: "macOS"host: localhost:9013connection: keep-aliveaccept-encoding: gzip, deflate, bruser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36sec-fetch-dest: empty logbook.exclude=/ccapi/maicai/countAdvice,/ccapi/work/getWorkOrderList-------------------------logbook.write.chunk-size = 100 {"msg":"请求成功","code":0,"timestamp":"2021-11-16 20: [cc-admin-service-0ac1e87a-454740-33085] 40:12","success":true,"data":{"name":"lindaman","mobile":"15250502950","id":"5b45bd61c5702e77788b538 [cc-admin-service-0ac1e87a-454740-33085] 5","status_str":"正常","sex":3,"im_uid":"2093996","role_str":"用户","point_total":"205"},"exec_time": [cc-admin-service-0ac1e87a-454740-33085] 1050}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。