Skip to content
laforge49 edited this page Oct 1, 2011 · 21 revisions

Transaction logs are important, no matter how robust a system. Transaction logs are recorded before an update request is processed. They can be used to build a database in the event of a failure, for a major software update, or when the size of the root block needs to be changed.

Logging is done by the TransactionComponentLog, which takes two parameters:

  1. logDirPathname - This is the pathname of the directory where log files are to be written. (A new log file is created each time the program is run.)
  2. flushLog - Optional, and when set to "true", the log file is flushed to disk after each transaction request is written. This parameter needs to be set to ensure that all the completed transactions can be recovered.

##LoggingTest

val systemServices = SystemServices(new ServicesRootComponentFactory)
val dbName = "smallLogging.db"
val logDirPathname = "smallLogging"
val file = new java.io.File(dbName)
file.delete
EmptyLogDirectory(logDirPathname)
val properties = new Properties
properties.put("dbPathname", dbName)
properties.put("logDirPathname", logDirPathname)
properties.put("flushLog", "true")
val db = Subsystem(
  systemServices,
  new SmallComponentFactory,
  properties = properties,
  actorId = ActorId("db"))
val results = new Results
val chain = new Chain(results)
chain.op(systemServices, Register(db))
chain.op(db, SetRequest(db, "/$", IncDesInt(null)))
Future(systemServices, chain)
systemServices.close

LoggingTest


tutorial

Clone this wiki locally