NET Logging Library
LogException(Exception) Method
Example 



KellermanSoftware.NetLoggingLibrary Namespace > Log Class > LogException Method : LogException(Exception) Method
Log an exception
Syntax
Public Overloads Shared Function LogException( _
   ByVal ex As Exception _
) As LogResponse
Dim ex As Exception
Dim value As LogResponse
 
value = Log.LogException(ex)
public static LogResponse LogException( 
   Exception ex
)
public:
static LogResponse^ LogException( 
   Exception^ ex
) 

Parameters

ex
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 message = "This is a test";
NotSupportedException exception = new NotSupportedException(message);
Log.LogException(exception);
'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 message As String = "This is a test"
Dim exception As New NotSupportedException(message)
Log.LogException(exception)
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