Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

mock.java.util.logging
Class LoggerMock  view LoggerMock download LoggerMock.java

java.lang.Object
  extended byjava.util.logging.Logger
      extended bymock.java.util.logging.LoggerMock

public class LoggerMock
extends java.util.logging.Logger


Field Summary
 boolean fineCalled
           
 java.lang.String fineMessage
           
 boolean severeCalled
           
 java.lang.String severeMessage
           
 
Fields inherited from class java.util.logging.Logger
global
 
Constructor Summary
LoggerMock()
           
 
Method Summary
 void addHandler(java.util.logging.Handler handler)
          Adds a handler to the set of handlers that get notified when a log record is to be published.
protected  java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 void config(java.lang.String msg)
          Logs a message with severity level CONFIG.
 void entering(java.lang.String sourceClass, java.lang.String sourceMethod)
           
 void entering(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object param1)
           
 void entering(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object[] params)
           
 boolean equals(java.lang.Object obj)
          Determine whether this Object is semantically equal to another Object.
 void exiting(java.lang.String sourceClass, java.lang.String sourceMethod)
           
 void exiting(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object result)
           
protected  void finalize()
          Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed.
 void fine(java.lang.String msg)
          Logs a message with severity level FINE.
 void finer(java.lang.String msg)
          Logs a message with severity level FINER.
 void finest(java.lang.String msg)
          Logs a message with severity level FINEST.
 java.util.logging.Filter getFilter()
           
 java.util.logging.Handler[] getHandlers()
          Returns the handlers currently registered for this Logger.
 java.util.logging.Level getLevel()
          Returns the severity level threshold for this Handler.
 java.lang.String getName()
          Returns the name of this logger.
 java.util.logging.Logger getParent()
          Returns the parent of this logger.
 java.util.ResourceBundle getResourceBundle()
          Returns the resource bundle that is being used for localizing messages.
 java.lang.String getResourceBundleName()
          Returns the name of the resource bundle that is being used for localizing messages.
 boolean getUseParentHandlers()
          Returns whether or not this Logger forwards log records to handlers registered for its parent loggers.
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 void info(java.lang.String msg)
          Logs a message with severity level INFO.
 boolean isLoggable(java.util.logging.Level level)
          Returns whether or not a message of the specified level would be logged by this logger.
 void log(java.util.logging.Level level, java.lang.String msg)
           
 void log(java.util.logging.Level level, java.lang.String msg, java.lang.Object param1)
           
 void log(java.util.logging.Level level, java.lang.String msg, java.lang.Object[] params)
           
 void log(java.util.logging.Level level, java.lang.String msg, java.lang.Throwable thrown)
           
 void log(java.util.logging.LogRecord record)
          Passes a record to registered handlers, provided the record is considered as loggable both by isLoggable(Level) 55 and a possibly installed custom filter 55 .
 void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
           
 void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Object param1)
           
 void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Object[] params)
           
 void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Throwable thrown)
           
 void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg)
           
 void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Object param1)
           
 void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Object[] params)
           
 void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Throwable thrown)
           
 void removeHandler(java.util.logging.Handler handler)
          Removes a handler from the set of handlers that get notified when a log record is to be published.
 void setFilter(java.util.logging.Filter newFilter)
           
 void setLevel(java.util.logging.Level newLevel)
          Sets the severity level threshold for this Handler.
 void setParent(java.util.logging.Logger parent)
          Sets the parent of this logger.
 void setUseParentHandlers(boolean useParentHandlers)
          Sets whether or not this Logger forwards log records to handlers registered for its parent loggers.
 void severe(java.lang.String msg)
          Logs a message with severity level SEVERE, indicating a serious failure that prevents normal program execution.
 void throwing(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Throwable thrown)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void warning(java.lang.String msg)
          Logs a message with severity level WARNING, indicating a potential problem that does not prevent normal program execution.
 
Methods inherited from class java.util.logging.Logger
getAnonymousLogger, getAnonymousLogger, getLogger, getLogger
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

fineCalled

public boolean fineCalled

fineMessage

public java.lang.String fineMessage

severeCalled

public boolean severeCalled

severeMessage

public java.lang.String severeMessage
Constructor Detail

LoggerMock

public LoggerMock()
Method Detail

addHandler

public void addHandler(java.util.logging.Handler handler)
                throws java.lang.SecurityException
Description copied from class: java.util.logging.Logger
Adds a handler to the set of handlers that get notified when a log record is to be published.


config

