go-mssqldb icon indicating copy to clipboard operation
go-mssqldb copied to clipboard

Add connection logging to help with debugging

Open wrosenuance opened this issue 3 years ago • 3 comments

While debugging connection problems it can be helpful to look at the TDS traffic, ideally the unencrypted traffic if encryption is enabled. This patch adds a connection logger that emits the encrypted and unencrypted packets as a hex dump, and also supports the TLS_LOG_KEY_FILE needed for TLS interception in tools like Wireshark.

Split out of #547 where it was first used/relevant.

wrosenuance avatar Dec 16 '20 19:12 wrosenuance

Hi @kardianos, this is the second piece of #547 - a self-contained patch around adding in connection logging.

wrosenuance avatar Dec 16 '20 19:12 wrosenuance

Great to see it, but I want to wait until the first one is settled a bit more.

kardianos avatar Dec 16 '20 19:12 kardianos

Codecov Report

Merging #626 (768b5e3) into master (045585d) will decrease coverage by 0.05%. The diff coverage is 78.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #626      +/-   ##
==========================================
- Coverage   71.98%   71.92%   -0.06%     
==========================================
  Files          24       25       +1     
  Lines        5469     5529      +60     
==========================================
+ Hits         3937     3977      +40     
- Misses       1309     1322      +13     
- Partials      223      230       +7     
Impacted Files Coverage Δ
conn_str.go 99.18% <25.00%> (-0.82%) :arrow_down:
tds.go 66.54% <33.33%> (-1.06%) :arrow_down:
log_conn.go 100.00% <100.00%> (ø)
token.go 60.28% <0.00%> (-0.64%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 045585d...768b5e3. Read the comment docs.

codecov[bot] avatar Dec 18 '20 16:12 codecov[bot]