Class LoggingExtension
java.lang.Object
org.moeaframework.algorithm.extension.LoggingExtension
- All Implemented Interfaces:
- Extension
Extension that logs information about the execution, including the current NFE and elapsed time.  Furthermore, the
 static methods can be used to write log messages if the algorithm has logging enabled.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final DurationThe default logging frequency for status messages.
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a new, default logging extension.LoggingExtension(String name) Constructs a new logger with the given name.LoggingExtension(String name, Duration logFrequency) Constructs a new logger with the given name and settings.LoggingExtension(Logger logger, Duration logFrequency) Constructs a new logger with the given name and settings.
- 
Method SummaryModifier and TypeMethodDescriptionReturns the logger used by this extension.static voidWrites an informational (Level.INFO) log message if the algorithm has logging enabled.voidWrites a log message using this extension.static voidWrites a log message if the algorithm has logging enabled.voidonRegister(Algorithm algorithm) Called when this extension is registered with an algorithm.voidCalled after each step of the algorithm.voidonTerminate(Algorithm algorithm) Called after the termination of an algorithm.static voidWrites a severe (Level.SEVERE) log message if the algorithm has logging enabled.static voidWrites a warning (Level.WARNING) log message if the algorithm has logging enabled.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.moeaframework.algorithm.extension.ExtensiononInitialize, onRun
- 
Field Details- 
DEFAULT_LOG_FREQUENCYThe default logging frequency for status messages.
 
- 
- 
Constructor Details- 
LoggingExtensionpublic LoggingExtension()Constructs a new, default logging extension.
- 
LoggingExtensionConstructs a new logger with the given name.- Parameters:
- name- the logger name
 
- 
LoggingExtensionConstructs a new logger with the given name and settings.- Parameters:
- name- the logger name
- logFrequency- the frequency to print log messages
 
- 
LoggingExtensionConstructs a new logger with the given name and settings.- Parameters:
- logger- the logger
- logFrequency- the frequency to print log messages
 
 
- 
- 
Method Details- 
onStepDescription copied from interface:ExtensionCalled after each step of the algorithm.
- 
onRegisterDescription copied from interface:ExtensionCalled when this extension is registered with an algorithm. This can be used to perform any type checking or initialization.- Specified by:
- onRegisterin interface- Extension
- Parameters:
- algorithm- the algorithm associated with this extension
 
- 
onTerminateDescription copied from interface:ExtensionCalled after the termination of an algorithm.- Specified by:
- onTerminatein interface- Extension
- Parameters:
- algorithm- the algorithm associated with this extension
 
- 
getLoggerReturns the logger used by this extension.- Returns:
- the logger
 
- 
logWrites a log message using this extension.- Parameters:
- level- the log level
- message- the log message
- params- additional parameters used to format the log message
 
- 
infoWrites an informational (Level.INFO) log message if the algorithm has logging enabled.- Parameters:
- algorithm- the algorithm
- message- the log message
- params- additional parameters used to format the log message
 
- 
warningWrites a warning (Level.WARNING) log message if the algorithm has logging enabled.- Parameters:
- algorithm- the algorithm
- message- the log message
- params- additional parameters used to format the log message
 
- 
severeWrites a severe (Level.SEVERE) log message if the algorithm has logging enabled.- Parameters:
- algorithm- the algorithm
- message- the log message
- params- additional parameters used to format the log message
 
- 
logWrites a log message if the algorithm has logging enabled.- Parameters:
- algorithm- the algorithm
- level- the log level
- message- the log message
- params- additional parameters used to format the log message
 
 
-