public void config(java.lang.String msg)
Description copied from class: java.util.logging.Logger
Logs a message with severity level CONFIG. Level.CONFIG>Level.CONFIG 55 is intended for static configuration messages, for example about the windowing environment, the operating system version, etc.


entering

public void entering(java.lang.String sourceClass,
                     java.lang.String sourceMethod,
                     java.lang.Object param1)

entering

public void entering(java.lang.String sourceClass,
                     java.lang.String sourceMethod,
                     java.lang.Object[] params)

entering

public void entering(java.lang.String sourceClass,
                     java.lang.String sourceMethod)

exiting

public void exiting(java.lang.String sourceClass,
                    java.lang.String sourceMethod,
                    java.lang.Object result)

exiting

public void exiting(java.lang.String sourceClass,
                    java.lang.String sourceMethod)

fine

public void fine(java.lang.String msg)
Description copied from class: java.util.logging.Logger
Logs a message with severity level FINE. Level.FINE>Level.FINE 55 is intended for messages that are relevant for developers using the component generating log messages. Examples include minor, recoverable failures, or possible inefficiencies.


finer

public void finer(java.lang.String msg)
Description copied from class: java.util.logging.Logger
Logs a message with severity level FINER. Level.FINER>Level.FINER 55 is intended for rather detailed tracing, for example entering a method, returning from a method, or throwing an exception.


finest

public void finest(java.lang.String msg)
Description copied from class: java.util.logging.Logger
Logs a message with severity level FINEST. Level.FINEST>Level.FINEST 55 is intended for highly detailed tracing, for example reaching a certain point inside the body of a method.


getFilter

public java.util.logging.Filter getFilter()

getHandlers

