diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c4d60b2aa5..ef1990f569b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Rename `parserprovider.MapProvider` as `config.MapProvider` (#4178) - Rename `parserprovider.Watchable` as `config.WatchableMapProvider` (#4178) +- Remove deprecated no-op flags to setup Collector's logging "--log-level", "--log-profile", "--log-format" (#4213) ## v0.37.0 Beta diff --git a/service/flags.go b/service/flags.go index 8eb90229eab..2c133d3be3a 100644 --- a/service/flags.go +++ b/service/flags.go @@ -19,7 +19,6 @@ import ( "strings" "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/collector/service/internal/telemetrylogs" ) var ( @@ -52,13 +51,7 @@ func (s *stringArrayValue) String() string { func flags() *flag.FlagSet { flagSet := new(flag.FlagSet) - addFlagsFns := []func(*flag.FlagSet){ - configtelemetry.Flags, - telemetrylogs.Flags, - } - for _, addFlags := range addFlagsFns { - addFlags(flagSet) - } + configtelemetry.Flags(flagSet) // At least until we can use a generic, i.e.: OpenCensus, metrics exporter // we default to Prometheus at port 8888, if not otherwise specified. diff --git a/service/internal/telemetrylogs/logger.go b/service/internal/telemetrylogs/logger.go index 913ce6e05ac..ee1c4efa82a 100644 --- a/service/internal/telemetrylogs/logger.go +++ b/service/internal/telemetrylogs/logger.go @@ -15,39 +15,12 @@ package telemetrylogs // import "go.opentelemetry.io/collector/service/internal/telemetrylogs" import ( - "flag" - "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.opentelemetry.io/collector/config" ) -const ( - logLevelCfg = "log-level" - logProfileCfg = "log-profile" - logFormatCfg = "log-format" -) - -var ( - defaultLogValue = "deprecated" - // Command line pointer to logger level flag configuration. - loggerLevelPtr = &defaultLogValue - loggerProfilePtr = &defaultLogValue - loggerFormatPtr = &defaultLogValue -) - -// Flags adds flags related to service telemetry logs to the given flagset. -// Deprecated: keep this flag for preventing the breaking change. Use `service::telemetry::logs` in config instead. -func Flags(flags *flag.FlagSet) { - loggerLevelPtr = flags.String(logLevelCfg, defaultLogValue, "Deprecated. Define the logging configuration as part of the configuration file, under the 'service' section.") - - loggerProfilePtr = flags.String(logProfileCfg, defaultLogValue, "Deprecated. Define the logging configuration as part of the configuration file, under the 'service' section.") - - // Note: we use "console" by default for more human-friendly mode of logging (tab delimited, formatted timestamps). - loggerFormatPtr = flags.String(logFormatCfg, defaultLogValue, "Deprecated. Define the logging configuration as part of the configuration file, under the 'service' section.") -} - func NewLogger(cfg config.ServiceTelemetryLogs, options []zap.Option) (*zap.Logger, error) { // Copied from NewProductionConfig. zapCfg := &zap.Config{ @@ -72,20 +45,5 @@ func NewLogger(cfg config.ServiceTelemetryLogs, options []zap.Option) (*zap.Logg if err != nil { return nil, err } - logDeprecatedMessages(logger) return logger, nil } - -func logDeprecatedMessages(logger *zap.Logger) { - if *loggerLevelPtr != defaultLogValue { - logger.Warn("`log-level` command line option has been deprecated. Use `service::telemetry::logs` in config instead!") - } - - if *loggerProfilePtr != defaultLogValue { - logger.Warn("`log-profile` command line option has been deprecated. Use `service::telemetry::logs` in config instead!") - } - - if *loggerFormatPtr != defaultLogValue { - logger.Warn("`log-format` command line option has been deprecated. Use `service::telemetry::logs` in config instead!") - } -}