java.io.Serializable
public class ExtLogRecord
extends java.util.logging.LogRecord
Modifier and Type | Class | Description |
---|---|---|
static class |
ExtLogRecord.FormatStyle |
The format style to use.
|
Constructor | Description |
---|---|
ExtLogRecord(java.util.logging.Level level,
java.lang.String msg,
java.lang.String loggerClassName) |
Construct a new instance.
|
ExtLogRecord(java.util.logging.Level level,
java.lang.String msg,
ExtLogRecord.FormatStyle formatStyle,
java.lang.String loggerClassName) |
Construct a new instance.
|
ExtLogRecord(ExtLogRecord original) |
Make a copy of a log record.
|
Modifier and Type | Method | Description |
---|---|---|
void |
copyAll() |
Copy all fields and prepare this object to be passed to another thread or to be serialized.
|
void |
copyMdc() |
Copy the MDC.
|
void |
disableCallerCalculation() |
Disable caller calculation for this record.
|
ExtLogRecord.FormatStyle |
getFormatStyle() |
Get the format style for the record.
|
java.lang.String |
getFormattedMessage() |
Get the fully formatted log record, with resources resolved and parameters applied.
|
java.lang.String |
getHostName() |
Get the host name of the record, if known.
|
java.lang.String |
getLoggerClassName() |
Get the class name of the logger which created this record.
|
java.lang.String |
getMdc(java.lang.String key) |
Get the value of an MDC property.
|
java.util.Map<java.lang.String,java.lang.String> |
getMdcCopy() |
Get a copy of all the MDC properties for this log record.
|
java.lang.String |
getNdc() |
Get the NDC for this log record.
|
long |
getProcessId() |
Get the process ID of the record, if known.
|
java.lang.String |
getProcessName() |
Get the process name of the record, if known.
|
java.lang.String |
getResourceKey() |
Get the resource key, if any.
|
java.lang.String |
getSourceClassName() |
|
java.lang.String |
getSourceFileName() |
Get the source file name for this log record.
|
int |
getSourceLineNumber() |
Get the source line number for this log record.
|
java.lang.String |
getSourceMethodName() |
|
java.lang.String |
getSourceModuleName() |
Get the name of the module that initiated the logging request, if known.
|
java.lang.String |
getSourceModuleVersion() |
Get the version of the module that initiated the logging request, if known.
|
java.lang.String |
getThreadName() |
Get the thread name of this logging event.
|
java.lang.String |
putMdc(java.lang.String key,
java.lang.String value) |
Change an MDC value on this record.
|
java.lang.String |
removeMdc(java.lang.String key) |
Remove an MDC value on this record.
|
void |
setHostName(java.lang.String hostName) |
Set the host name of the record.
|
void |
setMdc(java.util.Map<?,?> sourceMap) |
Create a new MDC using a copy of the source map.
|
void |
setMessage(java.lang.String message) |
Set the raw message.
|
void |
setMessage(java.lang.String message,
ExtLogRecord.FormatStyle formatStyle) |
Set the raw message.
|
void |
setNdc(java.lang.String value) |
Change the NDC for this log record.
|
void |
setParameters(java.lang.Object[] parameters) |
Set the parameters to the log message.
|
void |
setProcessId(long processId) |
Set the process ID of the record.
|
void |
setProcessName(java.lang.String processName) |
Set the process name of the record.
|
void |
setResourceBundle(java.util.ResourceBundle bundle) |
Set the localization resource bundle.
|
void |
setResourceBundleName(java.lang.String name) |
Set the localization resource bundle name.
|
void |
setSourceClassName(java.lang.String sourceClassName) |
|
void |
setSourceFileName(java.lang.String sourceFileName) |
Set the source file name for this log record.
|
void |
setSourceLineNumber(int sourceLineNumber) |
Set the source line number for this log record.
|
void |
setSourceMethodName(java.lang.String sourceMethodName) |
|
void |
setSourceModuleName(java.lang.String sourceModuleName) |
Set the source module name of this record.
|
void |
setSourceModuleVersion(java.lang.String sourceModuleVersion) |
Set the source module version of this record.
|
void |
setThreadName(java.lang.String threadName) |
Set the thread name of this logging event.
|
static ExtLogRecord |
wrap(java.util.logging.LogRecord rec) |
Wrap a JDK log record.
|
getInstant, getLevel, getLoggerName, getMessage, getMillis, getParameters, getResourceBundle, getResourceBundleName, getSequenceNumber, getThreadID, getThrown, setInstant, setLevel, setLoggerName, setMillis, setSequenceNumber, setThreadID, setThrown
public ExtLogRecord(java.util.logging.Level level, java.lang.String msg, java.lang.String loggerClassName)
level
- a logging level valuemsg
- the raw non-localized logging message (may be null)loggerClassName
- the name of the logger classpublic ExtLogRecord(java.util.logging.Level level, java.lang.String msg, ExtLogRecord.FormatStyle formatStyle, java.lang.String loggerClassName)
level
- a logging level valuemsg
- the raw non-localized logging message (may be null)formatStyle
- the parameter format style to useloggerClassName
- the name of the logger classpublic ExtLogRecord(ExtLogRecord original)
original
- the originalpublic static ExtLogRecord wrap(java.util.logging.LogRecord rec)
ExtLogRecord
, it is simply returned. Otherwise
a wrapper record is created and returned.rec
- the original recordpublic void disableCallerCalculation()
"unknown"
.public void copyAll()
public void copyMdc()
public java.lang.String getMdc(java.lang.String key)
key
- the property keypublic java.util.Map<java.lang.String,java.lang.String> getMdcCopy()
public java.lang.String putMdc(java.lang.String key, java.lang.String value)
key
- the key to setvalue
- the value to set it topublic java.lang.String removeMdc(java.lang.String key)
key
- the key to removepublic void setMdc(java.util.Map<?,?> sourceMap)
sourceMap
- the source man, must not be null
public java.lang.String getNdc()
public void setNdc(java.lang.String value)
value
- the new NDC valuepublic java.lang.String getLoggerClassName()
public ExtLogRecord.FormatStyle getFormatStyle()
public int getSourceLineNumber()
public void setSourceLineNumber(int sourceLineNumber)
sourceLineNumber
- the source line numberpublic java.lang.String getSourceFileName()
null
if no information could be obtained.public void setSourceFileName(java.lang.String sourceFileName)
sourceFileName
- the source file namepublic java.lang.String getSourceClassName()
getSourceClassName
in class java.util.logging.LogRecord
public void setSourceClassName(java.lang.String sourceClassName)
setSourceClassName
in class java.util.logging.LogRecord
public java.lang.String getSourceMethodName()
getSourceMethodName
in class java.util.logging.LogRecord
public void setSourceMethodName(java.lang.String sourceMethodName)
setSourceMethodName
in class java.util.logging.LogRecord
public java.lang.String getSourceModuleName()
public void setSourceModuleName(java.lang.String sourceModuleName)
sourceModuleName
- the source module namepublic java.lang.String getSourceModuleVersion()
public void setSourceModuleVersion(java.lang.String sourceModuleVersion)
sourceModuleVersion
- the source module versionpublic java.lang.String getFormattedMessage()
public java.lang.String getResourceKey()
null
.public java.lang.String getThreadName()
public void setThreadName(java.lang.String threadName)
threadName
- the thread namepublic java.lang.String getHostName()
public void setHostName(java.lang.String hostName)
hostName
- the host name of the recordpublic java.lang.String getProcessName()
public void setProcessName(java.lang.String processName)
processName
- the process name of the recordpublic long getProcessId()
public void setProcessId(long processId)
processId
- the process ID of the recordpublic void setMessage(java.lang.String message)
MessageFormat
-style.setMessage
in class java.util.logging.LogRecord
message
- the new raw messagepublic void setMessage(java.lang.String message, ExtLogRecord.FormatStyle formatStyle)
message
- the new raw messageformatStyle
- the format style to usepublic void setParameters(java.lang.Object[] parameters)
setParameters
in class java.util.logging.LogRecord
parameters
- the log message parameters. (may be null)public void setResourceBundle(java.util.ResourceBundle bundle)
setResourceBundle
in class java.util.logging.LogRecord
bundle
- localization bundle (may be null)public void setResourceBundleName(java.lang.String name)
setResourceBundleName
in class java.util.logging.LogRecord
name
- localization bundle name (may be null)Copyright © 2018. All rights reserved.