Skip to content

Commit 30aed32

Browse files
committed
Fix some error logging.
Signed-off-by: Bradley Grainger <[email protected]>
1 parent 56774e9 commit 30aed32

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/MySqlConnector/Core/ConnectionPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public async ValueTask<ServerSession> GetSessionAsync(MySqlConnection connection
129129
}
130130
catch (Exception unexpectedException)
131131
{
132-
Log.Error(unexpectedException, "Pool{0} unexpected error in GetSessionAsync: {1}", m_logArguments[0], unexpectedException.Message);
132+
Log.Warn(unexpectedException, "Pool{0} unexpected error in GetSessionAsync: {1}", m_logArguments[0], unexpectedException.Message);
133133
}
134134
}
135135

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,8 @@ private async Task InitSslAsync(ProtocolCapabilities serverCapabilities, Connect
12471247
catch (Exception ex)
12481248
{
12491249
Log.Error(ex, "Session{0} couldn't load CA certificate from CertificateFile '{1}'", m_logArguments);
1250+
if (!File.Exists(cs.CACertificateFile))
1251+
throw new MySqlException("Cannot find CA Certificate File: " + cs.CACertificateFile, ex);
12501252
throw new MySqlException("Could not load CA Certificate File: " + cs.CACertificateFile, ex);
12511253
}
12521254

@@ -1265,9 +1267,7 @@ private async Task InitSslAsync(ProtocolCapabilities serverCapabilities, Connect
12651267
catch (CryptographicException ex)
12661268
{
12671269
m_logArguments[1] = cs.CACertificateFile;
1268-
Log.Error(ex, "Session{0} couldn't load CA certificate from CertificateFile '{1}'", m_logArguments);
1269-
if (!File.Exists(cs.CACertificateFile))
1270-
throw new MySqlException("The CA Certificate File is invalid", ex);
1270+
Log.Warn(ex, "Session{0} couldn't load CA certificate from CertificateFile '{1}'", m_logArguments);
12711271
}
12721272
index = nextIndex;
12731273
}
@@ -1469,7 +1469,7 @@ X509CertificateCollection LoadCertificate(string sslKeyFile, string sslCertifica
14691469
Log.Error(ex, "Session{0} couldn't load client key from KeyFile '{1}'", m_logArguments);
14701470
if (!File.Exists(sslCertificateFile))
14711471
throw new MySqlException("Cannot find client certificate file: " + sslCertificateFile, ex);
1472-
throw new MySqlException("Could not load the client key from " + sslKeyFile, ex);
1472+
throw new MySqlException("Could not load the client key from " + sslCertificateFile, ex);
14731473
}
14741474
#else
14751475
m_clientCertificate = X509Certificate2.CreateFromPemFile(sslCertificateFile, sslKeyFile);
@@ -1559,7 +1559,7 @@ static void ReadRow(ReadOnlySpan<byte> span, out int? connectionId, out byte[]?
15591559
}
15601560
catch (MySqlException ex)
15611561
{
1562-
Log.Error(ex, "Session{0} failed to get CONNECTION_ID(), VERSION()", m_logArguments);
1562+
Log.Info(ex, "Session{0} failed to get CONNECTION_ID(), VERSION()", m_logArguments);
15631563
}
15641564
}
15651565

0 commit comments

Comments
 (0)