From 2158a9db796b27d16de4ca4fbf3742f5363409b1 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 28 Dec 2022 22:25:36 +0100 Subject: [PATCH 1/2] fix: fix `--log_format` flag not working --- CHANGELOG.md | 3 ++- server/util.go | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f67ba87572eb..9d8888fa8125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,7 +109,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/gov) [#14347](https://github.com/cosmos/cosmos-sdk/pull/14347) Support `v1.Proposal` message in `v1beta1.Proposal.Content`. * (x/gov) [#14390](https://github.com/cosmos/cosmos-sdk/pull/14390) Add title, proposer and summary to proposal struct * (baseapp) [#14417](https://github.com/cosmos/cosmos-sdk/pull/14417) `SetStreamingService` accepts appOptions, AppCodec and Storekeys needed to set streamers. - * Store pacakge no longer has a dependency on baseapp. + * Store pacakge no longer has a dependency on baseapp. * (store) [#14438](https://github.com/cosmos/cosmos-sdk/pull/14438) Pass logger from baseapp to store. ### State Machine Breaking @@ -206,6 +206,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf ### Bug Fixes +* (server) [#](https://github.com/cosmos/cosmos-sdk/pull/) Fix `--log_format` flag not working. * (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again * (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist. * (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` when pubkey is set on a `BaseAccount`. diff --git a/server/util.go b/server/util.go index 05603ba868f5..8d4b672d4958 100644 --- a/server/util.go +++ b/server/util.go @@ -150,7 +150,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 From a1a27c62ee952eec0055b71c435e163865e3b4fa Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 28 Dec 2022 22:26:17 +0100 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d8888fa8125..198753c8d3ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -206,7 +206,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf ### Bug Fixes -* (server) [#](https://github.com/cosmos/cosmos-sdk/pull/) Fix `--log_format` flag not working. +* (server) [#14441](https://github.com/cosmos/cosmos-sdk/pull/14441) Fix `--log_format` flag not working. * (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again * (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist. * (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` when pubkey is set on a `BaseAccount`.