public java.util.logging.Handler[] getHandlers()
Description copied from class: java.util.logging.Logger
Returns the handlers currently registered for this Logger. When a log record has been deemed as being loggable, it will be passed to all registered handlers for publication. In addition, if the logger uses parent handlers (see getUseParentHandlers 55 and setUseParentHandlers 55 , the log record will be passed to the parent's handlers.


getLevel

public java.util.logging.Level getLevel()
Description copied from class: java.util.logging.Logger
Returns the severity level threshold for this Handler. All log records with a lower severity level will be discarded; a log record of the same or a higher level will be published unless an installed Filter decides to discard it.


getName

public java.lang.String getName()
Description copied from class: java.util.logging.Logger
Returns the name of this logger.


getParent

public java.util.logging.Logger getParent()
Description copied from class: java.util.logging.Logger
Returns the parent of this logger. By default, the parent is assigned by the LogManager by inspecting the logger's name.


getResourceBundle

public java.util.ResourceBundle getResourceBundle()
Description copied from class: java.util.logging.Logger
Returns the resource bundle that is being used for localizing messages.


getResourceBundleName

public java.lang.String getResourceBundleName()
Description copied from class: java.util.logging.Logger
Returns the name of the resource bundle that is being used for localizing messages.


getUseParentHandlers

public boolean getUseParentHandlers()
Description copied from class: java.util.logging.Logger
Returns whether or not this Logger forwards log records to handlers registered for its parent loggers.


info

public void info(java.lang.String msg)
Description copied from class: java.util.logging.Logger
Logs a message with severity level INFO. Level.INFO>Level.INFO 55 is intended for purely informational messages that do not indicate error or warning situations. In the default logging configuration, INFO messages will be written to the system console. For this reason, the INFO level should be used only for messages that are important to end users and system administrators. Messages at this level should be understandable to an inexperienced, non-technical user.


isLoggable

public boolean isLoggable(java.util.logging.Level level)
Description copied from class: java.util.logging.Logger
Returns whether or not a message of the specified level would be logged by this logger.


log

public void log(java.util.logging.Level level,
                java.lang.String msg,
                java.lang.Object param1)

log

public void log(java.util.logging.Level level,
                java.lang.String msg,
                java.lang.Object[] params)

log

public void log(java.util.logging.Level level,
                java.lang.String msg,
                java.lang.Throwable thrown)

log

public void log(java.util.logging.Level level,
                java.lang.String msg)

log

public void log(java.util.logging.LogRecord record)
Description copied from class: java.util.logging.Logger
Passes a record to registered handlers, provided the record is considered as loggable both by Logger.isLoggable(Level)>Logger.isLoggable(Level) 55 and a possibly installed custom filter 55 .

If the logger has been configured to use parent handlers, the record will be forwarded to the parent of this logger in addition to being processed by the handlers registered with this logger.

The other logging methods in this class are convenience methods that merely create a new LogRecord and pass it to this method. Therefore, subclasses usually just need to override this single method for customizing the logging behavior.


logp

public void logp(java.util.logging.Level level,
                 java.lang.String sourceClass,
                 java.lang.String sourceMethod,
                 java.lang.String msg,
                 java.lang.Object param1)

logp

public void logp(java.util.logging.Level level,
                 java.lang.String sourceClass,
                 java.lang.String sourceMethod,
                 java.lang.String msg,
                 java.lang.Object[] params)

logp

public void logp(java.util.logging.Level level,
                 java.lang.String sourceClass,
                 java.lang.String sourceMethod,
                 java.lang.String msg,
                 java.lang.Throwable thrown)

logp

public void logp(java.util.logging.Level level,
                 java.lang.String sourceClass,
                 java.lang.String sourceMethod,
                 java.lang.String msg)

logrb

public void logrb(java.util.logging.Level level,
                  java.lang.String sourceClass,
                  java.lang.String sourceMethod,
                  java.lang.String bundleName,
                  java.lang.String msg,
                  java.lang.Object param1)

logrb

public void logrb(java.util.logging.Level level,
                  java.lang.String sourceClass,
                  java.lang.String sourceMethod,
                  java.lang.String bundleName,
                  java.lang.String msg,
                  java.lang.Object[] params)

logrb

public void logrb(java.util.logging.Level level,
                  java.lang.String sourceClass,
                  java.lang.String sourceMethod,
                  java.lang.String bundleName,
                  java.lang.String msg,
                  java.lang.Throwable thrown)

logrb

public void logrb(java.util.logging.Level level,
                  java.lang.String sourceClass,
                  java.lang.String sourceMethod,
                  java.lang.String bundleName,
                  java.lang.String msg)

removeHandler

public void removeHandler(java.util.logging.Handler handler)
                   throws java.lang.SecurityException
Description copied from class: java.util.logging.Logger
Removes a handler from the set of handlers that get notified when a log record is to be published.


setFilter

public void setFilter(java.util.logging.Filter newFilter)
               throws java.lang.SecurityException

setLevel

public void setLevel(java.util.logging.Level newLevel)
              throws java.lang.SecurityException
Description copied from class: java.util.logging.Logger
Sets the severity level threshold for this Handler. All log records with a lower severity level will be discarded immediately. A log record of the same or a higher level will be published unless an installed Filter decides to discard it.


setParent

public void setParent(java.util.logging.Logger parent)
Description copied from class: java.util.logging.Logger
Sets the parent of this logger. Usually, applications do not call this method directly. Instead, the LogManager will ensure that the tree of loggers reflects the hierarchical logger namespace. Basically, this method should not be public at all, but the GNU implementation follows the API specification.


setUseParentHandlers

public void setUseParentHandlers(boolean useParentHandlers)
Description copied from class: java.util.logging.Logger
Sets whether or not this Logger forwards log records to handlers registered for its parent loggers.


severe

public void severe(java.lang.String msg)
Description copied from class: java.util.logging.Logger
Logs a message with severity level SEVERE, indicating a serious failure that prevents normal program execution. Messages at this level should be understandable to an inexperienced, non-technical end user. Ideally, they explain in simple words what actions the user can take in order to resolve the problem.


throwing

public void throwing(java.lang.String sourceClass,
                     java.lang.String sourceMethod,
                     java.lang.Throwable thrown)

warning

public void warning(java.lang.String msg)
Description copied from class: java.util.logging.Logger
Logs a message with severity level WARNING, indicating a potential problem that does not prevent normal program execution. Messages at this level should be understandable to an inexperienced, non-technical end user. Ideally, they explain in simple words what actions the user can take in order to resolve the problem.


hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


equals

public boolean equals(java.lang.Object obj)
Description copied from class: java.lang.Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

  • It must be transitive. If a.equals(b) and b.equals(c), then a.equals(c) must be true as well.
  • It must be symmetric. a.equals(b) and b.equals(a) must have the same value.
  • It must be reflexive. a.equals(a) must always be true.
  • It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
  • a.equals(null) must be false.
  • It must be consistent with hashCode(). That is, a.equals(b) must imply a.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.

This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.


clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }
 


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


finalize

protected void finalize()
                 throws java.lang.Throwable
Description copied from class: java.lang.Object
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. You would think that this means it eventually is called on every Object, but this is not necessarily the case. If execution terminates abnormally, garbage collection does not always happen. Thus you cannot rely on this method to always work. For finer control over garbage collection, use references from the java.lang.ref package.

Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply super.finalize().

finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.

If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.

It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.

Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls super.finalize().

The default implementation does nothing.