Review request 8153912: StackFrame::getFileName and StackFrame::getLineNumber not needed

Daniel Fuchs daniel.fuchs at oracle.com
Wed May 11 17:20:47 UTC 2016


Hi,

On 11/05/16 18:57, Ralph Goers wrote:
> But my point is that if obtaining the StackFrame and Class
> could be done so quickly that it wouldn’t add any noticeable
> overhead we could do that in every Logger.info, debug, etc. call.
> If we could just get the stack frame index so that we could obtain
> the StackFrame and Class later by using the index that would be even
> better since we would only be creating the StackFrame, etc if it is really required.

Working with stack frame indexes is at best fragile, unless
you make a snapshot of the stack first and only used the
index in relation to that snapshot. So I wouldn't recommend
going that way. Furthermore to obtain such an index you
would need to count the frames - which would mean walking the
whole stack.

I'm still not sure I understand why an appender would
call Logger.log. That sounds like a recipe for stack
overflow or endless ping pong loops.
I understand that could theoretically happen but then the
appender would need to protect itself against 'logging
while logging'. Or am I misunderstanding?

best regards,

-- daniel



More information about the core-libs-dev mailing list