openziti / ziti-sdk-jvm

Ziti SDK for JVM
https://openziti.org
Apache License 2.0
54 stars 12 forks source link

SDK constantly logging what edge routers are attached #311

Closed dovholuknf closed 1 year ago

dovholuknf commented 2 years ago

Running a hosted service so the service just sits there listening. Every minute this line is logged. I gave a quick scan of markdowns but didn't see any clear guidance indicating the preferred method of suppressing this message. Document the preferred method of logging/handling log messages

2022-04-05 18:24:35.416  INFO 23700 --- [atcher-worker-7] ZitiContextImpl                          : current edge routers = [EdgeRouter(name=an-edge-router, hostname=, supportedProtocols={tls=tls://100.25.84.148:443}, urls=null)]
2022-04-05 18:25:35.781  INFO 23700 --- [atcher-worker-7] ZitiContextImpl                          : current edge routers = [EdgeRouter(name=an-edge-router, hostname=, supportedProtocols={tls=tls://100.25.84.148:443}, urls=null)]
2022-04-05 18:26:36.155  INFO 23700 --- [atcher-worker-5] ZitiContextImpl                          : current edge routers = [EdgeRouter(name=an-edge-router, hostname=, supportedProtocols={tls=tls://100.25.84.148:443}, urls=null)]
2022-04-05 18:27:36.838  INFO 23700 --- [atcher-worker-7] ZitiContextImpl                          : current edge routers = [EdgeRouter(name=an-edge-router, hostname=, supportedProtocols={tls=tls://100.25.84.148:443}, urls=null)]
2022-04-05 18:28:37.227  INFO 23700 --- [atcher-worker-5] ZitiContextImpl                          : current edge routers = [EdgeRouter(name=an-edge-router, hostname=, supportedProtocols={tls=tls://100.25.84.148:443}, urls=null)]
2022-04-05 18:29:38.112  INFO 23700 --- [atcher-worker-5] ZitiContextImpl                          : current edge routers = [EdgeRouter(name=an-edge-router, hostname=, supportedProtocols={tls=tls://100.25.84.148:443}, urls=null)]
thiloplanz commented 1 year ago

The Ziti JVM SDK uses SLF4J for its logging. The output can be configured in the "normal" ways.

I was about to update the documentation with a sample how to do that with Spring Boot, but at the moment we don't follow the standard naming convention for logger names, which makes this a bit cumbersome. A library is expected to group all its loggers under a prefix, so that they can be targeted for configuration easily. But we name loggers ZitiContextImpl instead of, say, org.openziti.impl.ZitiContextImpl. (The spring-boot module already follows this pattern, but the core library does not).

Is it okay if I change class ZitiLog to use the full package name?

Also, for the recurring log output in question here, I think we should lower its level to DEBUG (which will already remove the output in most setups in their default configuration).

The best you can probably do right now is putting something like this into application.properties (if you use Spring Boot), but that will also silence some other potentially useful INFO.

logging.group.ziti = ZitiContextImpl
logging.level.ziti = WARN