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));
|
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||||
WriteRsltsEx(batch, writer);
|
WriteRsltsEx(batch, writer);
|
||||||
|
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
log.ErrorFormat("Error writing batch {0} by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -242,20 +242,24 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
|||||||
{
|
{
|
||||||
if (batch == null || batch.WaterMeters == null || batch.WaterMeters.Count <= 0) return;
|
if (batch == null || batch.WaterMeters == null || batch.WaterMeters.Count <= 0) return;
|
||||||
|
|
||||||
StreamWriter writer = StreamWriter.Null;
|
|
||||||
if (!string.IsNullOrEmpty(destination))
|
if (!string.IsNullOrEmpty(destination))
|
||||||
{
|
{
|
||||||
|
StreamWriter writer = StreamWriter.Null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
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
|
catch
|
||||||
{
|
{
|
||||||
|
log.ErrorFormat("Error writing batch {0} by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
writer.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteRsltsEx(batch, writer);
|
|
||||||
writer.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,15 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
|||||||
if (!opCompleted)
|
if (!opCompleted)
|
||||||
{
|
{
|
||||||
if (batch.WaterMeters.Count == 0) return Event.ResultsWritten;
|
if (batch.WaterMeters.Count == 0) return Event.ResultsWritten;
|
||||||
WriteLogsToDisk(logger, batch);
|
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;
|
opCompleted = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,20 +241,24 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
|
|||||||
|
|
||||||
void WriteRslts(Results.Entities.Batch batch, string destination)
|
void WriteRslts(Results.Entities.Batch batch, string destination)
|
||||||
{
|
{
|
||||||
StreamWriter writer = StreamWriter.Null;
|
|
||||||
if (!string.IsNullOrEmpty(destination))
|
if (!string.IsNullOrEmpty(destination))
|
||||||
{
|
{
|
||||||
|
StreamWriter writer = StreamWriter.Null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
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
|
catch
|
||||||
{
|
{
|
||||||
|
log.ErrorFormat("Error writing batch {0} by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
writer.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteRsltsEx(batch, writer);
|
|
||||||
writer.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -222,14 +222,20 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
|||||||
|
|
||||||
foreach (var wm in batch.WaterMeters)
|
foreach (var wm in batch.WaterMeters)
|
||||||
{
|
{
|
||||||
|
StreamWriter writer = StreamWriter.Null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StreamWriter writer = File.AppendText(GetFilename(destination, batch.EndTime, wm.WMPosition));
|
writer = File.AppendText(GetFilename(destination, batch.EndTime, wm.WMPosition));
|
||||||
WriteWM(writer, wm);
|
WriteWM(writer, wm);
|
||||||
writer.Close();
|
log.WarnFormat("Batch {0}/watermeter {1} written by {2} to file {3}", batch.BatchNr, wm.WMPosition, Name, destination);
|
||||||
}
|
}
|
||||||
catch
|
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 (string.IsNullOrEmpty(destination)) return;
|
||||||
if (batch.WaterMeters == null || batch.WaterMeters.Count == 0) return;
|
if (batch.WaterMeters == null || batch.WaterMeters.Count == 0) return;
|
||||||
|
|
||||||
|
StreamWriter writer = StreamWriter.Null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StreamWriter writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||||
WriteBatch(writer);
|
WriteBatch(writer);
|
||||||
writer.Close();
|
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
|
||||||
}
|
}
|
||||||
catch
|
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