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