Stabilize BizTalk inventory collection and diagnostics
Build und Test / build (push) Has been cancelled
Build und Test / build (push) Has been cancelled
This commit is contained in:
@@ -530,7 +530,13 @@ namespace BizTalkSapEnvironmentInventory.Collectors
|
||||
}
|
||||
|
||||
logger.Info("Exportiere BizTalk-Gruppenbindings read-only mit BTSTask.");
|
||||
logger.Detail("BTSTask-Pfad: " + btsTaskPath);
|
||||
logger.Detail("BTSTask-Timeout: "
|
||||
+ processTimeout.TotalSeconds.ToString(CultureInfo.InvariantCulture)
|
||||
+ " Sekunden.");
|
||||
var output = new StringBuilder();
|
||||
var outputSync = new object();
|
||||
var timer = Stopwatch.StartNew();
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = btsTaskPath,
|
||||
@@ -548,14 +554,24 @@ namespace BizTalkSapEnvironmentInventory.Collectors
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(args.Data))
|
||||
{
|
||||
output.AppendLine(args.Data);
|
||||
var safeLine = SensitiveDataSanitizer.SanitizeText(args.Data);
|
||||
lock (outputSync)
|
||||
{
|
||||
output.AppendLine(safeLine);
|
||||
}
|
||||
logger.Detail("BTSTask: " + safeLine);
|
||||
}
|
||||
};
|
||||
process.ErrorDataReceived += (sender, args) =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(args.Data))
|
||||
{
|
||||
output.AppendLine(args.Data);
|
||||
var safeLine = SensitiveDataSanitizer.SanitizeText(args.Data);
|
||||
lock (outputSync)
|
||||
{
|
||||
output.AppendLine(safeLine);
|
||||
}
|
||||
logger.Detail("BTSTask: " + safeLine);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -575,20 +591,32 @@ namespace BizTalkSapEnvironmentInventory.Collectors
|
||||
"BTSTask ExportBindings überschritt " + processTimeout.TotalSeconds + " Sekunden.");
|
||||
}
|
||||
process.WaitForExit();
|
||||
timer.Stop();
|
||||
if (process.ExitCode != 0)
|
||||
{
|
||||
string errorOutput;
|
||||
lock (outputSync)
|
||||
{
|
||||
errorOutput = output.ToString();
|
||||
}
|
||||
throw new InvalidOperationException(
|
||||
"BTSTask ExportBindings meldete Exitcode "
|
||||
+ process.ExitCode
|
||||
+ ": "
|
||||
+ LastLines(output.ToString(), 8));
|
||||
+ LastLines(errorOutput, 8));
|
||||
}
|
||||
logger.Info("BTSTask ExportBindings erfolgreich abgeschlossen ("
|
||||
+ timer.ElapsedMilliseconds + " ms).");
|
||||
}
|
||||
|
||||
if (!File.Exists(destination) || new FileInfo(destination).Length == 0)
|
||||
{
|
||||
throw new InvalidDataException("BTSTask erzeugte keine Binding-Datei.");
|
||||
}
|
||||
logger.Detail("Temporärer Binding-Export: "
|
||||
+ new FileInfo(destination).Length
|
||||
.ToString(CultureInfo.InvariantCulture)
|
||||
+ " Bytes.");
|
||||
}
|
||||
|
||||
private string ResolveBtsTaskPath()
|
||||
|
||||
Reference in New Issue
Block a user