Skip to content

Commit 0ac0dd1

Browse files
committed
Reduce log verbosity.
Creators of ServerSession all log the reason for creating a session. Use "Session0.n" as the ID of non-pooled sessions.
1 parent d12ef77 commit 0ac0dd1

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ public ServerSession(ConnectionPool pool, int poolGeneration, int id)
3333
{
3434
m_lock = new object();
3535
m_payloadCache = new ArraySegmentHolder<byte>();
36-
Id = id.ToString();
37-
if (pool != null)
38-
Id = pool.Id + "." + Id;
36+
Id = (pool?.Id ?? 0) + "." + id;
3937
CreatedUtc = DateTime.UtcNow;
4038
Pool = pool;
4139
PoolGeneration = poolGeneration;
4240
HostName = "";
4341
m_logArguments = new object[] { "Session{0}".FormatInvariant(Id), null };
44-
Log.Info("{0} created new session", m_logArguments);
42+
Log.Debug("{0} created new session", m_logArguments);
4543
}
4644

4745
public string Id { get; }

src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ private async Task<ServerSession> CreateSessionAsync(IOBehavior ioBehavior, Canc
372372
RandomLoadBalancer.Instance : FailOverLoadBalancer.Instance;
373373

374374
var session = new ServerSession();
375+
Log.Info("Created new non-pooled Session{0}", session.Id);
375376
await session.ConnectAsync(m_connectionSettings, loadBalancer, ioBehavior, linkedSource.Token).ConfigureAwait(false);
376377
return session;
377378
}

0 commit comments

Comments
 (0)