bosnet / sebak

SEBAK, the next BOScoin Blockchain
https://devteam.blockchainos.org
GNU General Public License v3.0
44 stars 15 forks source link

Use CallerFileHandler #884

Closed anarcher closed 5 years ago

anarcher commented 5 years ago

Github Issue

Background

Use CallerFileHandler with all log level.

t=2018-12-20T23:10:48+0900 lvl=info msg="Starting Sebak" module=main version= gitcommit= caller=run.go:611

Solution

I have no reason that only logging caller when debugging level is enabled.

For example


level=info ts=2018-12-18T15:00:00.785579852Z caller=compact.go:352 component=tsdb msg="compact blocks" count=3 mint=1545112800000 maxt=1545134400000 ulid=01CZ0X9C2S3P4WWEXA234KJ142 sources="[01CZ08P5P3QD6S4DW07JYD78YR 01CZ0FHWY4FFZ40S3N6QS6WHJP 01CZ0PDM64XZGCMAZFER7N18AK]"

There is a log example from Prometheus with logfmt and caller.

Possible Drawbacks

Geod24 commented 5 years ago

I suppose that the reason is because reading a stack trace is inherently slow, so we don't want to slow down Sebak in production.

anarcher commented 5 years ago

I suppose that the reason is because reading a stack trace is inherently slow, so we don't want to slow down Sebak in production.

Do you mean that now sebak in production is running info level? And it's CallerFileHandler, not CallerStackHandler. ( caller file handler has small cost than caller stack handler ) And Prometheus also is logging caller. It's a slow down in production?

As you know, info log level is quite small amount of logging then debugging level. I don't agree that performance things .

Geod24 commented 5 years ago

And it's CallerFileHandler, not CallerStackHandler

Oh sorry, I misread. This PR LGTM then.

And Prometheus also is logging caller. It's a slow down in production?

Yeah, stack traces are expensive to generate in any language.

spikeekips commented 5 years ago

@anarcher If there are no more issues, this PR can be merged :)