NET Logging Library
SaveConfigurationToXmlFile() Method
Example 



KellermanSoftware.NetLoggingLibrary Namespace > Log Class > SaveConfigurationToXmlFile Method : SaveConfigurationToXmlFile() Method
Save configuration to Log.Config file in the current directory
Syntax
Public Overloads Shared Sub SaveConfigurationToXmlFile() 
Log.SaveConfigurationToXmlFile()
public static void SaveConfigurationToXmlFile()
public:
static void SaveConfigurationToXmlFile(); 
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("fileLogger.txt");
Log.Config.Targets.Add(fileTarget);
 
//Example saving to Log.Config XML file
Log.SaveConfigurationToXmlFile();
 
//Example saving to app.config or web.config
Log.SaveConfigurationToAppConfigOrWebConfig();
 
//Load from Log.Config if it exists, else load from web.config or app.config, else create setup default targets based on ASP.NET or WinForms or WPF
//In this case, since we just saved to both the Log.Config and the App.Config, it will load from the Log.Config
Log.LoadConfiguration();
'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("fileLogger.txt")
Log.Config.Targets.Add(fileTarget)
 
'Example saving to Log.Config XML file
Log.SaveConfigurationToXmlFile()
 
'Example saving to app.config or web.config
Log.SaveConfigurationToAppConfigOrWebConfig()
 
'Load from Log.Config if it exists, else load from web.config or app.config, else create setup default targets based on ASP.NET or WinForms or WPF
'In this case, since we just saved to both the Log.Config and the App.Config, it will load from the Log.Config
Log.LoadConfiguration()
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
Overload List