More logging in all Output.FileWriters, ver. 2.18.992
This commit is contained in:
@@ -253,9 +253,11 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
{
|
||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||
WriteRsltsEx(batch, writer);
|
||||
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
catch
|
||||
{
|
||||
log.ErrorFormat("Error writing batch {0} by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -242,21 +242,25 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
{
|
||||
if (batch == null || batch.WaterMeters == null || batch.WaterMeters.Count <= 0) return;
|
||||
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
if (!string.IsNullOrEmpty(destination))
|
||||
{
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
try
|
||||
{
|
||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||
WriteRsltsEx(batch, writer);
|
||||
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
catch
|
||||
{
|
||||
log.ErrorFormat("Error writing batch {0} by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
}
|
||||
|
||||
WriteRsltsEx(batch, writer);
|
||||
finally
|
||||
{
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WriteRsltsEx(Results.Entities.Batch batch, StreamWriter wrtr)
|
||||
|
||||
@@ -173,7 +173,15 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
if (!opCompleted)
|
||||
{
|
||||
if (batch.WaterMeters.Count == 0) return Event.ResultsWritten;
|
||||
try
|
||||
{
|
||||
WriteLogsToDisk(logger, batch);
|
||||
log.WarnFormat("Batch {0} written by {1}", batch.BatchNr, Name);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
log.ErrorFormat("Error writing batch {0} by {1}", batch.BatchNr, Name);
|
||||
}
|
||||
|
||||
opCompleted = true;
|
||||
}
|
||||
|
||||
@@ -241,21 +241,25 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
|
||||
|
||||
void WriteRslts(Results.Entities.Batch batch, string destination)
|
||||
{
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
if (!string.IsNullOrEmpty(destination))
|
||||
{
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
try
|
||||
{
|
||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||
WriteRsltsEx(batch, writer);
|
||||
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
catch
|
||||
{
|
||||
log.ErrorFormat("Error writing batch {0} by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
}
|
||||
|
||||
WriteRsltsEx(batch, writer);
|
||||
finally
|
||||
{
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WriteRsltsEx(Results.Entities.Batch batch, StreamWriter wrtr)
|
||||
|
||||
@@ -222,14 +222,20 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
try
|
||||
{
|
||||
StreamWriter writer = File.AppendText(GetFilename(destination, batch.EndTime, wm.WMPosition));
|
||||
writer = File.AppendText(GetFilename(destination, batch.EndTime, wm.WMPosition));
|
||||
WriteWM(writer, wm);
|
||||
writer.Close();
|
||||
log.WarnFormat("Batch {0}/watermeter {1} written by {2} to file {3}", batch.BatchNr, wm.WMPosition, Name, destination);
|
||||
}
|
||||
catch
|
||||
{
|
||||
log.ErrorFormat("Error writing batch {0}/watermeter {1} by {2} to file {3}", batch.BatchNr, wm.WMPosition, Name, destination);
|
||||
}
|
||||
finally
|
||||
{
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,14 +227,20 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
|
||||
if (string.IsNullOrEmpty(destination)) return;
|
||||
if (batch.WaterMeters == null || batch.WaterMeters.Count == 0) return;
|
||||
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
try
|
||||
{
|
||||
StreamWriter writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||
WriteBatch(writer);
|
||||
writer.Close();
|
||||
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
catch
|
||||
{
|
||||
log.ErrorFormat("Error writing batch {0} by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||
}
|
||||
finally
|
||||
{
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user