abseil-cpp icon indicating copy to clipboard operation
abseil-cpp copied to clipboard

[Bug]: kLogMessageBufferSize is not user-configurable

Open emezeske opened this issue 2 years ago • 3 comments

Describe the issue

kLogMessageBufferSize is set to an arbitrary value that may not work for all use cases

Steps to reproduce the problem

Log something longer than kLogMessageBufferSize with LOG(...) << ...

What version of Abseil are you using?

HEAD

What operating system and version are you using?

Doesn't matter (Windows)

What compiler and version are you using?

Doesn't matter (MSVC)

What build system are you using?

Doesn't matter (CMake)

Additional context

No response

emezeske avatar May 26 '23 00:05 emezeske

Can you please say more about the use case and motivation for this request? What do you think you would want to set this to if it was configurable? Would it be satisfactory if we instead offered a macro variant that breaks up longer operands and logs them as multiple pieces (at a higher runtime cost)? Why are the debug logs the right place for these large (>15kB) data, as opposed to (say) separate files or a lightweight database?

Adding one configuration knob for this would not be hard technically, but we want to be careful to create an overall configuration story for Abseil that is consistent and useful without being too fine-grained. We also want to test and (if appropriate) benchmark the configurations we do offer, which means each new one has an ongoing cost.

suertreus avatar Jun 01 '23 02:06 suertreus

Can you please say more about the use case and motivation for this request? What do you think you would want to set this to if it was configurable?

Just ran into a case where it was 10x easier to log a big thing than to break it up myself. In my case I might have set it to something like 50kB.

Would it be satisfactory if we instead offered a macro variant that breaks up longer operands and logs them as multiple pieces (at a higher runtime cost)?

Absolutely. This would be great.

Would it be satisfactory if we instead offered a macro variant that breaks up longer operands and logs them as multiple pieces (at a higher runtime cost)?

Simplicity, simplicity, simplicity. I needed to spit something out to the debug logs in a pinch to see it, and didn't particularly care that it was egregiously large. Why would I care, really? I know the costs. Much cheaper to barf out 50kB to the debug logs for a few minutes than to engineer a side-channel for the same data.

Adding one configuration knob for this would not be hard technically, but we want to be careful to create an overall configuration story for Abseil that is consistent and useful without being too fine-grained. We also want to test and (if appropriate) benchmark the configurations we do offer, which means each new one has an ongoing cost.

That's all totally fair. Your suggestion about having a breaking-up macro seems great, if it resolves concerns about configuration surface area.

emezeske avatar Jun 01 '23 03:06 emezeske

1460

mag122ed avatar Jun 01 '23 04:06 mag122ed