Class Logger
- java.lang.Object
-
- org.hsqldb.persist.Logger
-
public class Logger extends java.lang.ObjectThe public interface of persistence and logging classes.Implements a storage manager wrapper that provides a consistent, always available interface to storage management for the Database class, despite the fact not all Database objects actually use file storage.
- Since:
- 1.7.0
-
-
Field Summary
Fields Modifier and Type Field and Description SimpleLogappLogstatic java.lang.StringappLogFileExtensionstatic java.lang.StringbackupFileExtensionbooleancheckpointDisabledbooleancheckpointDuebooleancheckpointRequiredstatic java.lang.StringdataFileExtensionFileAccessfileAccessbooleanisNewDatabasebooleanisNewStoredFileAccessbooleanisSingleFilebooleanisStoredFileAccessstatic java.lang.StringlobsFileExtensionstatic java.lang.StringlockFileExtensionstatic java.lang.StringlogFileExtensionstatic java.lang.StringnewFileExtensionstatic java.lang.StringoldFileExtensionstatic java.lang.StringpropertiesFileExtensionstatic java.lang.StringscriptFileExtensionSimpleLogsqlLogstatic java.lang.StringsqlLogFileExtension
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidacquireLock(java.lang.String path)voidbackup(java.lang.String destPath, boolean script, boolean blocking, boolean compressed, boolean files)voidcheckpoint(boolean mode)Checkpoints the database.booleanclose(int closemode)Shuts down the logging process using the specified mode.voidcloseTextCache(Table table)Closes the TextCache object.DataFileCachegetCache()Returns the Cache object or null if one doesn't exist.intgetCacheRowsDefault()intgetCacheSize()CryptogetCrypto()intgetDataFileFactor()intgetDataFileScale()intgetDefragLimit()FileAccessgetFileAccess()intgetLobBlockSize()intgetLobFileScale()intgetLogSize()java.lang.String[]getPropertiesSQL(boolean indexRoots)java.lang.StringgetSecurePath(java.lang.String path, boolean allowFull, boolean includeRes)Returns a secure path or null for a user-defined path when hsqldb.allow_full_path is false.intgetSqlEventLogLevel()java.lang.StringgetTempDirectoryPath()java.lang.StringgetValueStringForProperty(java.lang.String name)intgetWriteDelay()booleanhasLockFile()booleanisAllowedFullPath()booleanisDataFileSpaces()booleanisFileDatabase()booleanisLogged()booleanisNewDatabase()booleanisNewStoredFileAccess()booleanisStoredFileAccess()voidlogDetailEvent(java.lang.String message)voidlogInfoEvent(java.lang.String message)voidlogSevereEvent(java.lang.String message, java.lang.Throwable t)voidlogStatementEvent(Session session, Statement statement, java.lang.Object[] paramValues, Result result, int level)voidlogWarningEvent(java.lang.String message, java.lang.Throwable t)booleanneedsCheckpointReset()IndexnewIndex(HsqlNameManager.HsqlName name, long id, TableBase table, int[] columns, boolean[] descending, boolean[] nullsLast, Type[] colTypes, boolean pk, boolean unique, boolean constraint, boolean forward)IndexnewIndex(Table table, Index index, int[] columns)PersistentStorenewStore(Session session, PersistentStoreCollection collection, TableBase table)voidopen()Opens the specified Database object's database files and starts up the logging process.DataFileCacheopenTextFilePersistence(Table table, java.lang.String source, boolean readOnlyData, boolean reversed)Opens the TextCache object.voidreleaseLock()voidsetCacheMaxRows(int value)voidsetCacheSize(int value)voidsetCheckpointRequired()voidsetDataFileScale(int value)voidsetDataFileScaleNoCheck(int value)voidsetDataFileSpaces(boolean value)voidsetDefagLimit(int value)voidsetDefaultTextTableProperties(java.lang.String source, HsqlProperties props)voidsetEventLogLevel(int level, boolean logSql)voidsetFilesCheck(int value)voidsetIncrementBackup(boolean val)voidsetLobFileCompressed(boolean value)voidsetLobFileCompressedNoCheck(boolean value)voidsetLobFileScale(int value)voidsetLobFileScaleNoCheck(int value)voidsetLogData(boolean mode)Sets logging on or off.voidsetLogSize(int megas)Sets the maximum size to which the log file can grow before being automatically checkpointed.voidsetNioDataFile(boolean value)voidsetNioMaxSize(int value)voidsetScriptType(int format)Sets the type of script file, currently 0 for text (default) 3 for compressedvoidsetWriteDelay(int delay)Sets the log write delay mode to number of seconds.voidsynchLog()voidwriteCommitStatement(Session session)Used at transaction commitvoidwriteDeleteStatement(Session session, Table t, java.lang.Object[] row)Used exclusively by PersistentStore objectsvoidwriteInsertStatement(Session session, Row row, Table table)Used exclusively by PersistentStore objectsvoidwriteOtherStatement(Session session, java.lang.String statement)Records a Log entry for the specified SQL statement, on behalf of the specified Session object.voidwriteSequenceStatement(Session session, NumberSequence s)Used at transaction commit
-
-
-
Field Detail
-
appLog
public SimpleLog appLog
-
sqlLog
public SimpleLog sqlLog
-
checkpointRequired
public boolean checkpointRequired
-
checkpointDue
public boolean checkpointDue
-
checkpointDisabled
public boolean checkpointDisabled
-
fileAccess
public FileAccess fileAccess
-
isStoredFileAccess
public boolean isStoredFileAccess
-
isNewStoredFileAccess
public boolean isNewStoredFileAccess
-
isNewDatabase
public boolean isNewDatabase
-
isSingleFile
public boolean isSingleFile
-
oldFileExtension
public static final java.lang.String oldFileExtension
- See Also:
- Constant Field Values
-
newFileExtension
public static final java.lang.String newFileExtension
- See Also:
- Constant Field Values
-
appLogFileExtension
public static final java.lang.String appLogFileExtension
- See Also:
- Constant Field Values
-
sqlLogFileExtension
public static final java.lang.String sqlLogFileExtension
- See Also:
- Constant Field Values
-
logFileExtension
public static final java.lang.String logFileExtension
- See Also:
- Constant Field Values
-
scriptFileExtension
public static final java.lang.String scriptFileExtension
- See Also:
- Constant Field Values
-
propertiesFileExtension
public static final java.lang.String propertiesFileExtension
- See Also:
- Constant Field Values
-
dataFileExtension
public static final java.lang.String dataFileExtension
- See Also:
- Constant Field Values
-
backupFileExtension
public static final java.lang.String backupFileExtension
- See Also:
- Constant Field Values
-
lobsFileExtension
public static final java.lang.String lobsFileExtension
- See Also:
- Constant Field Values
-
lockFileExtension
public static final java.lang.String lockFileExtension
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Logger
public Logger(Database database)
-
-
Method Detail
-
open
public void open()
Opens the specified Database object's database files and starts up the logging process.If the specified Database object is a new database, its database files are first created.
- Parameters:
db- the Database- Throws:
HsqlException- if there is a problem, such as the case when the specified files are in use by another process
-
close
public boolean close(int closemode)
Shuts down the logging process using the specified mode.- Parameters:
closemode- The mode in which to shut down the logging process- CLOSEMODE_IMMEDIATELY performs SHUTDOWN IMMEDIATELY, equivalent to a poweroff or crash.
- CLOSEMODE_NORMAL performs a normal SHUTDOWN that checkpoints the database normally.
- CLOSEMODE_COMPACT performs a shutdown compact that scripts out the contents of any CACHED tables to the log then deletes the existing *.data file that contains the data for all CACHED table before the normal checkpoint process which in turn creates a new, compact *.data file.
- CLOSEMODE_SCRIPT performs a SHUTDOWN SCRIPT.
- Returns:
- true if closed with no problems or false if a problem was encountered.
-
isLogged
public boolean isLogged()
-
isAllowedFullPath
public boolean isAllowedFullPath()
-
setEventLogLevel
public void setEventLogLevel(int level, boolean logSql)
-
logSevereEvent
public void logSevereEvent(java.lang.String message, java.lang.Throwable t)
-
logWarningEvent
public void logWarningEvent(java.lang.String message, java.lang.Throwable t)
-
logInfoEvent
public void logInfoEvent(java.lang.String message)
-
logDetailEvent
public void logDetailEvent(java.lang.String message)
-
logStatementEvent
public void logStatementEvent(Session session, Statement statement, java.lang.Object[] paramValues, Result result, int level)
-
getSqlEventLogLevel
public int getSqlEventLogLevel()
-
getCache
public DataFileCache getCache()
Returns the Cache object or null if one doesn't exist.
-
writeOtherStatement
public void writeOtherStatement(Session session, java.lang.String statement)
Records a Log entry for the specified SQL statement, on behalf of the specified Session object.
-
writeInsertStatement
public void writeInsertStatement(Session session, Row row, Table table)
Used exclusively by PersistentStore objects
-
writeDeleteStatement
public void writeDeleteStatement(Session session, Table t, java.lang.Object[] row)
Used exclusively by PersistentStore objects
-
writeSequenceStatement
public void writeSequenceStatement(Session session, NumberSequence s)
Used at transaction commit
-
writeCommitStatement
public void writeCommitStatement(Session session)
Used at transaction commit
-
synchLog
public void synchLog()
-
checkpoint
public void checkpoint(boolean mode)
Checkpoints the database.The most important effect of calling this method is to cause the log file to be rewritten in the most efficient form to reflect the current state of the database, i.e. only the DDL and insert DML required to recreate the database in its present state. Other house-keeping duties are performed w.r.t. other database files, in order to ensure as much as possible the ACID properites of the database.
- Throws:
HsqlException- if there is a problem checkpointing the database
-
setLogSize
public void setLogSize(int megas)
Sets the maximum size to which the log file can grow before being automatically checkpointed.- Parameters:
megas- size in MB
-
setLogData
public void setLogData(boolean mode)
Sets logging on or off.
-
setScriptType
public void setScriptType(int format)
Sets the type of script file, currently 0 for text (default) 3 for compressed- Parameters:
i- The type
-
setWriteDelay
public void setWriteDelay(int delay)
Sets the log write delay mode to number of seconds. By default executed commands written to the log are committed fully at most 0.5 second after they are executed. This improves performance for applications that execute a large number of short running statements in a short period of time, but risks failing to log some possibly large number of statements in the event of a crash. A small value improves recovery. A value of 0 will severly slow down logging when autocommit is on, or many short transactions are committed.- Parameters:
delay- in milliseconds
-
getCrypto
public Crypto getCrypto()
-
getWriteDelay
public int getWriteDelay()
-
getLogSize
public int getLogSize()
-
getLobBlockSize
public int getLobBlockSize()
-
setIncrementBackup
public void setIncrementBackup(boolean val)
-
setCacheMaxRows
public void setCacheMaxRows(int value)
-
getCacheRowsDefault
public int getCacheRowsDefault()
-
setCacheSize
public void setCacheSize(int value)
-
getCacheSize
public int getCacheSize()
-
setDataFileScale
public void setDataFileScale(int value)
-
setDataFileScaleNoCheck
public void setDataFileScaleNoCheck(int value)
-
getDataFileScale
public int getDataFileScale()
-
getDataFileFactor
public int getDataFileFactor()
-
setDataFileSpaces
public void setDataFileSpaces(boolean value)
-
isDataFileSpaces
public boolean isDataFileSpaces()
-
setFilesCheck
public void setFilesCheck(int value)
-
setLobFileScale
public void setLobFileScale(int value)
-
setLobFileScaleNoCheck
public void setLobFileScaleNoCheck(int value)
-
getLobFileScale
public int getLobFileScale()
-
setLobFileCompressed
public void setLobFileCompressed(boolean value)
-
setLobFileCompressedNoCheck
public void setLobFileCompressedNoCheck(boolean value)
-
setDefagLimit
public void setDefagLimit(int value)
-
getDefragLimit
public int getDefragLimit()
-
setDefaultTextTableProperties
public void setDefaultTextTableProperties(java.lang.String source, HsqlProperties props)
-
setNioDataFile
public void setNioDataFile(boolean value)
-
setNioMaxSize
public void setNioMaxSize(int value)
-
getFileAccess
public FileAccess getFileAccess()
-
isStoredFileAccess
public boolean isStoredFileAccess()
-
isNewStoredFileAccess
public boolean isNewStoredFileAccess()
-
isFileDatabase
public boolean isFileDatabase()
-
getTempDirectoryPath
public java.lang.String getTempDirectoryPath()
-
setCheckpointRequired
public void setCheckpointRequired()
-
needsCheckpointReset
public boolean needsCheckpointReset()
-
hasLockFile
public boolean hasLockFile()
-
acquireLock
public void acquireLock(java.lang.String path)
-
releaseLock
public void releaseLock()
-
newStore
public PersistentStore newStore(Session session, PersistentStoreCollection collection, TableBase table)
-
newIndex
public Index newIndex(HsqlNameManager.HsqlName name, long id, TableBase table, int[] columns, boolean[] descending, boolean[] nullsLast, Type[] colTypes, boolean pk, boolean unique, boolean constraint, boolean forward)
-
getValueStringForProperty
public java.lang.String getValueStringForProperty(java.lang.String name)
-
getPropertiesSQL
public java.lang.String[] getPropertiesSQL(boolean indexRoots)
-
backup
public void backup(java.lang.String destPath, boolean script, boolean blocking, boolean compressed, boolean files)
-
getSecurePath
public java.lang.String getSecurePath(java.lang.String path, boolean allowFull, boolean includeRes)Returns a secure path or null for a user-defined path when hsqldb.allow_full_path is false. Returns the path otherwise.
-
openTextFilePersistence
public DataFileCache openTextFilePersistence(Table table, java.lang.String source, boolean readOnlyData, boolean reversed)
Opens the TextCache object.
-
closeTextCache
public void closeTextCache(Table table)
Closes the TextCache object.
-
isNewDatabase
public boolean isNewDatabase()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG