SonarQube Server: Community Build v25.5.0.107428
No information available about configuration, not maintained by us.
public const String TRACE_FORMAT = "{1:yyyy-MM-dd HH:mm:ss.fff}Z - {2} ({3}) : {4} ({5}) - {6} - {7}";
private static String __TraceFormat = TRACE_FORMAT;
public static String TraceFormat
{
get => __TraceFormat;
set
{
if(String.IsNullOrWhiteSpace(value))
{
value = TRACE_FORMAT;
}
__TraceFormat = value;
}
}
private void WriteLine(Int32 depth,
TraceEventType traceEventType,
String message,
Int32 id)
{
try
{
MethodBase methodBase = null;
String fullName = null;
traceEventType.TestEnumValueThrowArgumentOutOfRangeException(nameof(traceEventType));
message = message ?? "NULL";
methodBase = new StackTrace().GetFrame(depth)
.GetMethod();
fullName = $"{methodBase.ReflectedType.FullName.Replace("+", ".")}.{methodBase.Name}";
_ = this.GetTraceSources(fullName)
.Where(ts => ts.Switch
.Level
.HasFlag((SourceLevels)traceEventType))
.ForEach(ts => ts.Listeners
.Cast<TraceListener>()
.ToList()
.ForEach(tl => tl.WriteLine(String.Format(__TraceFormat,
DateTime.Now,
DateTime.UtcNow,
ProcessName,
ProcessId,
traceEventType,
id,
fullName,
message,
tl.Name,
ts.Name))));
}
catch(Exception exception)
{
this.WriteException(exception);
}
}
It reports the value of __TraceFormat
in WriteLine
. Yes there is no 0
indexed value in the initial string. __TraceFormat
get initialized with TRACE_FORMAT
, which don’t contain a placeholder for index 0
. But the developer is able to change the __TraceFormat
by static property TraceFormat
and then can use the index 0
also.