Make the debugging logs more JSON friendly
Thanks for providing excellent debug logging. We use structured JSON logs and so I'm trying to create a JSON record out of java.util.logging. At the logger level, I could use a format like "message" = "%5$s". Except, the message logged by the SDK is like
level="INFO" threadID=3 threadName="Finalizer" ldapSDKVersion="4.0.14" revision="c0fb784eebf9d36a67c736d0428fb3577f2e25bb" connectionPool="{unnamed}" currentAvailableConnections=0 maxAvailableConnections=4 message="Closed the connection pool"
The double quotes will break JSON processing. Could you please consider logging with a escaped " or preferably add a comma after the fields. Then I can just use %5$s. If we go this route, it will be great to do "level"="INFO", "threadID=3" etc.
BTW, JUL already gives me the level as INFO (and so don't need a additional level in the message). And JUL gives the source as "com.unboundid.util.Debug debugConnectionPool". Thanks much
I'm sorry for not having responded to this in a more timely manner. This is something that I think is a good idea, but one that I haven't been able to prioritize yet. I do think that if we provide this ability, then it will be necessary to explicitly enable JSON-formatted logs as I wouldn't want to break backward compatibility with anyone else who might be trying to parse the existing format.
I've committed a couple of changes to address this.
Since the debug log format wasn't previously intended to be parseable, I went ahead and just converted it to JSON. So if you enable debugging, it will now generate JSON output.
I also went ahead and updated the LDAP listener framework to add a JSON-formatted access log handler. The original access log handler, using a text-based format similar to the one used by other directory servers, is still there and they can be used separately or together. The in-memory directory server has also been updated to support JSON-formatted access logging.
Awesome, thanks as always @dirmgr !!
The 5.0.0 release of the LDAP SDK is now available and includes the JSON-formatted access and debug log support.