From ddb066f3fbcd99878baa1a5735719a9b0800c573 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 29 Dec 2022 10:09:16 +0100 Subject: [PATCH 1/4] fix: fix `--log_format` flag not working (#14441) (cherry picked from commit 82bd8880fc56dad6abe3a99698212c930cc93033) # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 16 ++++++++++++++++ server/util.go | 7 ++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad64fdb217d..d58e49c3799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -156,7 +156,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) `types/module.Manager` now supports the `cosmossdk.io/core/appmodule.AppModule` API via the new `NewManagerFromMap` constructor. * [#14019](https://github.com/cosmos/cosmos-sdk/issues/14019) Remove the interface casting to allow other implementations of a `CommitMultiStore`. +<<<<<<< HEAD * [#14175](https://github.com/cosmos/cosmos-sdk/pull/14175) Add `server.DefaultBaseappOptions(appopts)` function to reduce boiler plate in root.go. +======= +* [#13881](https://github.com/cosmos/cosmos-sdk/pull/13881) Optimize iteration on nested cached KV stores and other operations in general. +* (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) [#14438](https://github.com/cosmos/cosmos-sdk/pull/14438) Pass logger from baseapp to store. +>>>>>>> 82bd8880f (fix: fix `--log_format` flag not working (#14441)) ### State Machine Breaking @@ -239,7 +248,14 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf ### Bug Fixes +<<<<<<< HEAD * (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` and `MarshalYAML` panics when pubkey is set on a `BaseAccount`. +======= +* (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`. +>>>>>>> 82bd8880f (fix: fix `--log_format` flag not working (#14441)) * (rosetta) [#13583](https://github.com/cosmos/cosmos-sdk/pull/13583) Misc fixes for cosmos-rosetta. * (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Fix evidence query API to decode the hash properly. * (bank) [#13691](https://github.com/cosmos/cosmos-sdk/issues/13691) Fix unhandled error for vesting account transfers, when total vesting amount exceeds total balance. diff --git a/server/util.go b/server/util.go index 558628db26a..570635fba81 100644 --- a/server/util.go +++ b/server/util.go @@ -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 From df67248eb4b7d02136f6245ab46f58d0c28c74de Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 29 Dec 2022 10:11:43 +0100 Subject: [PATCH 2/4] Update CHANGELOG.md --- CHANGELOG.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d58e49c3799..23e8d914bcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -156,16 +156,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) `types/module.Manager` now supports the `cosmossdk.io/core/appmodule.AppModule` API via the new `NewManagerFromMap` constructor. * [#14019](https://github.com/cosmos/cosmos-sdk/issues/14019) Remove the interface casting to allow other implementations of a `CommitMultiStore`. -<<<<<<< HEAD * [#14175](https://github.com/cosmos/cosmos-sdk/pull/14175) Add `server.DefaultBaseappOptions(appopts)` function to reduce boiler plate in root.go. -======= -* [#13881](https://github.com/cosmos/cosmos-sdk/pull/13881) Optimize iteration on nested cached KV stores and other operations in general. -* (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) [#14438](https://github.com/cosmos/cosmos-sdk/pull/14438) Pass logger from baseapp to store. ->>>>>>> 82bd8880f (fix: fix `--log_format` flag not working (#14441)) ### State Machine Breaking From d1302896dfded55f9789e0c3a86ee2ea926ce66a Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 29 Dec 2022 10:11:48 +0100 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23e8d914bcb..615fb2baaae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -239,14 +239,8 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf ### Bug Fixes -<<<<<<< HEAD * (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` and `MarshalYAML` panics when pubkey is set on a `BaseAccount`. -======= * (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`. ->>>>>>> 82bd8880f (fix: fix `--log_format` flag not working (#14441)) * (rosetta) [#13583](https://github.com/cosmos/cosmos-sdk/pull/13583) Misc fixes for cosmos-rosetta. * (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Fix evidence query API to decode the hash properly. * (bank) [#13691](https://github.com/cosmos/cosmos-sdk/issues/13691) Fix unhandled error for vesting account transfers, when total vesting amount exceeds total balance. From b37a8a6ad69cac833fe0cab8213ca756e268bb7c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 29 Dec 2022 10:15:50 +0100 Subject: [PATCH 4/4] fix changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 615fb2baaae..25aca961f45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -240,7 +244,6 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf ### Bug Fixes * (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` and `MarshalYAML` panics when pubkey is set on a `BaseAccount`. -* (server) [#14441](https://github.com/cosmos/cosmos-sdk/pull/14441) Fix `--log_format` flag not working. * (rosetta) [#13583](https://github.com/cosmos/cosmos-sdk/pull/13583) Misc fixes for cosmos-rosetta. * (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Fix evidence query API to decode the hash properly. * (bank) [#13691](https://github.com/cosmos/cosmos-sdk/issues/13691) Fix unhandled error for vesting account transfers, when total vesting amount exceeds total balance.