Package org.apache.openjpa.lib.log
Class LogFactoryImpl
- java.lang.Object
-
- org.apache.openjpa.lib.log.LogFactoryImpl
-
- All Implemented Interfaces:
Configurable,GenericConfigurable,LogFactory
public class LogFactoryImpl extends Object implements LogFactory, GenericConfigurable, Configurable
DefaultLogFactoryimplementation. For ease of automatic configuration, this implementation keys on only the last dot-separated token of the log channel name.- Author:
- Patrick Linskey
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classLogFactoryImpl.LogImplA simple implementation of theLoginterface.
-
Field Summary
Fields Modifier and Type Field Description static StringERROR_STRstatic StringFATAL_STRstatic StringINFO_STRprotected longinitializationMillisThe time at which this factory was initialized.static StringSTDERRstatic StringSTDOUTstatic StringTRACE_STRstatic StringWARN_STR
-
Constructor Summary
Constructors Constructor Description LogFactoryImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendConfiguration()Invoked upon completion of bean property configuration for this object.shortgetDefaultLevel()The default level for unconfigured log channels.StringgetDiagnosticContext()A string to prefix all log messages with.static shortgetLevel(String str)Returns a symbolic constant for the specified string level.static StringgetLevelName(short level)Returns a string representation of the specified log level constant.LoggetLog(String channel)Return a log for the given channel name.PrintStreamgetStream()The stream to write to.protected LogFactoryImpl.LogImplnewLogImpl()Create a new log.voidsetConfiguration(Configuration conf)Invoked prior to setting bean properties.voidsetDefaultLevel(short level)The default level for unconfigured log channels.voidsetDefaultLevel(String level)The string name of the default level for unconfigured log channels; used for automatic configuration.voidsetDiagnosticContext(String val)A string to prefix all log messages with.voidsetFile(String file)The stream to write to.voidsetInto(Options opts)Perform any generic configuration based on the data inopts.voidsetStream(PrintStream stream)The stream to write to.voidstartConfiguration()Invoked before bean property configuration is begun on this object.
-
-
-
Field Detail
-
TRACE_STR
public static final String TRACE_STR
-
INFO_STR
public static final String INFO_STR
-
WARN_STR
public static final String WARN_STR
-
ERROR_STR
public static final String ERROR_STR
-
FATAL_STR
public static final String FATAL_STR
-
STDOUT
public static final String STDOUT
- See Also:
- Constant Field Values
-
STDERR
public static final String STDERR
- See Also:
- Constant Field Values
-
initializationMillis
protected final long initializationMillis
The time at which this factory was initialized.
-
-
Method Detail
-
getLog
public Log getLog(String channel)
Description copied from interface:LogFactoryReturn a log for the given channel name.- Specified by:
getLogin interfaceLogFactory
-
newLogImpl
protected LogFactoryImpl.LogImpl newLogImpl()
Create a new log. The log will be cached.
-
setDefaultLevel
public void setDefaultLevel(String level)
The string name of the default level for unconfigured log channels; used for automatic configuration.
-
getDefaultLevel
public short getDefaultLevel()
The default level for unconfigured log channels.
-
setDefaultLevel
public void setDefaultLevel(short level)
The default level for unconfigured log channels.
-
setDiagnosticContext
public void setDiagnosticContext(String val)
A string to prefix all log messages with. Set tonullto use the configuration's Id property setting.
-
getDiagnosticContext
public String getDiagnosticContext()
A string to prefix all log messages with. Set tonullto use the configuration's Id property setting.
-
setFile
public void setFile(String file)
The stream to write to. Recognized values are:stdoutandstderr. Any other value will be considered a file name.
-
getStream
public PrintStream getStream()
The stream to write to.
-
setStream
public void setStream(PrintStream stream)
The stream to write to.
-
getLevelName
public static String getLevelName(short level)
Returns a string representation of the specified log level constant.
-
getLevel
public static short getLevel(String str)
Returns a symbolic constant for the specified string level.
-
setConfiguration
public void setConfiguration(Configuration conf)
Description copied from interface:ConfigurableInvoked prior to setting bean properties.- Specified by:
setConfigurationin interfaceConfigurable
-
startConfiguration
public void startConfiguration()
Description copied from interface:ConfigurableInvoked before bean property configuration is begun on this object.- Specified by:
startConfigurationin interfaceConfigurable
-
endConfiguration
public void endConfiguration()
Description copied from interface:ConfigurableInvoked upon completion of bean property configuration for this object.- Specified by:
endConfigurationin interfaceConfigurable
-
setInto
public void setInto(Options opts)
Description copied from interface:GenericConfigurablePerform any generic configuration based on the data inopts. This method should remove any values inoptsthat have been successfully processed; if any values remain inoptsafter this method is executed, an exception will be thrown identifying those key-value pairs as invalid.- Specified by:
setIntoin interfaceGenericConfigurable
-
-