Skip to content

Commit e3df490

Browse files
committed
Minor logging changes.
1 parent ccfa5d1 commit e3df490

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/MySqlConnector/Core/ConnectionPool.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public static ConnectionPool GetPool(string connectionString)
391391
}
392392
else if (pool != newPool && Log.IsInfoEnabled())
393393
{
394-
Log.Info("Pool{0} was created but will not be used (due to race)", newPool.m_logArguments[0]);
394+
Log.Info("Pool{0} was created but will not be used (due to race)", newPool.m_logArguments);
395395
}
396396

397397
return pool;
@@ -440,7 +440,7 @@ private ConnectionPool(ConnectionSettings cs)
440440
Id = Interlocked.Increment(ref s_poolId);
441441
m_logArguments = new object[] { "{0}".FormatInvariant(Id) };
442442
if (Log.IsInfoEnabled())
443-
Log.Info("Pool{0} creating new connection pool for ConnectionString{1}", m_logArguments[0], cs.ConnectionStringBuilder.GetConnectionString(includePassword: false));
443+
Log.Info("Pool{0} creating new connection pool for ConnectionString: {1}", m_logArguments[0], cs.ConnectionStringBuilder.GetConnectionString(includePassword: false));
444444

445445
if (cs.ConnectionIdleTimeout > 0)
446446
{

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ public bool TryStartCancel(MySqlCommand command)
9090
m_state = State.CancelingQuery;
9191
}
9292

93-
Log.Info("Session{0} will cancel CommandId {1} (CancelledAttempts={2}) CommandText: {3}", m_logArguments[0], command.CommandId, command.CancelAttemptCount, command.CommandText);
93+
Log.Info("Session{0} will cancel CommandId: {1} (CancelledAttempts={2}) CommandText: {3}", m_logArguments[0], command.CommandId, command.CancelAttemptCount, command.CommandText);
9494
return true;
9595
}
9696

9797
public void DoCancel(MySqlCommand commandToCancel, MySqlCommand killCommand)
9898
{
99-
Log.Info("Session{0} canceling CommandId {1}: CommandText {2}", m_logArguments[0], commandToCancel.CommandId, commandToCancel.CommandText);
99+
Log.Info("Session{0} canceling CommandId {1}: CommandText: {2}", m_logArguments[0], commandToCancel.CommandId, commandToCancel.CommandText);
100100
lock (m_lock)
101101
{
102102
if (m_activeCommandId != commandToCancel.CommandId)
@@ -129,7 +129,7 @@ public void StartQuerying(MySqlCommand command)
129129
if (m_state == State.Querying || m_state == State.CancelingQuery)
130130
{
131131
m_logArguments[1] = m_state;
132-
Log.Error("Session{0} can't execute new command when in CommandState {1}: CommandText: {2}", m_logArguments[0], m_state, command.CommandText);
132+
Log.Error("Session{0} can't execute new command when in SessionState: {1}: CommandText: {2}", m_logArguments[0], m_state, command.CommandText);
133133
throw new InvalidOperationException("There is already an open DataReader associated with this Connection which must be closed first.");
134134
}
135135

@@ -143,7 +143,7 @@ public void StartQuerying(MySqlCommand command)
143143
public void FinishQuerying()
144144
{
145145
m_logArguments[1] = m_state;
146-
Log.Debug("Session{0} entering FinishQuerying; CommandState = {1}", m_logArguments);
146+
Log.Debug("Session{0} entering FinishQuerying; SessionState = {1}", m_logArguments);
147147
bool clearConnection = false;
148148
lock (m_lock)
149149
{
@@ -159,7 +159,7 @@ public void FinishQuerying()
159159
// KILL QUERY will kill a subsequent query if the command it was intended to cancel has already completed.
160160
// In order to handle this case, we issue a dummy query that will consume the pending cancellation.
161161
// See https://bugs.mysql.com/bug.php?id=45679
162-
Log.Info("Session{0} sending 'DO SLEEP(0)' command to clear pending cancellation", m_logArguments[0]);
162+
Log.Info("Session{0} sending 'DO SLEEP(0)' command to clear pending cancellation", m_logArguments);
163163
var payload = QueryPayload.Create("DO SLEEP(0);");
164164
SendAsync(payload, IOBehavior.Synchronous, CancellationToken.None).GetAwaiter().GetResult();
165165
payload = ReceiveReplyAsync(IOBehavior.Synchronous, CancellationToken.None).GetAwaiter().GetResult();
@@ -266,10 +266,10 @@ public async Task ConnectAsync(ConnectionSettings cs, ILoadBalancer loadBalancer
266266
else
267267
authPluginName = (initialHandshake.ProtocolCapabilities & ProtocolCapabilities.SecureConnection) == 0 ? "mysql_old_password" : "mysql_native_password";
268268
m_logArguments[1] = authPluginName;
269-
Log.Debug("Session{0} server sent auth_plugin_name '{1}'", m_logArguments);
269+
Log.Debug("Session{0} server sent AuthPluginName={1}", m_logArguments);
270270
if (authPluginName != "mysql_native_password" && authPluginName != "sha256_password" && authPluginName != "caching_sha2_password")
271271
{
272-
Log.Error("Session{0} unsupported authentication method auth_plugin_name'{1}'", m_logArguments);
272+
Log.Error("Session{0} unsupported authentication method AuthPluginName={1}", m_logArguments);
273273
throw new NotSupportedException("Authentication method '{0}' is not supported.".FormatInvariant(initialHandshake.AuthPluginName));
274274
}
275275

@@ -442,7 +442,7 @@ private async Task<PayloadData> SwitchAuthenticationAsync(ConnectionSettings cs,
442442
if (!m_isSecureConnection && cs.Password.Length > 1)
443443
{
444444
#if NET45
445-
Log.Error("Session{0} can't use AuthenticationMethod {1} without secure connection on .NET 4.5", m_logArguments);
445+
Log.Error("Session{0} can't use AuthenticationMethod '{1}' without secure connection on .NET 4.5", m_logArguments);
446446
throw new MySqlException("Authentication method '{0}' requires a secure connection (prior to .NET 4.6).".FormatInvariant(switchRequest.Name));
447447
#else
448448
var publicKey = await GetRsaPublicKeyAsync(switchRequest.Name, cs, ioBehavior, cancellationToken).ConfigureAwait(false);

0 commit comments

Comments
 (0)