Package com.microstrategy.utils.log
Class FileHandler
- java.lang.Object
-
- com.microstrategy.utils.log.Handler
-
- com.microstrategy.utils.log.StreamHandler
-
- com.microstrategy.utils.log.FileHandler
-
- All Implemented Interfaces:
Configurable
- Direct Known Subclasses:
DatedFileHandler
,StatsHandler
public class FileHandler extends StreamHandler
- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
append
protected java.lang.String
baseFileName
protected boolean
fileInitialized
protected java.io.File
fileRef
protected java.lang.String
logFileName
protected int
logNumber
protected int
maxFileCount
protected int
maxFileSize
-
Constructor Summary
Constructors Constructor Description FileHandler()
FileHandler(java.lang.String baseFileName, int maxFileSize, int maxFileCount, boolean append)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(java.lang.String propPrefix)
Requests the configurable object to configure itself.protected void
createRealFileName(boolean isFirstTime)
protected java.lang.String
getFinalName(java.lang.String newBaseFileName)
java.lang.String
getLogFileName()
boolean
isFileInitialized()
Returns if file corresponding to current handler is initializedvoid
publish(LogRecord record)
protected void
setBaseFileName(java.lang.String baseFilename)
protected void
setLogFileName()
protected void
setNewLogFile(java.lang.String fileName)
protected void
setupFile()
protected void
writeToNextFile()
-
Methods inherited from class com.microstrategy.utils.log.StreamHandler
close, finalize, flush, getWriter, setEncoding, setOutputStream
-
Methods inherited from class com.microstrategy.utils.log.Handler
getEncoding, getEncodingSchemeSetting, getException, getFilter, getFilterSetting, getFormatter, getFormatterSetting, getLevel, getLevelSetting, getStringSettingWithDefaultValue, isLoggable, setException, setFilter, setFormatter, setLevel
-
-
-
-
Field Detail
-
logFileName
protected java.lang.String logFileName
-
fileRef
protected java.io.File fileRef
-
maxFileSize
protected int maxFileSize
-
maxFileCount
protected int maxFileCount
-
baseFileName
protected java.lang.String baseFileName
-
append
protected boolean append
-
logNumber
protected int logNumber
-
fileInitialized
protected boolean fileInitialized
-
-
Method Detail
-
configure
public void configure(java.lang.String propPrefix)
Description copied from interface:Configurable
Requests the configurable object to configure itself. The "partial properties key" is a parameter of this method. It allows different pluggable logger components to configure themselves without knowing their parent. For example let's assume we have in the logger.properties file a handler named "fileH". Then for the handler itself the prefix will be the "fileH". For the formatter of this handler the prefix will be "fileH.formatter". For the filter of this handler the prefix will be "fileH.filter". And so on. Here is the simplified handler creation workflow:- A handler is created based on the corresponding class property ("fileH.class" in our example).
- The handler's configure method is called with it's name as a prefix ("fileH" in our example).
- Inside this method the handler reads it's configuration properties and configures itself. Among other things it creates child components. For example it will read the "fileH.filter" property, which defines the filter class name and will create corresponding object.
- For each child component the handler will call it's configure method passing proper prefix. For example for the filter the prefix will be "fileH.filter".
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classHandler
- Parameters:
propPrefix
- String The partial properties key.
-
publish
public void publish(LogRecord record)
- Overrides:
publish
in classStreamHandler
-
setupFile
protected void setupFile()
- Since:
- MicroStrategy Web 8.1.1
-
isFileInitialized
public boolean isFileInitialized()
Returns if file corresponding to current handler is initialized
-
setLogFileName
protected void setLogFileName()
-
setNewLogFile
protected void setNewLogFile(java.lang.String fileName)
-
createRealFileName
protected void createRealFileName(boolean isFirstTime)
-
setBaseFileName
protected void setBaseFileName(java.lang.String baseFilename)
-
getLogFileName
public java.lang.String getLogFileName()
-
writeToNextFile
protected void writeToNextFile()
-
getFinalName
protected java.lang.String getFinalName(java.lang.String newBaseFileName)
- Since:
- MicroStrategy Web 7.5.1
-
-