启动时日志配置打印提升可读性
onecer opened this issue · comments
YinYongYou commented
What is the feature you want to add?
我们配置是yaml格式,但是打印出来格式都乱了,找配置也很麻烦
如下:
[INFO] {Bootstrap:{Logger:map[auth:0xc00020d4a0 cache:0xc00020d5e0 config:0xc00020d400 default:0xc00020d720 naming:0xc00020d680 store:0xc00020d540] StartInOrder:map[key:sz open:true] PolarisService:{EnableRegister:true ProbeAddress: Isolated:false HeartbeatInterval:0 Services:[0xc000219800 0xc000219840 0xc000219880 0xc0002198c0]}} APIServers:[{Name:service-eureka Option:map[connLimit:map[maxConnLimit:10240 maxConnPerHost:1024 openConnLimit:false purgeCounterExpired:5s purgeCounterInterval:10s whiteList:127.0.0.1] deltaExpireInterval:60 listenIP:0.0.0.0 listenPort:8761 namespace:default owner:polaris refreshInterval:10 unhealthyExpireInterval:180] API:map[]} {Name:api-http Option:map[connLimit:map[maxConnLimit:5120 maxConnPerHost:128 openConnLimit:false purgeCounterExpired:5s purgeCounterInterval:10s whiteList:127.0.0.1] enablePprof:true enableSwagger:true listenIP:0.0.0.0 listenPort:8090] API:map[admin:{Enable:true Include:[]} client:{Enable:true Include:[discover register healthcheck]} config:{Enable:true Include:[default]} console:{Enable:true Include:[default]}]} {Name:service-grpc Option:map[connLimit:map[maxConnLimit:5120 maxConnPerHost:128 openConnLimit:false] enableCacheProto:true listenIP:0.0.0.0 listenPort:8091 sizeCacheProto:128 tls:map[certFile: keyFile: trustedCAFile:]] API:map[client:{Enable:true Include:[discover register healthcheck]}]} {Name:config-grpc Option:map[connLimit:map[maxConnLimit:5120 maxConnPerHost:128 openConnLimit:false] listenIP:0.0.0.0 listenPort:8093] API:map[client:{Enable:true Include:[]}]} {Name:xds-v3 Option:map[connLimit:map[maxConnLimit:10240 maxConnPerHost:128 openConnLimit:false] listenIP:0.0.0.0 listenPort:15010] API:map[]} {Name:prometheus-sd Option:map[connLimit:map[maxConnLimit:10240 maxConnPerHost:128 openConnLimit:false] listenIP:0.0.0.0 listenPort:9000] API:map[]}] Cache:{Open:true Resources:[{Name:service Option:map[disableBusiness:false needMeta:true]} {Name:instance Option:map[disableBusiness:false needMeta:true]} {Name:routingConfig Option:map[]} {Name:rateLimitConfig Option:map[]} {Name:circuitBreakerConfig Option:map[]} {Name:users Option:map[]} {Name:strategyRule Option:map[]} {Name:namespace Option:map[]} {Name:client Option:map[]}]} Namespace:{AutoCreate:true} Naming:{Auth:map[open:false] Batch:map[clientDeregister:map[concurrency:64 maxBatchCount:32 open:true queueSize:10240 waitTime:32ms] clientRegister:map[concurrency:64 maxBatchCount:1024 open:true queueSize:10240 waitTime:32s] deregister:map[concurrency:128 maxBatchCount:128 open:true queueSize:10240 waitTime:32ms] register:map[concurrency:128 dropExpireTask:true maxBatchCount:128 open:true queueSize:10240 taskLife:30s waitTime:32ms]]} Config:{Open:true Cache:map[expireTimeAfterWrite:3600]} HealthChecks:{Open:true Service:polaris.checker SlotNum:30 LocalHost: MinCheckInterval:1s MaxCheckInterval:30s ClientReportInterval:2m0s Checkers:[{Name:heartbeatMemory Option:map[]}] Batch:map[heartbeat:map[concurrency:64 maxBatchCount:32 open:true queueSize:10240 waitTime:32ms]]} Store:{Name:boltdbStore Option:map[path:./polaris.bolt]} Auth:{Name:defaultAuth Option:map[clientOpen:false consoleOpen:true salt:polarismesh@2021]} Plugin:{CMDB:{Name: Option:map[]} RateLimit:{Name:token-bucket Option:map[api-limit:map[apis:[map[name:POST:/v1/naming/services rule:store-write] map[name:PUT:/v1/naming/services rule:store-write] map[name:POST:/v1/naming/services/delete rule:store-write] map[name:GET:/v1/naming/services rule:store-read] map[name:GET:/v1/naming/services/count rule:store-read]] open:false rules:[map[limit:map[bucket:2000 open:true rate:1000] name:store-read] map[limit:map[bucket:1000 open:true rate:500] name:store-write]]] instance-limit:map[global:map[bucket:200 rate:100] open:true resource-cache-amount:1024] ip-limit:map[global:map[bucket:300 open:true rate:200] open:true resource-cache-amount:1024 white-list:[127.0.0.1]] remote-conf:false]} History:{Name:HistoryLogger Option:map[]} Statis:{Name:local Option:map[interval:60 outputPath:./statis]} DiscoverStatis:{Name:discoverLocal Option:map[interval:60 outputPath:./discover-statis]} ParsePassword:{Name: Option:map[]} Auth:{Name:defaultAuth Option:map[]} MeshResourceValidate:{Name: Option:map[]} DiscoverEvent:{Name:discoverEventLocal Option:map[]}}}
期望打印出来的配置如下:
bootstrap:
logger:
auth:
outputPaths: []
errorOutputPaths: []
rotateOutputPath: log/polaris-auth.log
errorRotateOutputPath: log/polaris-auth-error.log
rotationMaxSize: 100
rotationMaxAge: 7
rotationMaxBackups: 10
jsonEncoding: false
loggrpc: false
outputLevel: info
stackTraceLevel: ""
logCaller: false
cache:
outputPaths: []
errorOutputPaths: []
rotateOutputPath: log/polaris-cache.log
errorRotateOutputPath: log/polaris-cache-error.log
rotationMaxSize: 100
rotationMaxAge: 7
rotationMaxBackups: 10
jsonEncoding: false
loggrpc: false
outputLevel: info
stackTraceLevel: ""
logCaller: false
config:
outputPaths: []
errorOutputPaths: []
rotateOutputPath: log/polaris-config.log
errorRotateOutputPath: log/polaris-config-error.log
rotationMaxSize: 100
rotationMaxAge: 7
rotationMaxBackups: 10
jsonEncoding: false
loggrpc: false
outputLevel: info
stackTraceLevel: ""
logCaller: false
default:
outputPaths:
- stdout
errorOutputPaths:
- stderr
rotateOutputPath: log/polaris-default.log
errorRotateOutputPath: log/polaris-default-error.log
rotationMaxSize: 100
rotationMaxAge: 7
rotationMaxBackups: 10
jsonEncoding: false
loggrpc: false
outputLevel: info
stackTraceLevel: ""
logCaller: false
naming:
outputPaths: []
errorOutputPaths: []
rotateOutputPath: log/polaris-naming.log
errorRotateOutputPath: log/polaris-naming-error.log
rotationMaxSize: 100
rotationMaxAge: 7
rotationMaxBackups: 10
jsonEncoding: false
loggrpc: false
outputLevel: info
stackTraceLevel: ""
logCaller: false
store:
outputPaths: []
errorOutputPaths: []
rotateOutputPath: log/polaris-store.log
errorRotateOutputPath: log/polaris-store-error.log
rotationMaxSize: 100
rotationMaxAge: 7
rotationMaxBackups: 10
jsonEncoding: false
loggrpc: false
outputLevel: info
stackTraceLevel: ""
logCaller: false
startInOrder:
key: sz
open: true
polaris_service:
enable_register: true
probe_address: ""
isolated: false
heartbeat_interval: 0
services:
- name: polaris.discover
namespace: ""
protocols:
- service-grpc
metadata: {}
- name: polaris.healthcheck
namespace: ""
protocols:
- service-grpc
metadata: {}
- name: polaris.checker
namespace: ""
protocols:
- service-grpc
metadata: {}
- name: polaris.config
namespace: ""
protocols:
- config-grpc
metadata: {}
apiservers:
- name: service-eureka
option:
connLimit:
maxConnLimit: 10240
maxConnPerHost: 1024
openConnLimit: false
purgeCounterExpired: 5s
purgeCounterInterval: 10s
whiteList: 127.0.0.1
deltaExpireInterval: 60
listenIP: 0.0.0.0
listenPort: 8761
namespace: default
owner: polaris
refreshInterval: 10
unhealthyExpireInterval: 180
api: {}
- name: api-http
option:
connLimit:
maxConnLimit: 5120
maxConnPerHost: 128
openConnLimit: false
purgeCounterExpired: 5s
purgeCounterInterval: 10s
whiteList: 127.0.0.1
enablePprof: true
enableSwagger: true
listenIP: 0.0.0.0
listenPort: 8090
api:
admin:
enable: true
include: []
client:
enable: true
include:
- discover
- register
- healthcheck
config:
enable: true
include:
- default
console:
enable: true
include:
- default
- name: service-grpc
option:
connLimit:
maxConnLimit: 5120
maxConnPerHost: 128
openConnLimit: false
enableCacheProto: true
listenIP: 0.0.0.0
listenPort: 8091
sizeCacheProto: 128
tls:
certFile: ""
keyFile: ""
trustedCAFile: ""
api:
client:
enable: true
include:
- discover
- register
- healthcheck
- name: config-grpc
option:
connLimit:
maxConnLimit: 5120
maxConnPerHost: 128
openConnLimit: false
listenIP: 0.0.0.0
listenPort: 8093
api:
client:
enable: true
include: []
- name: xds-v3
option:
connLimit:
maxConnLimit: 10240
maxConnPerHost: 128
openConnLimit: false
listenIP: 0.0.0.0
listenPort: 15010
api: {}
- name: prometheus-sd
option:
connLimit:
maxConnLimit: 10240
maxConnPerHost: 128
openConnLimit: false
listenIP: 0.0.0.0
listenPort: 9000
api: {}
cache:
open: true
resources:
- name: service
option:
disableBusiness: false
needMeta: true
- name: instance
option:
disableBusiness: false
needMeta: true
- name: routingConfig
option: {}
- name: rateLimitConfig
option: {}
- name: circuitBreakerConfig
option: {}
- name: users
option: {}
- name: strategyRule
option: {}
- name: namespace
option: {}
- name: client
option: {}
namespace:
autoCreate: true
naming:
auth:
open: false
batch:
clientDeregister:
concurrency: 64
maxBatchCount: 32
open: true
queueSize: 10240
waitTime: 32ms
clientRegister:
concurrency: 64
maxBatchCount: 1024
open: true
queueSize: 10240
waitTime: 32s
deregister:
concurrency: 128
maxBatchCount: 128
open: true
queueSize: 10240
waitTime: 32ms
register:
concurrency: 128
dropExpireTask: true
maxBatchCount: 128
open: true
queueSize: 10240
taskLife: 30s
waitTime: 32ms
config:
open: true
cache:
expireTimeAfterWrite: 3600
healthcheck:
open: true
service: polaris.checker
slotNum: 30
localHost: ""
minCheckInterval: 1s
maxCheckInterval: 30s
clientReportInterval: 2m0s
checkers:
- name: heartbeatMemory
option: {}
batch:
heartbeat:
concurrency: 64
maxBatchCount: 32
open: true
queueSize: 10240
waitTime: 32ms
store:
name: boltdbStore
option:
path: ./polaris.bolt
auth:
name: defaultAuth
option:
clientOpen: false
consoleOpen: true
salt: polarismesh@2021
plugin:
cmdb:
name: ""
option: {}
ratelimit:
name: token-bucket
option:
api-limit:
apis:
- name: POST:/v1/naming/services
rule: store-write
- name: PUT:/v1/naming/services
rule: store-write
- name: POST:/v1/naming/services/delete
rule: store-write
- name: GET:/v1/naming/services
rule: store-read
- name: GET:/v1/naming/services/count
rule: store-read
open: false
rules:
- limit:
bucket: 2000
open: true
rate: 1000
name: store-read
- limit:
bucket: 1000
open: true
rate: 500
name: store-write
instance-limit:
global:
bucket: 200
rate: 100
open: true
resource-cache-amount: 1024
ip-limit:
global:
bucket: 300
open: true
rate: 200
open: true
resource-cache-amount: 1024
white-list:
- 127.0.0.1
remote-conf: false
history:
name: HistoryLogger
option: {}
statis:
name: local
option:
interval: 60
outputPath: ./statis
discoverStatis:
name: discoverLocal
option:
interval: 60
outputPath: ./discover-statis
parsePassword:
name: ""
option: {}
auth:
name: defaultAuth
option: {}
meshResourceValidate:
name: ""
option: {}
Why do you want to add this feature?
How to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.