NET Logging Library
LogXmlDocument Method (Log)
Example 



KellermanSoftware.NetLoggingLibrary Namespace > Log Class : LogXmlDocument Method
Log an XML Document
Syntax
Public Shared Function LogXmlDocument( _
   ByVal level As LoggingLevel, _
   ByVal document As XmlDocument _
) As LogResponse
Dim level As LoggingLevel
Dim document As XmlDocument
Dim value As LogResponse
 
value = Log.LogXmlDocument(level, document)
public static LogResponse LogXmlDocument( 
   LoggingLevel level,
   XmlDocument document
)
public:
static LogResponse^ LogXmlDocument( 
   LoggingLevel level,
   XmlDocument^ document
) 

Parameters

level
document
Example
//Licensed Mode
//Log.UserName = "User Name From Receipt";
//Log.LicenseKey = "LicenseKey From Receipt";            
 
//Clear all configuration
Log.ResetConfiguration();
 
//Add a new target, you can also define targets in an xml file, app.config, or web.config
FileTarget fileTarget = new FileTarget(Environment.CurrentDirectory + "\\fileLogger.txt");
Log.Config.Targets.Add(fileTarget);
 
string xmlString = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>
                    <catalog>
                      <cd country=""USA"">
                        <title>Empire Burlesque</title>
                        <artist>Bob Dylan</artist>
                        <price>10.90</price>
                      </cd>
                      <cd country=""UK"">
                        <title>Hide your heart</title>
                        <artist>Bonnie Tyler</artist>
                        <price>10.0</price>
                      </cd>
                      <cd country=""USA"">
                        <title>Greatest Hits</title>
                        <artist>Dolly Parton</artist>
                        <price>9.90</price>
                      </cd>
                    </catalog>";
 
XmlDocument document = new XmlDocument();
document.LoadXml(xmlString);
 
Log.LogXmlDocument(LoggingLevel.DEBUG, document);
Imports Microsoft.VisualBasic
 
'Licensed Mode
'Log.UserName = "User Name From Receipt";
'Log.LicenseKey = "LicenseKey From Receipt";            
 
'Clear all configuration
Log.ResetConfiguration()
 
'Add a new target, you can also define targets in an xml file, app.config, or web.config
Dim fileTarget As New FileTarget(Environment.CurrentDirectory & "\fileLogger.txt")
Log.Config.Targets.Add(fileTarget)
 
Dim xmlString As String = "<?xml version=""1.0"" encoding=""iso-8859-1""?>" & ControlChars.CrLf & "                    <catalog>" & ControlChars.CrLf & "                      <cd country=""USA"">" & ControlChars.CrLf & "                        <title>Empire Burlesque</title>" & ControlChars.CrLf & "                        <artist>Bob Dylan</artist>" & ControlChars.CrLf & "                        <price>10.90</price>" & ControlChars.CrLf & "                      </cd>" & ControlChars.CrLf & "                      <cd country=""UK"">" & ControlChars.CrLf & "                        <title>Hide your heart</title>" & ControlChars.CrLf & "                        <artist>Bonnie Tyler</artist>" & ControlChars.CrLf & "                        <price>10.0</price>" & ControlChars.CrLf & "                      </cd>" & ControlChars.CrLf & "                      <cd country=""USA"">" & ControlChars.CrLf & "                        <title>Greatest Hits</title>" & ControlChars.CrLf & "                        <artist>Dolly Parton</artist>" & ControlChars.CrLf & "                        <price>9.90</price>" & ControlChars.CrLf & "                      </cd>" & ControlChars.CrLf & "                    </catalog>"
 
Dim document As New XmlDocument()
document.LoadXml(xmlString)
 
Log.LogXmlDocument(LoggingLevel.DEBUG, document)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Log Class
Log Members