Skip to content

Commit

Permalink
Minor improvements to InternalLogger output (#5012)
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot authored Aug 1, 2022
1 parent f332a63 commit 741d134
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private static bool TryPromoteType(ref object val, Type type1)
if (type1 == typeof(string))
{
val = Convert.ToString(val, CultureInfo.InvariantCulture);
InternalLogger.Debug("Using string comparison");
InternalLogger.Trace("Using string comparison");
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Conditions/Parsing/ConditionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private ConditionMethodExpression ParsePredicate(string functionName)
}
catch (Exception exception)
{
InternalLogger.Warn(exception, "Cannot resolve function '{0}'", functionName);
InternalLogger.Warn(exception, "Failed to resolve condition method: '{0}'", functionName);

if (exception.MustBeRethrownImmediately())
{
Expand Down
4 changes: 2 additions & 2 deletions src/NLog/Targets/FileTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ private void ArchiveFile(string fileName, string archiveFileName)
InternalLogger.Info("{0}: Archiving {1} to compressed {2}", this, fileName, archiveFileName);
if (File.Exists(archiveFileName))
{
InternalLogger.Warn("{0}: Cannot created new compressed file, when file already exists: {1}", this, archiveFileName);
InternalLogger.Warn("{0}: Failed archiving because compressed file already exists: {1}", this, archiveFileName);
}
else
{
Expand Down Expand Up @@ -1299,7 +1299,7 @@ private void ArchiveFileCompress(string fileName, string archiveFileName)
throw;

int sleepTimeMs = i * 50;
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);
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);
AsyncHelpers.WaitForDelay(TimeSpan.FromMilliseconds(sleepTimeMs));
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/NLog/Targets/NetworkTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,19 +359,19 @@ private void WriteBytesToNewNetworkSender(string address, byte[] bytes, AsyncLog
switch (OnConnectionOverflow)
{
case NetworkTargetConnectionsOverflowAction.Discard:
InternalLogger.Warn("{0}: Discarding message otherwise to many connections.", this);
InternalLogger.Debug("{0}: Discarding message, because too many open connections.", this);
logEvent.Continuation(null);
return;

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

case NetworkTargetConnectionsOverflowAction.Block:
while (_openNetworkSenders.Count >= MaxConnections)
{
InternalLogger.Debug("{0}: Blocking networktarget otherwise too many connections.", this);
InternalLogger.Debug("{0}: Blocking until ready, because too many open connections.", this);
Monitor.Wait(_openNetworkSenders);
InternalLogger.Trace("{0}: Entered critical section.", this);
}
Expand Down

0 comments on commit 741d134

Please sign in to comment.