Package net.ssehub.easy.basics.logger
Class EASyLoggerFactory
java.lang.Object
net.ssehub.easy.basics.logger.EASyLoggerFactory
Factory for the current logger. The current logger is encapsulated in EASyLogger to
provide simple access. For an example of the usage of this class see the
containing package.- Author:
- Sass
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassLogger instance for logging in plug-ins of the EASy-Producer. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThis constant value should be set to:false: For a release.true: For development.static final EASyLoggerFactoryprivate LoggingLevelprivate static final StringSpecification to log into a specified file instead of logging into the console.private ILoggerprivate static final Stringprivate static final Stringprivate static final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static LoggingLeveldetermineLevel(LoggingLevel defaultLevel) Checks whether a property was passed to the JVM for specifying aLoggingLevel.Returns a logger instance for logging informations, warnings, and errors in a concrete class.Returns theLoggingLevelthat is used by the logger.Sets anILogger.voidsetLoggingLevel(LoggingLevel loggingLevel) Sets anLoggingLevel.
-
Field Details
-
INSTANCE
-
DEBUG
public static final boolean DEBUGThis constant value should be set to:false: For a release.true: For development.
- See Also:
-
LOGGING_LEVEL_PROPERTY
- See Also:
-
LOGGING_TRACE_PROPERTY
- See Also:
-
TRACE
private static final boolean TRACE -
LOG_FILE_PATH
Specification to log into a specified file instead of logging into the console.- See Also:
-
logger
-
level
-
-
Constructor Details
-
EASyLoggerFactory
private EASyLoggerFactory()Singleton constructor for Logger.
-
-
Method Details
-
determineLevel
Checks whether a property was passed to the JVM for specifying aLoggingLevel. This method is part of theEASyLoggerFactory()(constructor).- Parameters:
defaultLevel- The defaultLoggingLevelwhich should be used, if no logging property was passed to the Java VM.- Returns:
- Returns the specified
LoggingLevelorLoggingLevel.WARNif no one was specified via a property.
-
getLogger
Returns a logger instance for logging informations, warnings, and errors in a concrete class. This logger instance should not be passed to other classes.- Parameters:
clazz- The class to log.bundleName- The name of the plug-in containing the logged class (can be null).- Returns:
- ILogger A logger instance for this specified class and plug-in.
-
setLogger
Sets anILogger. ThisILoggerwill be used inside thegetLogger(Class, String)method for creating concrete logger instances. Also all already created loggers will be updated automatically.- Parameters:
logger- The newILoggerwhich shall be used to log all info, warnings, and errors. Must not be null.- Returns:
- the active logger before this operation
-
getLoggingLevel
Returns theLoggingLevelthat is used by the logger.- Returns:
- The logging level that is set.
-
setLoggingLevel
Sets anLoggingLevel.- Parameters:
loggingLevel- The newLoggingLevelwhich shall be used to log.
-