TFS_ANTIGUO/SIGPC/wcfSigdd/AyAEM/Exceptions/ExceptionXMLPublisher.cs

30 lines
697 B
C#
Raw Normal View History

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);
}
}
}
}
}