NET Logging Library
SaveConfigurationToAppConfigOrWebConfig(String) Method
Example 



KellermanSoftware.NetLoggingLibrary Namespace > ConcreteLog Class > SaveConfigurationToAppConfigOrWebConfig Method : SaveConfigurationToAppConfigOrWebConfig(String) Method
Save the current configuration to the specified app.config or web.config file.
Syntax
Public Overloads Sub SaveConfigurationToAppConfigOrWebConfig( _
   ByVal filePath As String _
) 
Dim instance As ConcreteLog
Dim filePath As String
 
instance.SaveConfigurationToAppConfigOrWebConfig(filePath)
public void SaveConfigurationToAppConfigOrWebConfig( 
   string filePath
)
public:
void SaveConfigurationToAppConfigOrWebConfig( 
   String^ filePath
) 

Parameters

filePath
Example
ConcreteLog logger = new ConcreteLog();
 
//Licensed Mode
//logger.UserName = "User Name From Receipt";
//logger.LicenseKey = "LicenseKey From Receipt";            
 
//Clear all configuration
logger.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");
logger.Config.Targets.Add(fileTarget);
 
//Example saving to log.Config XML file
logger.SaveConfigurationToXmlFile();
 
//Example saving to app.config or web.config
logger.SaveConfigurationToAppConfigOrWebConfig("web.config");
 
//Load from logger.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 logger.Config and the App.Config, it will load from the logger.Config
logger.LoadConfiguration();
Dim logger As New ConcreteLog()
 
'Licensed Mode
'logger.UserName = "User Name From Receipt";
'logger.LicenseKey = "LicenseKey From Receipt";            
 
'Clear all configuration
logger.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")
logger.Config.Targets.Add(fileTarget)
 
'Example saving to log.Config XML file
logger.SaveConfigurationToXmlFile()
 
'Example saving to app.config or web.config
logger.SaveConfigurationToAppConfigOrWebConfig("web.config")
 
'Load from logger.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 logger.Config and the App.Config, it will load from the logger.Config
logger.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

ConcreteLog Class
ConcreteLog Members
Overload List