Skip to content

Commit

Permalink
Prevent file logging before configuration initialization (#7896)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubo authored Dec 11, 2024
1 parent 2b2d002 commit f29d19f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Nethermind/Nethermind.Logging.NLog/NLogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public class NLogManager : ILogManager, IDisposable
private const string DefaultFileTargetName = "file-async_wrapped";
private const string DefaultFolder = "logs";

/// <summary>
/// The constructor to use when the configuration is not yet initialized.
/// </summary>
public NLogManager() { /* Log in temp dir? */ }

public NLogManager(string logFileName, string logDirectory = null, string logRules = null)
{
Setup(logFileName, logDirectory, logRules);
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Runner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void ConfigureLogger(ParseResult parseResult)
return;
}

using NLogManager logManager = new("nethermind.log");
using NLogManager logManager = new();

logger = logManager.GetClassLogger();

Expand Down

0 comments on commit f29d19f

Please sign in to comment.