java.lang.Objectjava.util.logging.LogRecord
public class LogRecord
LogRecord objects are used to pass logging requests between the logging framework and individual log Handlers.
When a LogRecord is passed into the logging framework it logically belongs to the framework and should no longer be used or updated by the client application.
Note that if the client application has not specified an explicit source method name and source class name, then the LogRecord class will infer them automatically when they are first accessed (due to a call on getSourceMethodName or getSourceClassName) by analyzing the call stack. Therefore, if a logging Handler wants to pass off a LogRecord to another thread, or to transmit it over RMI, and if it wishes to subsequently obtain method name or class name information it should call one of getSourceClassName or getSourceMethodName to force the values to be filled in.
Serialization notes:
| Constructor Summary | |
|---|---|
LogRecord(Level level,
String msg)
Construct a LogRecord with the given level and message values. |
|
| Method Summary | |
|---|---|
Level |
getLevel()
Get the logging message level, for example Level.SEVERE. |
String |
getLoggerName()
Get the source Logger name's |
String |
getMessage()
Get the "raw" log message, before localization or formatting. |
long |
getMillis()
Get event time in milliseconds since 1970. |
Object[] |
getParameters()
Get the parameters to the log message. |
ResourceBundle |
getResourceBundle()
Get the localization resource bundle |
String |
getResourceBundleName()
Get the localization resource bundle name |
long |
getSequenceNumber()
Get the sequence number. |
String |
getSourceClassName()
Get the name of the class that (allegedly) issued the logging request. |
String |
getSourceMethodName()
Get the name of the method that (allegedly) issued the logging request. |
int |
getThreadID()
Get an identifier for the thread where the message originated. |
Throwable |
getThrown()
Get any throwable associated with the log record. |
void |
setLevel(Level level)
Set the logging message level, for example Level.SEVERE. |
void |
setLoggerName(String name)
Set the source Logger name. |
void |
setMessage(String message)
Set the "raw" log message, before localization or formatting. |
void |
setMillis(long millis)
Set event time. |
void |
setParameters(Object[] parameters)
Set the parameters to the log message. |
void |
setResourceBundle(ResourceBundle bundle)
Set the localization resource bundle. |
void |
setResourceBundleName(String name)
Set the localization resource bundle name. |
void |
setSequenceNumber(long seq)
Set the sequence number. |
void |
setSourceClassName(String sourceClassName)
Set the name of the class that (allegedly) issued the logging request. |
void |
setSourceMethodName(String sourceMethodName)
Set the name of the method that (allegedly) issued the logging request. |
void |
setThreadID(int threadID)
Set an identifier for the thread where the message originated. |
void |
setThrown(Throwable thrown)
Set a throwable associated with the log event. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LogRecord(Level level, String msg)
The sequence property will be initialized with a new unique value. These sequence values are allocated in increasing order within a VM.
The millis property will be initialized to the current time.
The thread ID property will be initialized with a unique ID for the current thread.
All other properties will be initialized to "null".
level - a logging level valuemsg - the raw non-localized logging message (may be null)| Method Detail |
|---|
public String getLoggerName()
public void setLoggerName(String name)
name - the source logger name (may be null)public ResourceBundle getResourceBundle()
This is the ResourceBundle that should be used to localize the message string before formatting it. The result may be null if the message is not localizable, or if no suitable ResourceBundle is available.
public void setResourceBundle(ResourceBundle bundle)
bundle - localization bundle (may be null)public String getResourceBundleName()
This is the name for the ResourceBundle that should be used to localize the message string before formatting it. The result may be null if the message is not localizable.
public void setResourceBundleName(String name)
name - localization bundle name (may be null)public Level getLevel()
public void setLevel(Level level)
level - the logging message levelpublic long getSequenceNumber()
Sequence numbers are normally assigned in the LogRecord constructor, which assigns unique sequence numbers to each new LogRecord in increasing order.
public void setSequenceNumber(long seq)
Sequence numbers are normally assigned in the LogRecord constructor, so it should not normally be necessary to use this method.
public String getSourceClassName()
Note that this sourceClassName is not verified and may be spoofed. This information may either have been provided as part of the logging call, or it may have been inferred automatically by the logging framework. In the latter case, the information may only be approximate and may in fact describe an earlier call on the stack frame.
May be null if no information could be obtained.
public void setSourceClassName(String sourceClassName)
sourceClassName - the source class name (may be null)public String getSourceMethodName()
Note that this sourceMethodName is not verified and may be spoofed. This information may either have been provided as part of the logging call, or it may have been inferred automatically by the logging framework. In the latter case, the information may only be approximate and may in fact describe an earlier call on the stack frame.
May be null if no information could be obtained.
public void setSourceMethodName(String sourceMethodName)
sourceMethodName - the source method name (may be null)public String getMessage()
May be null, which is equivalent to the empty string "".
This message may be either the final text or a localization key.
During formatting, if the source logger has a localization ResourceBundle and if that ResourceBundle has an entry for this message string, then the message string is replaced with the localized value.
public void setMessage(String message)
message - the raw message string (may be null)public Object[] getParameters()
public void setParameters(Object[] parameters)
parameters - the log message parameters. (may be null)public int getThreadID()
This is a thread identifier within the Java VM and may or may not map to any operating system ID.
public void setThreadID(int threadID)
threadID - the thread IDpublic long getMillis()
public void setMillis(long millis)
millis - event time in millis since 1970public Throwable getThrown()
If the event involved an exception, this will be the exception object. Otherwise null.
public void setThrown(Throwable thrown)
thrown - a throwable (may be null)Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
7 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)