Skip to content

Commit 3e46405

Browse files
committed
reduce log levels
1 parent 534b1c8 commit 3e46405

File tree

9 files changed

+28
-22
lines changed

9 files changed

+28
-22
lines changed

src/Renci.SshNet/BaseClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ protected virtual void Dispose(bool disposing)
445445

446446
if (disposing)
447447
{
448-
_logger.LogInformation("Disposing client.");
448+
_logger.LogDebug("Disposing client.");
449449

450450
Disconnect();
451451

src/Renci.SshNet/Channels/ChannelDirectTcpip.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private void ShutdownSocket(SocketShutdown how)
160160
}
161161
catch (SocketException ex)
162162
{
163-
_logger.LogWarning(ex, "Failure shutting down socket");
163+
_logger.LogInformation(ex, "Failure shutting down socket");
164164
}
165165
}
166166
}

src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private void ShutdownSocket(SocketShutdown how)
146146
}
147147
catch (SocketException ex)
148148
{
149-
_logger.LogWarning(ex, "Failure shutting down socket");
149+
_logger.LogInformation(ex, "Failure shutting down socket");
150150
}
151151
}
152152
}

src/Renci.SshNet/ForwardedPortDynamic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ private void InternalStop(TimeSpan timeout)
413413

414414
if (!_pendingChannelCountdown.Wait(timeout))
415415
{
416-
_logger.LogWarning("Timeout waiting for pending channels in dynamic forwarded port to close.");
416+
_logger.LogInformation("Timeout waiting for pending channels in dynamic forwarded port to close.");
417417
}
418418
}
419419

src/Renci.SshNet/ForwardedPortLocal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ private void InternalStop(TimeSpan timeout)
390390

391391
if (!_pendingChannelCountdown.Wait(timeout))
392392
{
393-
_logger.LogWarning("Timeout waiting for pending channels in local forwarded port to close.");
393+
_logger.LogInformation("Timeout waiting for pending channels in local forwarded port to close.");
394394
}
395395
}
396396

src/Renci.SshNet/ForwardedPortRemote.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ protected override void StopPort(TimeSpan timeout)
212212

213213
if (!_pendingChannelCountdown.Wait(timeout))
214214
{
215-
_logger.LogWarning("Timeout waiting for pending channels in remote forwarded port to close.");
215+
_logger.LogInformation("Timeout waiting for pending channels in remote forwarded port to close.");
216216
}
217217

218218
_status = ForwardedPortStatus.Stopped;

src/Renci.SshNet/Security/KeyExchange.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public Cipher CreateServerCipher(out bool isAead)
197197

198198
serverKey = GenerateSessionKey(SharedKey, ExchangeHash, serverKey, _serverCipherInfo.KeySize / 8);
199199

