@Service
@Singleton
@ContractsProvided(value={GFFileHandler.class,java.util.logging.Handler.class,LogEventBroadcaster.class,LoggingRuntime.class})
public class GFFileHandler
extends StreamHandler
implements org.glassfish.hk2.api.PostConstruct, org.glassfish.hk2.api.PreDestroy, LogEventBroadcaster, LoggingRuntime
| Modifier and Type | Field and Description |
|---|---|
static int |
DISABLE_LOG_FILE_ROTATION_VALUE |
protected ServerEnvironmentImpl |
env |
protected String |
logFileProperty |
protected static String |
LOGS_DIR |
static int |
MINIMUM_ROTATION_LIMIT_VALUE |
| Constructor and Description |
|---|
GFFileHandler() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addLogEventListener(LogEventListener listener) |
void |
cleanUpHistoryLogFiles()
cleanup the history log file based on attributes set under logging.properties file".
|
protected String |
evaluateFileName() |
File |
getCurrentLogFile()
A simple getter to access the current log file written by
this FileHandler.
|
protected File |
getLogFileName() |
void |
informLogEventListeners(LogEvent logEvent)
Broadcast the log event to registered listeners.
|
void |
log()
5005
Retrieves the LogRecord from our Queue and store them in the file
|
void |
postConstruct() |
void |
preDestroy() |
void |
publish(LogRecord record)
Publishes the logrecord storing it in our queue
|
boolean |
removeLogEventListener(LogEventListener listener) |
void |
rotate()
A Simple rotate method to close the old file and start the new one
when the limit is reached.
|
void |
setCompressionOnRotation(boolean compressionOnRotation) |
void |
setExcludeFields(String excludeFields) |
void |
setFileHandlerFormatter(String fileHandlerFormatter) |
void |
setFlushFrequency(int flushFrequency) |
void |
setLogFile(String fileName) |
void |
setLogStandardStreams(boolean logStandardStreams) |
void |
setLogToFile(boolean logToFile) |
void |
setMaxHistoryFiles(int maxHistoryFiles) |
void |
setMultiLineMode(boolean multiLineMode) |
void |
setRotationLimitAttrValue(Integer rotationLimitAttrValue) |
void |
setRotationOnDateChange(boolean rotationOnDateChange) |
void |
setRotationTimeLimitValue(Long rotationTimeLimitValue) |
close, flush, isLoggable, setEncoding, setOutputStreamgetEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevelpublic static final int DISABLE_LOG_FILE_ROTATION_VALUE
@Inject protected ServerEnvironmentImpl env
protected static final String LOGS_DIR
public static final int MINIMUM_ROTATION_LIMIT_VALUE
protected String logFileProperty
public void postConstruct()
postConstruct in interface org.glassfish.hk2.api.PostConstructprotected String evaluateFileName()
public void preDestroy()
preDestroy in interface org.glassfish.hk2.api.PreDestroypublic File getCurrentLogFile()
getCurrentLogFile in interface LoggingRuntimepublic void cleanUpHistoryLogFiles()
public void rotate()
public void log()
public void publish(LogRecord record)
publish in class StreamHandlerprotected File getLogFileName()
public boolean addLogEventListener(LogEventListener listener)
public boolean removeLogEventListener(LogEventListener listener)
public void informLogEventListeners(LogEvent logEvent)
LogEventBroadcasterinformLogEventListeners in interface LogEventBroadcasterpublic void setLogFile(String fileName)
public void setLogToFile(boolean logToFile)
public void setRotationOnDateChange(boolean rotationOnDateChange)
public void setMultiLineMode(boolean multiLineMode)
public void setFileHandlerFormatter(String fileHandlerFormatter)
public void setExcludeFields(String excludeFields)
public void setRotationLimitAttrValue(Integer rotationLimitAttrValue)
public void setRotationTimeLimitValue(Long rotationTimeLimitValue)
public void setMaxHistoryFiles(int maxHistoryFiles)
public void setFlushFrequency(int flushFrequency)
public void setCompressionOnRotation(boolean compressionOnRotation)
public void setLogStandardStreams(boolean logStandardStreams)
Copyright © 2019. All rights reserved.