Skip to content

Commit

Permalink
fix: fix --log_format flag not working (backport #14441) (#14443)
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Marko <marbar3778@yahoo.com>
  • Loading branch information
3 people authored Dec 29, 2022
1 parent 7d986b2 commit 2542d16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (genesis) [#14149](https://github.com/cosmos/cosmos-sdk/pull/14149) Add `simd genesis` command, which contains all genesis-related sub-commands.

### Bug Fixes

* (server) [#14441](https://github.com/cosmos/cosmos-sdk/pull/14441) Fix `--log_format` flag not working.

## [v0.47.0-alpha2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.0-alpha2) - 2022-12-06

### Improvements
Expand Down
7 changes: 6 additions & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate s
return err
}

logger := tmlog.NewTMLogger(tmlog.NewSyncWriter(os.Stdout))
var logger tmlog.Logger
if serverCtx.Viper.GetString(flags.FlagLogFormat) == tmcfg.LogFormatJSON {
logger = tmlog.NewTMJSONLogger(tmlog.NewSyncWriter(os.Stdout))
} else {
logger = tmlog.NewTMLogger(tmlog.NewSyncWriter(os.Stdout))
}
logger, err = tmflags.ParseLogLevel(config.LogLevel, logger, tmcfg.DefaultLogLevel)
if err != nil {
return err
Expand Down

0 comments on commit 2542d16

Please sign in to comment.