Skip to content

Commit f346d00

Browse files
committed
Reduce severity of "intermediate" log statements.
When a session fails to ping the server when it's retrieved from the connection pool, it's ultimately logged as a warning. Reduce the severity (from Error) of log messages that are logged before that happens. This removes spurious errors (that are handled inside the library) from clients' log output.
1 parent f12d24e commit f346d00

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ public ValueTask<PayloadData> ReceiveReplyAsync(IOBehavior ioBehavior, Cancellat
562562
catch (Exception ex)
563563
{
564564
m_logArguments[1] = ex.Message;
565-
Log.Error(ex, "{0} failed in ReceiveReplyAsync: {1}", m_logArguments);
565+
Log.Info(ex, "{0} failed in ReceiveReplyAsync: {1}", m_logArguments);
566566
if ((ex as MySqlException)?.Number == (int) MySqlErrorCode.CommandTimeoutExpired)
567567
HandleTimeout();
568568
task = ValueTaskExtensions.FromException<ArraySegment<byte>>(ex);
@@ -593,7 +593,7 @@ public ValueTask<int> SendReplyAsync(PayloadData payload, IOBehavior ioBehavior,
593593
catch (Exception ex)
594594
{
595595
m_logArguments[1] = ex.Message;
596-
Log.Error(ex, "{0} failed in SendReplyAsync: {1}", m_logArguments);
596+
Log.Info(ex, "{0} failed in SendReplyAsync: {1}", m_logArguments);
597597
task = ValueTaskExtensions.FromException<int>(ex);
598598
}
599599

@@ -996,7 +996,6 @@ private int TryAsyncContinuation(Task<int> task)
996996
if (task.IsFaulted)
997997
{
998998
SetFailed();
999-
Log.Error(task.Exception.InnerException, "{0} failed in TryAsyncContinuation", m_logArguments);
1000999
task.GetAwaiter().GetResult();
10011000
}
10021001
return 0;
@@ -1005,10 +1004,7 @@ private int TryAsyncContinuation(Task<int> task)
10051004
private PayloadData TryAsyncContinuation(Task<ArraySegment<byte>> task)
10061005
{
10071006
if (task.IsFaulted)
1008-
{
10091007
SetFailed();
1010-
Log.Error(task.Exception.InnerException, "{0} failed in TryAsyncContinuation", m_logArguments);
1011-
}
10121008
ArraySegment<byte> bytes;
10131009
try
10141010
{
@@ -1027,7 +1023,7 @@ private PayloadData TryAsyncContinuation(Task<ArraySegment<byte>> task)
10271023

10281024
internal void SetFailed()
10291025
{
1030-
Log.Error("{0} setting state to Failed", m_logArguments);
1026+
Log.Info("{0} setting state to Failed", m_logArguments);
10311027
lock (m_lock)
10321028
m_state = State.Failed;
10331029
}

0 commit comments

Comments
 (0)