@@ -28,15 +28,15 @@ public async ValueTask<ServerSession> GetSessionAsync(MySqlConnection connection
2828 // on the lock in RecoverLeakedSessions in high-concurrency situations
2929 if ( IsEmpty && unchecked ( ( ( uint ) Environment . TickCount ) - m_lastRecoveryTime ) >= 1000u )
3030 {
31- Log . Info ( "Pool{0} is empty; recovering leaked sessions" , m_logArguments ) ;
31+ Log . Debug ( "Pool{0} is empty; trying to recover any leaked sessions" , m_logArguments ) ;
3232 await RecoverLeakedSessionsAsync ( ioBehavior ) . ConfigureAwait ( false ) ;
3333 }
3434
3535 if ( ConnectionSettings . MinimumPoolSize > 0 )
3636 await CreateMinimumPooledSessions ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
3737
3838 // wait for an open slot (until the cancellationToken is cancelled, which is typically due to timeout)
39- Log . Debug ( "Pool{0} waiting for an available session" , m_logArguments ) ;
39+ Log . Trace ( "Pool{0} waiting for an available session" , m_logArguments ) ;
4040 if ( ioBehavior == IOBehavior . Asynchronous )
4141 await m_sessionSemaphore . WaitAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
4242 else
@@ -56,12 +56,12 @@ public async ValueTask<ServerSession> GetSessionAsync(MySqlConnection connection
5656 }
5757 if ( session is not null )
5858 {
59- Log . Debug ( "Pool{0} found an existing session; checking it for validity" , m_logArguments ) ;
59+ Log . Trace ( "Pool{0} found an existing session; checking it for validity" , m_logArguments ) ;
6060 bool reuseSession ;
6161
6262 if ( session . PoolGeneration != m_generation )
6363 {
64- Log . Debug ( "Pool{0} discarding session due to wrong generation" , m_logArguments ) ;
64+ Log . Trace ( "Pool{0} discarding session due to wrong generation" , m_logArguments ) ;
6565 reuseSession = false ;
6666 }
6767 else
@@ -83,7 +83,7 @@ public async ValueTask<ServerSession> GetSessionAsync(MySqlConnection connection
8383 if ( ! reuseSession )
8484 {
8585 // session is either old or cannot communicate with the server
86- Log . Warn ( "Pool{0} Session{1} is unusable; destroying it" , m_logArguments [ 0 ] , session . Id ) ;
86+ Log . Info ( "Pool{0} Session{1} is unusable; destroying it" , m_logArguments [ 0 ] , session . Id ) ;
8787 AdjustHostConnectionCount ( session , - 1 ) ;
8888 await session . DisposeAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
8989 }
@@ -97,8 +97,8 @@ public async ValueTask<ServerSession> GetSessionAsync(MySqlConnection connection
9797 m_leasedSessions . Add ( session . Id , session ) ;
9898 leasedSessionsCountPooled = m_leasedSessions . Count ;
9999 }
100- if ( Log . IsDebugEnabled ( ) )
101- Log . Debug ( "Pool{0} returning pooled Session{1} to caller; LeasedSessionsCount={2}" , m_logArguments [ 0 ] , session . Id , leasedSessionsCountPooled ) ;
100+ if ( Log . IsTraceEnabled ( ) )
101+ Log . Trace ( "Pool{0} returning pooled Session{1} to caller; LeasedSessionsCount={2}" , m_logArguments [ 0 ] , session . Id , leasedSessionsCountPooled ) ;
102102 return session ;
103103 }
104104 }
@@ -113,8 +113,8 @@ public async ValueTask<ServerSession> GetSessionAsync(MySqlConnection connection
113113 m_leasedSessions . Add ( session . Id , session ) ;
114114 leasedSessionsCountNew = m_leasedSessions . Count ;
115115 }
116- if ( Log . IsDebugEnabled ( ) )
117- Log . Debug ( "Pool{0} returning new Session{1} to caller; LeasedSessionsCount={2}" , m_logArguments [ 0 ] , session . Id , leasedSessionsCountNew ) ;
116+ if ( Log . IsTraceEnabled ( ) )
117+ Log . Trace ( "Pool{0} returning new Session{1} to caller; LeasedSessionsCount={2}" , m_logArguments [ 0 ] , session . Id , leasedSessionsCountNew ) ;
118118 return session ;
119119 }
120120 catch ( Exception ex )
@@ -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
@@ -164,8 +164,8 @@ public async ValueTask ReturnAsync(IOBehavior ioBehavior, ServerSession session)
164164 public async ValueTask < int > ReturnAsync ( IOBehavior ioBehavior , ServerSession session )
165165#endif
166166 {
167- if ( Log . IsDebugEnabled ( ) )
168- Log . Debug ( "Pool{0} receiving Session{1} back" , m_logArguments [ 0 ] , session . Id ) ;
167+ if ( Log . IsTraceEnabled ( ) )
168+ Log . Trace ( "Pool{0} receiving Session{1} back" , m_logArguments [ 0 ] , session . Id ) ;
169169
170170 try
171171 {
@@ -181,9 +181,9 @@ public async ValueTask<int> ReturnAsync(IOBehavior ioBehavior, ServerSession ses
181181 else
182182 {
183183 if ( sessionHealth == 1 )
184- Log . Warn ( "Pool{0} received invalid Session{1}; destroying it" , m_logArguments [ 0 ] , session . Id ) ;
184+ Log . Info ( "Pool{0} received invalid Session{1}; destroying it" , m_logArguments [ 0 ] , session . Id ) ;
185185 else
186- Log . Info ( "Pool{0} received expired Session{1}; destroying it" , m_logArguments [ 0 ] , session . Id ) ;
186+ Log . Debug ( "Pool{0} received expired Session{1}; destroying it" , m_logArguments [ 0 ] , session . Id ) ;
187187 AdjustHostConnectionCount ( session , - 1 ) ;
188188 await session . DisposeAsync ( ioBehavior , CancellationToken . None ) . ConfigureAwait ( false ) ;
189189 }
@@ -210,7 +210,7 @@ public async Task ClearAsync(IOBehavior ioBehavior, CancellationToken cancellati
210210
211211 public async Task ReapAsync ( IOBehavior ioBehavior , CancellationToken cancellationToken )
212212 {
213- Log . Debug ( "Pool{0} reaping connection pool" , m_logArguments ) ;
213+ Log . Trace ( "Pool{0} reaping connection pool" , m_logArguments ) ;
214214 await RecoverLeakedSessionsAsync ( ioBehavior ) . ConfigureAwait ( false ) ;
215215 await CleanPoolAsync ( ioBehavior , session => ( unchecked ( ( uint ) Environment . TickCount ) - session . LastReturnedTicks ) / 1000 >= ConnectionSettings . ConnectionIdleTimeout , true , cancellationToken ) . ConfigureAwait ( false ) ;
216216 }
@@ -250,7 +250,7 @@ private async Task RecoverLeakedSessionsAsync(IOBehavior ioBehavior)
250250 }
251251 }
252252 if ( recoveredSessions . Count == 0 )
253- Log . Debug ( "Pool{0} recovered no sessions" , m_logArguments ) ;
253+ Log . Trace ( "Pool{0} recovered no sessions" , m_logArguments ) ;
254254 else
255255 Log . Warn ( "Pool{0}: RecoveredSessionCount={1}" , m_logArguments [ 0 ] , recoveredSessions . Count ) ;
256256 foreach ( var session in recoveredSessions )
@@ -306,7 +306,7 @@ private async Task CleanPoolAsync(IOBehavior ioBehavior, Func<ServerSession, boo
306306 if ( shouldCleanFn ( session ) )
307307 {
308308 // session should be cleaned; dispose it and keep iterating
309- Log . Info ( "Pool{0} found Session{1} to clean up" , m_logArguments [ 0 ] , session . Id ) ;
309+ Log . Debug ( "Pool{0} found Session{1} to clean up" , m_logArguments [ 0 ] , session . Id ) ;
310310 await session . DisposeAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
311311 }
312312 else
@@ -371,40 +371,40 @@ private async Task CreateMinimumPooledSessions(IOBehavior ioBehavior, Cancellati
371371 private async ValueTask < ServerSession > ConnectSessionAsync ( string logMessage , int startTickCount , IOBehavior ioBehavior , CancellationToken cancellationToken )
372372 {
373373 var session = new ServerSession ( this , m_generation , Interlocked . Increment ( ref m_lastSessionId ) ) ;
374- if ( Log . IsInfoEnabled ( ) )
375- Log . Info ( logMessage , m_logArguments [ 0 ] , session . Id ) ;
374+ if ( Log . IsDebugEnabled ( ) )
375+ Log . Debug ( logMessage , m_logArguments [ 0 ] , session . Id ) ;
376376 var statusInfo = await session . ConnectAsync ( ConnectionSettings , startTickCount , m_loadBalancer , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
377377 Exception ? redirectionException = null ;
378378
379379 if ( statusInfo is not null && statusInfo . StartsWith ( "Location: mysql://" , StringComparison . Ordinal ) )
380380 {
381381 // server redirection string has the format "Location: mysql://{host}:{port}/user={userId}[&ttl={ttl}]"
382- Log . Info ( "Session{0} has server redirection header {1}" , session . Id , statusInfo ) ;
382+ Log . Trace ( "Session{0} has server redirection header {1}" , session . Id , statusInfo ) ;
383383
384384 if ( ConnectionSettings . ServerRedirectionMode == MySqlServerRedirectionMode . Disabled )
385385 {
386- Log . Info ( "Pool{0} server redirection is disabled; ignoring redirection" , m_logArguments ) ;
386+ Log . Trace ( "Pool{0} server redirection is disabled; ignoring redirection" , m_logArguments ) ;
387387 }
388388 else if ( Utility . TryParseRedirectionHeader ( statusInfo , out var host , out var port , out var user ) )
389389 {
390390 if ( host != ConnectionSettings . HostNames ! [ 0 ] || port != ConnectionSettings . Port || user != ConnectionSettings . UserID )
391391 {
392392 var redirectedSettings = ConnectionSettings . CloneWith ( host , port , user ) ;
393- Log . Info ( "Pool{0} opening new connection to Host={1}; Port={2}; User={3}" , m_logArguments [ 0 ] , host , port , user ) ;
393+ Log . Debug ( "Pool{0} opening new connection to Host={1}; Port={2}; User={3}" , m_logArguments [ 0 ] , host , port , user ) ;
394394 var redirectedSession = new ServerSession ( this , m_generation , Interlocked . Increment ( ref m_lastSessionId ) ) ;
395395 try
396396 {
397397 await redirectedSession . ConnectAsync ( redirectedSettings , startTickCount , m_loadBalancer , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
398398 }
399399 catch ( Exception ex )
400400 {
401- Log . Warn ( ex , "Pool{0} failed to connect redirected Session{1}" , m_logArguments [ 0 ] , redirectedSession . Id ) ;
401+ Log . Info ( ex , "Pool{0} failed to connect redirected Session{1}" , m_logArguments [ 0 ] , redirectedSession . Id ) ;
402402 redirectionException = ex ;
403403 }
404404
405405 if ( redirectionException is null )
406406 {
407- Log . Info ( "Pool{0} closing Session{1} to use redirected Session{2} instead" , m_logArguments [ 0 ] , session . Id , redirectedSession . Id ) ;
407+ Log . Trace ( "Pool{0} closing Session{1} to use redirected Session{2} instead" , m_logArguments [ 0 ] , session . Id , redirectedSession . Id ) ;
408408 await session . DisposeAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
409409 return redirectedSession ;
410410 }
@@ -421,7 +421,7 @@ private async ValueTask<ServerSession> ConnectSessionAsync(string logMessage, in
421421 }
422422 else
423423 {
424- Log . Info ( "Session{0} is already connected to this server; ignoring redirection" , session . Id ) ;
424+ Log . Trace ( "Session{0} is already connected to this server; ignoring redirection" , session . Id ) ;
425425 }
426426 }
427427 }
@@ -486,9 +486,9 @@ private async ValueTask<ServerSession> ConnectSessionAsync(string logMessage, in
486486 if ( connectionSettings . ConnectionReset )
487487 BackgroundConnectionResetHelper . Start ( ) ;
488488 }
489- else if ( pool != newPool && Log . IsInfoEnabled ( ) )
489+ else if ( pool != newPool && Log . IsDebugEnabled ( ) )
490490 {
491- Log . Info ( "Pool{0} was created but will not be used (due to race)" , newPool . m_logArguments ) ;
491+ Log . Debug ( "Pool{0} was created but will not be used (due to race)" , newPool . m_logArguments ) ;
492492 }
493493
494494 return pool ;
0 commit comments