Skip to content

Commit 741d134

Browse files
authored
Minor improvements to InternalLogger output (#5012)
1 parent f332a63 commit 741d134

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/NLog/Conditions/Expressions/ConditionRelationalExpression.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ private static bool TryPromoteType(ref object val, Type type1)
230230
if (type1 == typeof(string))
231231
{
232232
val = Convert.ToString(val, CultureInfo.InvariantCulture);
233-
InternalLogger.Debug("Using string comparison");
233+
InternalLogger.Trace("Using string comparison");
234234
return true;
235235
}
236236
}

src/NLog/Conditions/Parsing/ConditionParser.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private ConditionMethodExpression ParsePredicate(string functionName)
138138
}
139139
catch (Exception exception)
140140
{
141-
InternalLogger.Warn(exception, "Cannot resolve function '{0}'", functionName);
141+
InternalLogger.Warn(exception, "Failed to resolve condition method: '{0}'", functionName);
142142

143143
if (exception.MustBeRethrownImmediately())
144144
{

src/NLog/Targets/FileTarget.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ private void ArchiveFile(string fileName, string archiveFileName)
12421242
InternalLogger.Info("{0}: Archiving {1} to compressed {2}", this, fileName, archiveFileName);
12431243
if (File.Exists(archiveFileName))
12441244
{
1245-
InternalLogger.Warn("{0}: Cannot created new compressed file, when file already exists: {1}", this, archiveFileName);
1245+
InternalLogger.Warn("{0}: Failed archiving because compressed file already exists: {1}", this, archiveFileName);
12461246
}
12471247
else
12481248
{
@@ -1299,7 +1299,7 @@ private void ArchiveFileCompress(string fileName, string archiveFileName)
12991299
throw;
13001300

13011301
int sleepTimeMs = i * 50;
1302-
InternalLogger.Warn("{0}: Attempt #{1} to compress {2} to {3} failed - {4} {5}. Sleeping for {6}ms", this, i, fileName, archiveFileName, ex.GetType(), ex.Message, sleepTimeMs);
1302+
InternalLogger.Warn("{0}: Archiving Attempt #{1} to compress {2} to {3} failed - {4} {5}. Sleeping for {6}ms", this, i, fileName, archiveFileName, ex.GetType(), ex.Message, sleepTimeMs);
13031303
AsyncHelpers.WaitForDelay(TimeSpan.FromMilliseconds(sleepTimeMs));
13041304
}
13051305
}

src/NLog/Targets/NetworkTarget.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -359,19 +359,19 @@ private void WriteBytesToNewNetworkSender(string address, byte[] bytes, AsyncLog
359359
switch (OnConnectionOverflow)
360360
{
361361
case NetworkTargetConnectionsOverflowAction.Discard:
362-
InternalLogger.Warn("{0}: Discarding message otherwise to many connections.", this);
362+
InternalLogger.Debug("{0}: Discarding message, because too many open connections.", this);
363363
logEvent.Continuation(null);
364364
return;
365365

366366
case NetworkTargetConnectionsOverflowAction.Grow:
367367
MaxConnections = MaxConnections * 2;
368-
InternalLogger.Debug("{0}: Too may connections, but this is allowed", this);
368+
InternalLogger.Debug("{0}: Growing max connections limit, because many open connections.", this);
369369
break;
370370

371371
case NetworkTargetConnectionsOverflowAction.Block:
372372
while (_openNetworkSenders.Count >= MaxConnections)
373373
{
374-
InternalLogger.Debug("{0}: Blocking networktarget otherwise too many connections.", this);
374+
InternalLogger.Debug("{0}: Blocking until ready, because too many open connections.", this);
375375
Monitor.Wait(_openNetworkSenders);
376376
InternalLogger.Trace("{0}: Entered critical section.", this);
377377
}

0 commit comments

Comments
 (0)