Shazwazza opened a new issue, #1226:
URL: https://github.com/apache/lucenenet/issues/1226

   ### Is there an existing issue for this?
   
   - [x] I have searched the existing issues
   
   ### Describe the bug
   
   ReplicationClient logs Lucene.Net.Replicator.SessionToken as a string and 
its ToString() overload results in a logging output that can't be used for 
debugging. For example, on this line:
   
   
https://github.com/apache/lucenenet/blob/36f587de8481a39a2695305c06728df2a3dedccc/src/Lucene.Net.Replicator/ReplicationClient.cs#L176
   
   ```cs
   WriteToInfoStream(string.Format("DoUpdate(): handlerVersion={0} 
session={1}", version, session));
   ```
   
   It will end up logging like:
   
   ```
   ReplicationThread - DoUpdate(): handlerVersion= session=id=1 version=2:1 
files=System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.IList`1[Lucene.Net.Replicator.RevisionFile]]
   ```
   
   Which is using the ToString() override in SessionToken, but this is just 
outputting the generic ToString() of a generic list instead of outputting what 
is in that list.
   
   ### Expected Behavior
   
   Ideally it would output all of this information:
   
   <img width="473" height="324" alt="Image" 
src="https://github.com/user-attachments/assets/05387c3e-ed6d-42ad-8a54-c86d0b830c2d";
 />
   
   However, this will incur some overhead, so then all places where a 
SessionToken is output as a string within the ReplicationClient would need to 
be put behind a check like 
   
   ```cs```
   if (infoStream.IsEnabled(INFO_STREAM_COMPONENT))
   ```
   
   Before the ToString() overload would be called. In fact, this should be done 
anyways since it is concatenating and allocating a ton of strings even if the 
above check was in place because the string allocations happen before the call 
to WriteToInfoStream which does this check.
   
   ### Steps To Reproduce
   
   _No response_
   
   ### Exceptions (if any)
   
   _No response_
   
   ### Lucene.NET Version
   
   4.8.latest
   
   ### .NET Version
   
   8
   
   ### Operating System
   
   windows
   
   ### Anything else?
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to