Database Reference
In-Depth Information
Database logging
In many organizations, there may be a security operations center, or network operations
center. In such environments, it is normal to consolidate logs of applications for use in a
syslog, http://en.wikipedia.org/wiki/Syslog , or for use in a security event manager, ht-
tp://en.wikipedia.org/wiki/Security_event_manager . It could be that the developer will not
be the person going through all the logs, but they have to be shared with other teams for
keeping a record of hacking attempts to the system, for system reporting, for maintenance
reporting, and more. Depending on clients' requirements, it may change from environment
to environment. For this reason, logging and the consolation of logging become a line item
and may be a section of the architecture documents, for the application's deployment in
production.
There are many logging frameworks in both C# and Java that are common. For NSer-
viceBus, there are the three logging frameworks that are supported out of the box:
Log4net : This is a .NET port of Java's Log4J, the most popular logging framework
in Java. It originated from the Apache Foundation; see http://logging.apache.org/
log4net/
NLog : This is a .NET logging framework; see http://nlog-project.org/
Serilog : This is another .NET logging framework; see http://serilog.net/ . This is
written to store in NoSQL document database
For Log4net examples, please see http://logging.apache.org/log4net/release/config-ex-
amples.html and for NServiceBus, please see http://docs.particular.net/NServiceBus/
logging-in-nservicebus .
We are going to use Log4net, and its AdoNetAppender to log in to SQL databases. The
following steps will be accomplished:
1. Install Log4Net through NuGet.
2. Create a Log table in the nservicebus SQL database.
3. Configure the app.config file.
4. Configure NSB for Log4Net.
We will need to install Log4Net. Here, we are using the Package Manager Console that is a
part of Visual Studio 2012. We are installing Log4Net Version 1.2.10 because this example
Search WWH ::




Custom Search