Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#78 output error when failing config is detected #80

Open
wants to merge 1 commit into
base: Issues/78-MT
Choose a base branch
from

Conversation

janmechtel
Copy link

#78 output error when failing config is detected

Log.Warning($"Config folder contains file {file}. Probably MSMDSRV.exe was unable to launch because of an invalid config. Deletion of the config files will skipped to allow inspection.");
}

if (Log.IsEnabled(LogEventLevel.Debug))
{
Log.Debug("Deleting file {Path}", file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is problematic since in the case of failedConfigFound == true the tool would be logging "Deleting file ..." even though nothing is getting deleted.

This line already detects whether the msmdsrv process exited unexpectedly:

image

I'd set the hasFailed marker there, and have the Dispose() honor that.

foreach (var file in Directory.EnumerateFiles(_tempPath, "*", SearchOption.AllDirectories))
if (file.ToLower().Contains("failed")) {
failedConfigFound = true;
Log.Warning($"Config folder contains file {file}. Probably MSMDSRV.exe was unable to launch because of an invalid config. Deletion of the config files will skipped to allow inspection.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serilog doesn't use string interpolation. Instead, it uses semantic logging where parameters are explicitly declared and provided using traditional params object[] syntax.
In this case it would be:

Log.Warning($"Config folder contains file {FailureFilePath}. Probably MSMDSRV.exe was unable to launch because of an invalid config. Deletion of the config files will skipped to allow inspection.", file);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants