Skip to content

Lucene.Net.Replicator.SessionToken ToString() overload doesn't output values correctly #1226

@Shazwazza

Description

@Shazwazza

Is there an existing issue for this?

  • 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:

WriteToInfoStream(string.Format("DoUpdate(): handlerVersion={0} session={1}", version, session));

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:

Image

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

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions