<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Some comments on SSLLogger also : <br>
</p>
<p>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 : <br>
<blockquote type="cite"> return
StackWalker.getInstance().walk(s -><br>
s.dropWhile((f ->
f.getClassName().startsWith("sun.security.ssl.SSLLogger")))<br>
.map(f -> f.getClassName() + ":" +
f.getLineNumber())<br>
.findFirst().orElse("unknown caller"));</blockquote>
</p>
<p>Looks like this method is not used : <br>
</p>
<p>
<blockquote type="cite">
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"> 406 private static boolean isLoggerImpl(StackTraceElement ste) {
407 String cn = ste.getClassName();
408 System.out.println("class name: " + cn);
409 return cn.equals("sun.security.ssl.SSLLogger");
410 }</pre>
</blockquote>
</p>
<p>Also the SSLSimpleFormatter class has dateFormat variable stored
in a ThreadLocal. Is there a reason for that ?</p>
<p>regards,<br>
Sean.<br>
</p>
<br>
<div class="moz-cite-prefix">On 08/06/2018 02:40, Xuelei Fan wrote:<br>
</div>
<blockquote type="cite"
cite="mid:e2905a22-a857-3fa5-ee8e-74a75de22312@oracle.com">I got
your ideas. Let's see if we can make a change, a little bit
later.
<br>
<br>
Thanks,
<br>
Xuelei
<br>
<br>
On 6/7/2018 6:23 PM, Weijun Wang wrote:
<br>
<blockquote type="cite">My final comment on this class:
<br>
<br>
Since SSLConsoleLogger is a Logger child, its log(..., params)
method should follow the Logger::log spec, which has
<br>
<br>
/**
<br>
* Logs a message with resource bundle and an optional
list of
<br>
* parameters.
<br>
* ...
<br>
* @param format the string message format in {@link
<br>
* java.text.MessageFormat} format, (or a key in the
message
<br>
* catalog if {@code bundle} is not {@code null}); can
be {@code null}.
<br>
* @param params an optional list of parameters to the
message (may be
<br>
* none).
<br>
* ...
<br>
*/
<br>
public void log(Level level, ResourceBundle bundle,
String format,
<br>
Object... params);
<br>
<br>
Especially, the String parameter is in MessageFormat format
(that's why it's named "format" but not "message"). However,
SSLConsoleLogger::log is always called with format being a plain
string and params are stacked in the output separated by command
and newline.
<br>
<br>
My opinion is that this is not the normal style of using a
Logger and we should not allow system logger (through
-Djavax.net.debug=). If you still see benefit in that, can we
make this change at the moment?
<br>
<br>
- logger.log(level, msg, formatted);
<br>
+ if (logger instanceof SSLConsoleLogger) {
<br>
+ logger.log(level, msg, formatted);
<br>
+ } else {
<br>
+ logger.log(level, msg + ": " +
formatted);
<br>
+ }
<br>
<br>
Thanks
<br>
Max
<br>
<br>
<blockquote type="cite">On Jun 7, 2018, at 11:24 AM, Weijun Wang
<a class="moz-txt-link-rfc2396E" href="mailto:weijun.wang@oracle.com"><weijun.wang@oracle.com></a> wrote:
<br>
<br>
I think I understand. So if a user sets it to empty, they will
also need to create a customized logger/formatter like
SSLLogger that is able to output a parameter without a
placeholder in msg.
<br>
<br>
--Max
<br>
<br>
<blockquote type="cite">On Jun 7, 2018, at 9:51 AM, Xuelei Fan
<a class="moz-txt-link-rfc2396E" href="mailto:xuelei.fan@oracle.com"><xuelei.fan@oracle.com></a> wrote:
<br>
<br>
In this implementation, the SunJSSE logging is updated to
(the class comment lines):
<br>
<br>
/**
<br>
* Implementation of SSL logger.
<br>
*
<br>
* If the system property "javax.net.debug" is not defined,
the debug logging
<br>
* is turned off. If the system property "javax.net.debug"
is defined as
<br>
* empty, the debug logger is specified by
System.getLogger("javax.net.ssl"),
<br>
* and applications can customize and configure the logger or
use external
<br>
* logging mechanisms. If the system property
"javax.net.debug" is defined
<br>
* and non-empty, a private debug logger implemented in this
class is used.
<br>
*/
<br>
<br>
On 6/6/2018 6:37 PM, Weijun Wang wrote:
<br>
<blockquote type="cite">But will any application use the
logger named "javax.net.debug"? I think that's only for
JSSE.
<br>
</blockquote>
If using System Logger, the "javax.net.debug" system
property will be used to turn on/off the logger (define with
empty or not defined).
<br>
<br>
Xuelei
<br>
<br>
<blockquote type="cite">
<blockquote type="cite">On Jun 7, 2018, at 9:35 AM, Xuelei
Fan<a class="moz-txt-link-rfc2396E" href="mailto:xuelei.fan@oracle.com"><xuelei.fan@oracle.com></a> wrote:
<br>
<br>
I see your concerns now. Currently, we don't fine the
format if using System logger. Applications can define
the format and output style for themselves if needed.
That's also the purpose why we introduce the System
Logger in the provider.
<br>
</blockquote>
</blockquote>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>