VoltDB uses Log4J as an open source logging service to provide access to information about database events. In actuality, the library used is Reload4j, which is a drop-in replacement for Log4J that corrects known security vulnerabilities in the original library while maintaining all of the same package names. Consequently, the commands, examples, and following documentation continue to refer to the service itself as "Log4J".
By default, when using the VoltDB shell commands, the console display is limited to warnings, errors, and messages
concerning the status of the current process. A more complete listing of messages (of severity INFO and above) is written to
log files in the subfolder /log
, relative to the database root directory.
The advantages of using Log4J are:
Logging is compiled into the code and can be enabled and configured at run-time.
Log4J provides flexibility in configuring what events are logged, where, and the format of the output.
By using an open source logging service with standardized output, there are a number of different applications, such as Chainsaw, available for filtering and presenting the results.
Logging is important because it can help you understand the performance characteristics of your application, check for abnormal events, and ensure that the application is working as expected.
Of course, any additional processing and I/O will have an incremental impact on the overall database performance. To counteract any negative impact, Log4J gives you the ability to customize the logging to support only those events and servers you are interested in. In addition, when logging is not enabled, there is no impact to VoltDB performance. With VoltDB, you can even change the logging profile on the fly without having to shutdown or restart the database.
The following sections describe how to enable and customize logging of VoltDB using Log4J. This chapter is not intended as a tutorial or complete documentation of the Log4J logging service. For general
information about Log4J, see the Log4J web site at http://wiki.apache.org/logging-log4j/
.
Logging is the process of writing information about application events to a log file, console, or other destination. Log4J uses XML files to define the configuration of logging, including three key attributes:
Where events are logged. The destinations are referred to as appenders in Log4J (because events are appended to the destinations in sequential order).
What events are logged. VoltDB defines named classes of events (referred to as loggers) that can be enabled as well as the severity of the events to report.
How the logging messages are formatted (known as the layout),