/area API
/area test-and-release
/kind cleanup
Expected Behavior
In general libraries should make logging optional or not log at all, so that the user of the library can control when the libraries log.
Specifically, the logging library in serving should allow users to control whether or not it outputs logs, or not log at all.
Actual Behavior
If a new logger is instantiated with knative/serving/blob/master/pkg/logging/config.go, logs are output at Info
and Error
levels. This can be seen when running the e2e tests (see below), the first line of output is:
info logging/config.go:90 Successfully created the logger. {"knative.dev/jsonconfig": "{\n\t \"level\": \"info\",\n\t \"encoding\": \"console\",\n\t \"outputPaths\": [\"stdout\"],\n\t \"errorOutputPaths\": [\"stderr\"],\n\t \"encoderConfig\": {\n\t \"messageKey\": \"message\",\n\t\t\t\"levelKey\": \"level\",\n\t\t\t\"nameKey\": \"logger\",\n\t\t\t\"callerKey\": \"caller\",\n\t\t\t\"messageKey\": \"msg\",\n \"stacktraceKey\": \"stacktrace\",\n \"lineEnding\": \"\",\n \"levelEncoder\": \"\",\n \"timeEncoder\": \"\",\n \"durationEncoder\": \"\",\n \"callerEncoder\": \"\"\n\t }\n\t}"}
This should be optional so the tests can suppress it. (Bonus, if we DO want output like this, it could be human readable.)
Steps to Reproduce the Problem
You can reproduce this by running the tests with go test -v -tags=e2e -count=1 ./test/conformance
:
โ serving git:(master) โ go test -v -tags=e2e -count=1 ./test/conformance
info logging/config.go:90 Successfully created the logger. {"knative.dev/jsonconfig": "{\n\t \"level\": \"info\",\n\t \"encoding\": \"console\",\n\t \"outputPaths\": [\"stdout\"],\n\t \"errorOutputPaths\": [\"stderr\"],\n\t \"encoderConfig\": {\n\t \"messageKey\": \"message\",\n\t\t\t\"levelKey\": \"level\",\n\t\t\t\"nameKey\": \"logger\",\n\t\t\t\"callerKey\": \"caller\",\n\t\t\t\"messageKey\": \"msg\",\n \"stacktraceKey\": \"stacktrace\",\n \"lineEnding\": \"\",\n \"levelEncoder\": \"\",\n \"timeEncoder\": \"\",\n \"durationEncoder\": \"\",\n \"callerEncoder\": \"\"\n\t }\n\t}"}
info logging/config.go:91 Logging level set to info
=== RUN TestBlueGreenRoute
info TestBlueGreenRoute test/crd.go:162 Seeding rand.Rand with 1532043361426063011
info TestBlueGreenRoute conformance/blue_green_test.go:166 Creating a Configuration
info TestBlueGreenRoute conformance/blue_green_test.go:173 The Configuration will be updated with the name of the Revision once it is created
Additional Info
n/a