SSLLogger.java (was Re: Code Review Request: TLS 1.3 Implementation)

Daniel Fuchs daniel.fuchs at oracle.com
Mon Jun 11 09:28:51 UTC 2018


Hi Xuelei,

Just a note that it might be a better idea to rework
the implementation of SSLLogger/SSLConsoleLogger a
bit in order to have SSLLogger implement System.Logger.
This would  ensure that the SSLLogger class is skipped
when looking for the caller, when the underlying logger
is a logger returned by System.getogger() and the backend
is java.util.logging. Otherwise the caller will appear
to be the static methods defined on the SSLLogger class
itself.

best regards,

-- daniel


On 10/06/2018 21:41, Xuelei Fan wrote:
> Update: http://hg.openjdk.java.net/jdk/sandbox/rev/e4fe7c97b1de
> 
> On 6/9/2018 2:42 AM, Seán Coffey wrote:
>> Some comments on SSLLogger also :
>>
>> formatCaller() uses getStackTrace() to walk the stack. It's probably 
>> more expensive than using the newer Stackwalker class. Could it be 
>> replaced with something like :
>>
>>>          return StackWalker.getInstance().walk(s ->
>>>                  s.dropWhile((f -> 
>>> f.getClassName().startsWith("sun.security.ssl.SSLLogger")))
>>>                          .map(f -> f.getClassName() + ":" + 
>>> f.getLineNumber())
>>>                          .findFirst().orElse("unknown caller"));
>>
> Good point!



More information about the security-dev mailing list