EDB .NET Connector supports the use of logging to help resolve issues with the .NET Connector when used in your application. The connector uses classes in the EnterpriseDB.EDBClient.Logging namespace for logging.
Console logging to standard error
EnterpriseDB.EDBClient.Logging.ConsoleLoggingProvider is a class that outputs error messages to STDERR. To use this class, include the following line in your application before using any of the EDB Postgres Advanced Server .NET Connector APIs.
EnterpriseDB.EDBClient.Logging.EDBLogManager.Provider = new EnterpriseDB.EDBClient.Logging.ConsoleLoggingProvider(EDBLogLevel.Debug, true, true);
The following log levels are available:
Writing a custom logger
If the console logging provider doesn't meet your needs, you can write a custom logger by implementing the EnterpriseDB.EDBClient.Logging.IEDBLoggingProvider interface and extending the EnterpriseDB.EDBClient.Logging.EDBLogger class, for instance, writing your logs to a file. The following is a simple example of how to write a custom logger:
To use this custom logger, put the following line in your application before using any of the EDB .NET Connector APIs:
EDBLogManager.Provider = new MyLoggingProvider(filepath, EDBLogLevel.Debug, true, true);