Skip to content

Use CallerFileHandler#884

Merged
anarcher merged 1 commit intobosnet:masterfrom
anarcher:log-caller
Jan 7, 2019
Merged

Use CallerFileHandler#884
anarcher merged 1 commit intobosnet:masterfrom
anarcher:log-caller

Conversation

@anarcher
Copy link
Copy Markdown
Contributor

@anarcher anarcher commented Dec 20, 2018

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

@anarcher anarcher self-assigned this Dec 20, 2018
@anarcher anarcher modified the milestones: TBD, MainNet Dec 20, 2018
@Geod24
Copy link
Copy Markdown
Contributor

Geod24 commented Dec 20, 2018

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
Copy link
Copy Markdown
Contributor Author

anarcher commented Dec 20, 2018

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
Copy link
Copy Markdown
Contributor

Geod24 commented Dec 20, 2018

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
Copy link
Copy Markdown
Contributor

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

@anarcher anarcher merged commit 6180ea8 into bosnet:master Jan 7, 2019
@anarcher anarcher deleted the log-caller branch January 7, 2019 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants