DatabaseLogger Class

Definition

A simple logger for logging SQL and other database operations to the console or a file. A logger can be registered in code or in the application's web.config /app.config file.

public class DatabaseLogger : IDisposable, System.Data.Entity.Infrastructure.Interception.IDbConfigurationInterceptor
type DatabaseLogger = class
    interface IDisposable
    interface IDbConfigurationInterceptor
    interface IDbInterceptor
Public Class DatabaseLogger
Implements IDbConfigurationInterceptor, IDisposable
Inheritance
DatabaseLogger
Implements

Constructors

DatabaseLogger()

Creates a new logger that will send log output to the console.

DatabaseLogger(String)

Creates a new logger that will send log output to a file. If the file already exists then it is overwritten.

DatabaseLogger(String, Boolean)

Creates a new logger that will send log output to a file.

Methods

Dispose()

Stops logging and closes the underlying file if output is being written to a file.

Dispose(Boolean)

Stops logging and closes the underlying file if output is being written to a file.

StartLogging()

Starts logging. This method is a no-op if logging is already started.

StopLogging()

Stops logging. This method is a no-op if logging is not started.

Explicit Interface Implementations

IDbConfigurationInterceptor.Loaded(DbConfigurationLoadedEventArgs, DbConfigurationInterceptionContext)

Called to start logging during Entity Framework initialization when this logger is registered. as an IDbInterceptor.

Applies to