TFS_ANTIGUO/SIGPC/wcfSigdd/AyAEM/Exceptions/ExceptionXMLPublisher.cs
kledezma 7fdadc4709 KLB
git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C519
2021-01-22 15:05:35 +00:00

29 lines
697 B
C#

using System.IO;
using System.Xml;
using System.Collections.Specialized;
namespace AyAEM.ExceptionManagement.Exceptions
{
public class ExceptionXMLPublisher : IExceptionXmlPublisher
{
void IExceptionXmlPublisher.Publish(XmlDocument ExceptionInfo, NameValueCollection ConfigSettings)
{
string filename;
if (ConfigSettings != null)
{
filename = ConfigSettings["fileName"];
}
else
{
filename = @"C:\ErrorLog.xml";
}
using ( FileStream fs = File.Open(filename, FileMode.Append,FileAccess.ReadWrite) )
{
using ( StreamWriter writer = new StreamWriter(fs) )
{
writer.Write(ExceptionInfo.OuterXml);
}
}
}
}
}