envoy: ensure command line args reflect the current log level (#779)

This commit is contained in:
Travis Groth 2020-05-26 11:37:10 -04:00 committed by GitHub
parent e8f539e69e
commit aba549a70f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,6 +43,7 @@ type Server struct {
grpcPort, httpPort string
opts *config.Options
logLevel string
}
// NewServer creates a new server with traffic routed by envoy.
@ -60,6 +61,12 @@ func NewServer(opts *config.Options, grpcPort, httpPort string) (*Server, error)
opts: opts,
}
if srv.opts.ProxyLogLevel != "" {
srv.logLevel = srv.opts.ProxyLogLevel
} else {
srv.logLevel = srv.opts.LogLevel
}
err = srv.writeConfig()
if err != nil {
return nil, fmt.Errorf("error writing initial envoy configuration: %w", err)
@ -78,7 +85,7 @@ func (srv *Server) Run(ctx context.Context) error {
srv.cmd = exec.CommandContext(ctx, envoyPath,
"-c", configFileName,
"--log-level", log.Logger.GetLevel().String(),
"--log-level", srv.logLevel,
"--log-format", "[LOG_FORMAT]%l--%n--%v",
"--log-format-escaped",
"--disable-hot-restart",