200-
_logger.LogInformation("[{SessionId}] Creating {ServerEncryption} server cipher.",
200+
_logger.LogDebug("[{SessionId}] Creating {ServerEncryption} server cipher.",
201201
Session.SessionIdHex,
202202
Session.ConnectionInfo.CurrentServerEncryption);
203203

@@ -225,7 +225,7 @@ public Cipher CreateClientCipher(out bool isAead)
225225

226226
clientKey = GenerateSessionKey(SharedKey, ExchangeHash, clientKey, _clientCipherInfo.KeySize / 8);
227227

228-
_logger.LogInformation("[{SessionId}] Creating {ClientEncryption} client cipher.",
228+
_logger.LogDebug("[{SessionId}] Creating {ClientEncryption} client cipher.",
229229
Session.SessionIdHex,
230230
Session.ConnectionInfo.CurrentClientEncryption);
231231

@@ -258,7 +258,7 @@ public HashAlgorithm CreateServerHash(out bool isEncryptThenMAC)
258258
Hash(GenerateSessionKey(SharedKey, ExchangeHash, 'F', sessionId)),
259259
_serverHashInfo.KeySize / 8);
260260

261-
_logger.LogInformation("[{SessionId}] Creating {ServerHmacAlgorithm} server hmac algorithm.",
261+
_logger.LogDebug("[{SessionId}] Creating {ServerHmacAlgorithm} server hmac algorithm.",
262262
Session.SessionIdHex,
263263
Session.ConnectionInfo.CurrentServerHmacAlgorithm);
264264

@@ -290,7 +290,7 @@ public HashAlgorithm CreateClientHash(out bool isEncryptThenMAC)
290290
Hash(GenerateSessionKey(SharedKey, ExchangeHash, 'E', sessionId)),
291291
_clientHashInfo.KeySize / 8);
292292

293-
_logger.LogInformation("[{SessionId}] Creating {ClientHmacAlgorithm} client hmac algorithm.",
293+
_logger.LogDebug("[{SessionId}] Creating {ClientHmacAlgorithm} client hmac algorithm.",
294294
Session.SessionIdHex,
295295
Session.ConnectionInfo.CurrentClientHmacAlgorithm);
296296

@@ -310,7 +310,7 @@ public Compressor CreateCompressor()
310310
return null;
311311
}
312312

313-
_logger.LogInformation("[{SessionId}] Creating {CompressionAlgorithm} client compressor.",
313+
_logger.LogDebug("[{SessionId}] Creating {CompressionAlgorithm} client compressor.",
314314
Session.SessionIdHex,
315315
Session.ConnectionInfo.CurrentClientCompressionAlgorithm);
316316

@@ -334,7 +334,7 @@ public Compressor CreateDecompressor()
334334
return null;
335335
}
336336

337-
_logger.LogInformation("[{SessionId}] Creating {ServerCompressionAlgorithm} server decompressor.",
337+
_logger.LogDebug("[{SessionId}] Creating {ServerCompressionAlgorithm} server decompressor.",
338338
Session.SessionIdHex,
339339
Session.ConnectionInfo.CurrentServerCompressionAlgorithm);
340340

src/Renci.SshNet/Session.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,10 @@ internal void SendMessage(Message message)
10471047
WaitOnHandle(_keyExchangeCompletedWaitHandle.WaitHandle);
10481048
}
10491049

1050-
_logger.LogInformation("[{SessionId}] Sending message '{MessageType}' to server: '{Message}'.", SessionIdHex, message.GetType().Name, message);
1050+
if (_logger.IsEnabled(LogLevel.Debug))
1051+
{
1052+
_logger.LogDebug("[{SessionId}] Sending message '{MessageType}' to server: '{Message}'.", SessionIdHex, message.GetType().Name, message);
1053+
}
10511054

10521055
var paddingMultiplier = _clientCipher is null ? (byte)8 : Math.Max((byte)8, _clientCipher.MinimumSize);
10531056
var packetData = message.GetPacket(paddingMultiplier, _clientCompression, _clientEtm || _clientAead);
@@ -1496,7 +1499,7 @@ internal void OnKeyExchangeInitReceived(KeyExchangeInitMessage message)
14961499
{
14971500
_isStrictKex = true;
14981501

1499-
_logger.LogInformation("[{SessionId}] Enabling strict key exchange extension.", SessionIdHex);
1502+
_logger.LogDebug("[{SessionId}] Enabling strict key exchange extension.", SessionIdHex);
15001503

15011504
if (_inboundPacketSequence != 1)
15021505
{
@@ -1512,7 +1515,7 @@ internal void OnKeyExchangeInitReceived(KeyExchangeInitMessage message)
15121515

15131516
ConnectionInfo.CurrentKeyExchangeAlgorithm = _keyExchange.Name;
15141517

1515-
_logger.LogInformation("[{SessionId}] Performing {KeyExchangeAlgorithm} key exchange.", SessionIdHex, ConnectionInfo.CurrentKeyExchangeAlgorithm);
1518+
_logger.LogDebug("[{SessionId}] Performing {KeyExchangeAlgorithm} key exchange.", SessionIdHex, ConnectionInfo.CurrentKeyExchangeAlgorithm);
15161519

15171520
_keyExchange.HostKeyReceived += KeyExchange_HostKeyReceived;
15181521

@@ -1828,7 +1831,10 @@ private Message LoadMessage(byte[] data, int offset, int count)
18281831
var message = _sshMessageFactory.Create(messageType);
18291832
message.Load(data, offset + 1, count - 1);
18301833

1831-
_logger.LogInformation("[{SessionId}] Received message '{MessageType}' from server: '{Message}'.", SessionIdHex, message.GetType().Name, message);
1834+
if (_logger.IsEnabled(LogLevel.Debug))
1835+
{
1836+
_logger.LogDebug("[{SessionId}] Received message '{MessageType}' from server: '{Message}'.", SessionIdHex, message.GetType().Name, message);
1837+
}
18321838

18331839
return message;
18341840
}
@@ -1968,7 +1974,7 @@ private void SocketDisconnectAndDispose()
19681974
{
19691975
try
19701976
{
1971-
_logger.LogInformation("[{SessionId}] Shutting down socket.", SessionIdHex);
1977+
_logger.LogDebug("[{SessionId}] Shutting down socket.", SessionIdHex);
19721978

19731979
// Interrupt any pending reads; should be done outside of socket read lock as we
19741980
// actually want shutdown the socket to make sure blocking reads are interrupted.
@@ -1980,13 +1986,13 @@ private void SocketDisconnectAndDispose()
19801986
}
19811987
catch (SocketException ex)
19821988
{
1983-
_logger.LogWarning(ex, "Failure shutting down socket");
1989+
_logger.LogInformation(ex, "Failure shutting down socket");
19841990
}
19851991
}
19861992

1987-
_logger.LogInformation("[{SessionId}] Disposing socket.", SessionIdHex);
1993+
_logger.LogDebug("[{SessionId}] Disposing socket.", SessionIdHex);
19881994
_socket.Dispose();
1989-
_logger.LogInformation("[{SessionId}] Disposed socket.", SessionIdHex);
1995+
_logger.LogDebug("[{SessionId}] Disposed socket.", SessionIdHex);
19901996
_socket = null;
19911997
}
19921998
}
@@ -2170,7 +2176,7 @@ protected virtual void Dispose(bool disposing)
21702176

21712177
if (disposing)
21722178
{
2173-
_logger.LogInformation("[{SessionId}] Disposing session.", SessionIdHex);
2179+
_logger.LogDebug("[{SessionId}] Disposing session.", SessionIdHex);
21742180

21752181
Disconnect();
21762182

test/Renci.SshNet.IntegrationTests/TestsFixtures/IntegrationTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static IntegrationTestBase()
6363
{
6464
ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
6565
{
66-
builder.SetMinimumLevel(LogLevel.Debug);
66+
builder.SetMinimumLevel(LogLevel.Information);
6767
builder.AddConsole();
6868
});
6969

0 commit comments

Comments
 (0)