@@ -872,7 +872,7 @@ protected override void OnDeleteMonitoredItemsComplete(ServerSystemContext conte
872872 }
873873 catch ( Exception e )
874874 {
875- Utils . Trace ( e , "Could not access external system." ) ;
875+ m_logger . LogError ( e , "Could not access external system." ) ;
876876 }
877877 }
878878 }
@@ -1093,13 +1093,13 @@ public override ServiceResult SubscribeToEvents(
10931093
10941094 if ( ServiceResult . IsBad ( request . Status . Error ) )
10951095 {
1096- Utils . Trace ( ( int ) Utils . TraceMasks . Error , "Could not create event item. {0}" , request . Status . Error . ToLongString ( ) ) ;
1096+ m_logger . LogError ( "Could not create event item. {0}" , request . Status . Error . ToLongString ( ) ) ;
10971097 }
10981098 }
10991099 }
11001100 catch ( Exception e )
11011101 {
1102- Utils . Trace ( e , "Could not access external system." ) ;
1102+ m_logger . LogError ( e , "Could not access external system." ) ;
11031103 }
11041104
11051105 return ServiceResult . Good ;
@@ -1262,7 +1262,7 @@ Opc.Ua.Client.ISession GetClientSession(ServerSystemContext context)
12621262
12631263 try
12641264 {
1265- Utils . Trace ( $ "Create Connect Session: { m_endpoint } for { sessionName } ") ;
1265+ m_logger . LogInformation ( $ "Create Connect Session: { m_endpoint } for { sessionName } ") ;
12661266 var session = Opc . Ua . Client . Session . CreateAsync (
12671267 m_configuration ,
12681268 m_reverseConnectManager ,
@@ -1299,7 +1299,7 @@ Opc.Ua.Client.ISession GetClientSession(ServerSystemContext context)
12991299 }
13001300 catch ( Exception e )
13011301 {
1302- Utils . Trace ( e , "Could not connect to server." ) ;
1302+ m_logger . LogError ( e , "Could not connect to server." ) ;
13031303
13041304 lock ( m_clientsLock )
13051305 {
@@ -1441,7 +1441,7 @@ private async void DoMetadataUpdateAsync(object state)
14411441 }
14421442 catch ( Exception e )
14431443 {
1444- Utils . Trace ( e , "Unexpected error updating event type cache." ) ;
1444+ m_logger . LogError ( e , "Unexpected error updating event type cache." ) ;
14451445 }
14461446 finally
14471447 {
@@ -1655,7 +1655,7 @@ private void Client_KeepAlive(Opc.Ua.Client.ISession session, Opc.Ua.Client.Keep
16551655 {
16561656 if ( e . Status != null && ServiceResult . IsNotGood ( e . Status ) )
16571657 {
1658- Utils . Trace ( "{0} {1}/{2}" , e . Status , session . OutstandingRequestCount , session . DefunctRequestCount ) ;
1658+ m_logger . LogDebug ( "{ 0} {1}/{2}" , e . Status , session . OutstandingRequestCount , session . DefunctRequestCount ) ;
16591659 var totalBadRequestCount = session . OutstandingRequestCount + session . DefunctRequestCount ;
16601660 Opc . Ua . Client . SessionReconnectHandler reconnectHandler ;
16611661 if ( totalBadRequestCount >= 3 &&
@@ -1666,15 +1666,15 @@ private void Client_KeepAlive(Opc.Ua.Client.ISession session, Opc.Ua.Client.Keep
16661666 AggregationClientSession clientSession = m_clients . Where ( c => c . Value ? . SessionSessionId == session . SessionId ) . FirstOrDefault ( ) . Value ;
16671667 if ( clientSession != null && clientSession . ReconnectHandler == null )
16681668 {
1669- Utils . Trace ( $ "--- RECONNECTING --- SessionId: { clientSession . ClientSessionId } ") ;
1669+ m_logger . LogInformation ( $ "--- RECONNECTING --- SessionId: { clientSession . ClientSessionId } ") ;
16701670 reconnectHandler = new Opc . Ua . Client . SessionReconnectHandler ( true ) ;
16711671 reconnectHandler . BeginReconnect ( session , m_reverseConnectManager , DefaultReconnectPeriod , Client_ReconnectComplete ) ;
16721672 clientSession . ReconnectHandler = reconnectHandler ;
16731673 e . CancelKeepAlive = true ;
16741674 }
16751675 else if ( clientSession == null )
16761676 {
1677- Utils . Trace ( $ "--- KEEP ALIVE for stale session --- SessionId: { session . SessionId } ") ;
1677+ m_logger . LogWarning ( $ "--- KEEP ALIVE for stale session --- SessionId: { session . SessionId } ") ;
16781678 }
16791679 }
16801680 }
@@ -1696,7 +1696,7 @@ private void Client_ReconnectComplete(object sender, EventArgs e)
16961696 AggregationClientSession clientSession = m_clients . Where ( c => Object . ReferenceEquals ( reconnectHandler , c . Value ? . ReconnectHandler ) ) . FirstOrDefault ( ) . Value ;
16971697 if ( clientSession == null )
16981698 {
1699- Utils . Trace ( $ "--- RECONNECTED --- SessionId: { clientSession . ClientSessionId } but client session was not found.") ;
1699+ m_logger . LogInformation ( $ "--- RECONNECTED --- SessionId: { clientSession . ClientSessionId } but client session was not found.") ;
17001700 return ;
17011701 }
17021702
@@ -1711,7 +1711,7 @@ private void Client_ReconnectComplete(object sender, EventArgs e)
17111711 Utils . SilentDispose ( oldSession ) ;
17121712 }
17131713 reconnectHandler . Dispose ( ) ;
1714- Utils . Trace ( $ "--- RECONNECTED --- SessionId: { clientSession . ClientSessionId } ") ;
1714+ m_logger . LogInformation ( $ "--- RECONNECTED --- SessionId: { clientSession . ClientSessionId } ") ;
17151715 }
17161716 }
17171717
0 commit comments