Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to json logger in orchestrator and daemon #1831

Merged
merged 8 commits into from
May 21, 2020
Merged

Conversation

NicolasMahe
Copy link
Member

@NicolasMahe NicolasMahe commented May 20, 2020

Closes #1823

Switch to json logger in orchestrator, daemon and lcd:

{"_msg":"starting ABCI with Tendermint","level":"info","module":"main"}
{"_msg":"Executed block","height":510,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"4E9912FCD1486857359370FF09C2A1920F96130D2DF05FA314923200C8D8AB72","height":510,"level":"info","module":"state","txs":0}
{"_msg":"Executed block","height":511,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"B16E3C8548A8A461923B4D79614AEC3DCFD514DC7F72BDB9CE64D0B6EDC0ECCC","height":511,"level":"info","module":"state","txs":0}
{"_msg":"Executed block","height":512,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"C707D02D52580949FCCC3B7ABFF1123A85D5E5493B1A284F00D18AF75F729766","height":512,"level":"info","module":"state","txs":0}
starting lcd
starting orchestrator
{"_msg":"Executed block","height":513,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"EBE1EC3D2811772A4FE2C823CF167572729259A86757D53FFB0736299EECB0B2","height":513,"level":"info","module":"state","txs":0}
{"_msg":"Starting rpc client","level":"info"}
{"_msg":"Starting application REST service (chain-id: \"mesg-dev-chain\")...","level":"info","module":"rest-server"}
{"_msg":"Starting RPC HTTP server on [::]:1317","level":"info","module":"rest-server"}
{"_msg":"Starting orchestrator","level":"info"}
{"_msg":"Starting gRPC server","level":"info"}
{"_msg":"Server listens on [::]:50052","level":"info","module":"grpc"}
{"_msg":"Executed block","height":514,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"0DD2398BC0EC1AB37A7AF3EB9D9F5A51B2A3360311092C2359E69835AA875DCC","height":514,"level":"info","module":"state","txs":0}
{"_msg":"Executed block","height":515,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"58BA949DE2CCA3FA3107DE006BD22B98A223B019F1E169D953B644AF00C21410","height":515,"level":"info","module":"state","txs":0}
{"_msg":"Executed block","height":516,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"83A804A433427F1CB96161EBD08AEFDBC28CF71FAEA3B978C7ED4BF6B5977D50","height":516,"level":"info","module":"state","txs":0}
{"_msg":"Executed block","height":517,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"0B7353DD8FE4227B72559103FB5A378042645530DE1EDAFA25E1DA03F91F3849","height":517,"level":"info","module":"state","txs":0}
{"_msg":"Executed block","height":518,"invalidTxs":0,"level":"info","module":"state","validTxs":0}
{"_msg":"Committed state","appHash":"0854F12AE039E02C7C62AB1A7E8B983E755C360D6209BFFB1C2159E063A65176","height":518,"level":"info","module":"state","txs":0}
{"_msg":"executed process transition","eventHash":"6bzdDdAjGapQAicvXME5ynBSHWCQLKRXWShvqG9AH8yv","from":"n0","input":"{\"fields\":{\"msg\":{\"Kind\":{\"string_value\":\"foo_event\"}},\"timestamp\":{\"Kind\":{\"number_value\":1589974404}}}}","level":"info","module":"orchestrator","processHash":"6ff6S7LdzWL1dR6zXtdcqwmemjgFXvpjG4ca8pFuncEX","to":"n1","type":"event"}

I couldn't find a way to properly implement MarshalJSON function on protobuf struct without breaking the encoding somewhere else. So they are encoded in JSON-string (otherwise it's encoded in a CompactTextString that's even worst):

{
  "_msg": "executed process transition",
  "eventHash": "6bzdDdAjGapQAicvXME5ynBSHWCQLKRXWShvqG9AH8yv",
  "from": "n0",
  "input": "{\"fields\":{\"msg\":{\"Kind\":{\"string_value\":\"foo_event\"}},\"timestamp\":{\"Kind\":{\"number_value\":1589974404}}}}",
  "level": "info",
  "module": "orchestrator",
  "processHash": "6ff6S7LdzWL1dR6zXtdcqwmemjgFXvpjG4ca8pFuncEX",
  "to": "n1",
  "type": "event"
}

Use: version.ServerName,
Short: "Engine Daemon (server)",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if err := server.PersistentPreRunEFn(ctx)(cmd, args); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wraped the function server.PersistentPreRunEFn because it does some stuff using private function and it replaces the context.Logger inside the function (even if the logger is already initialized..)

@NicolasMahe NicolasMahe requested a review from antho1404 May 20, 2020 12:17
@NicolasMahe NicolasMahe self-assigned this May 20, 2020
@NicolasMahe NicolasMahe added the release:change Pull requests that change something existant label May 20, 2020
@NicolasMahe NicolasMahe added this to the next milestone May 20, 2020
@NicolasMahe NicolasMahe marked this pull request as ready for review May 20, 2020 12:17
Copy link
Member

@antho1404 antho1404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logs are not working daemon

cmd/mesg-daemon/main.go Outdated Show resolved Hide resolved
@NicolasMahe
Copy link
Member Author

NicolasMahe commented May 21, 2020

I merged #1832 and cleanup a little bit.
@antho1404 There are still some logs that are not in JSON but I think they can be just discarded by the JS log parser.
Example of log not in JSON:

starting lcd # this is from the dev-starter script. could be switch to JSON if needed.
starting orchestrator # same
...
stopping all child processes # same
ERROR: accept tcp [::]:1317: use of closed network connection # don't know where exactly is outputing this

@NicolasMahe NicolasMahe requested a review from antho1404 May 21, 2020 02:58
@antho1404 antho1404 merged commit f1945e7 into dev May 21, 2020
@antho1404 antho1404 deleted the feature/improve-logs branch May 21, 2020 03:05
@NicolasMahe NicolasMahe modified the milestones: next, v0.25.0 May 21, 2020
@NicolasMahe NicolasMahe mentioned this pull request May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:change Pull requests that change something existant
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON or standard logs
2 participants