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 java.lang.Object implements LogFactory, GenericConfigurable, Configurable
DefaultLogFactory
implementation. 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 class
LogFactoryImpl.LogImpl
A simple implementation of theLog
interface.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ERROR_STR
static java.lang.String
FATAL_STR
static java.lang.String
INFO_STR
protected long
initializationMillis
The time at which this factory was initialized.static java.lang.String
STDERR
static java.lang.String
STDOUT
static java.lang.String
TRACE_STR
static java.lang.String
WARN_STR
-
Constructor Summary
Constructors Constructor Description LogFactoryImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endConfiguration()
Invoked upon completion of bean property configuration for this object.short
getDefaultLevel()
The default level for unconfigured log channels.java.lang.String
getDiagnosticContext()
A string to prefix all log messages with.static short
getLevel(java.lang.String str)
Returns a symbolic constant for the specified string level.static java.lang.String
getLevelName(short level)
Returns a string representation of the specified log level constant.Log
getLog(java.lang.String channel)
Return a log for the given channel name.java.io.PrintStream
getStream()
The stream to write to.protected LogFactoryImpl.LogImpl
newLogImpl()
Create a new log.void
setConfiguration(Configuration conf)
Invoked prior to setting bean properties.void
setDefaultLevel(short level)
The default level for unconfigured log channels.void
setDefaultLevel(java.lang.String level)
The string name of the default level for unconfigured log channels; used for automatic configuration.void
setDiagnosticContext(java.lang.String val)
A string to prefix all log messages with.void
setFile(java.lang.String file)
The stream to write to.void
setInto(Options opts)
Perform any generic configuration based on the data inopts
.void
setStream(java.io.PrintStream stream)
The stream to write to.void
startConfiguration()
Invoked before bean property configuration is begun on this object.
-
-
-
Field Detail
-
TRACE_STR
public static final java.lang.String TRACE_STR
-
INFO_STR
public static final java.lang.String INFO_STR
-
WARN_STR
public static final java.lang.String WARN_STR
-
ERROR_STR
public static final java.lang.String ERROR_STR
-
FATAL_STR
public static final java.lang.String FATAL_STR
-
STDOUT
public static final java.lang.String STDOUT
- See Also:
- Constant Field Values
-
STDERR
public static final java.lang.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(java.lang.String channel)
Description copied from interface:LogFactory
Return a log for the given channel name.- Specified by:
getLog
in interfaceLogFactory
-
newLogImpl
protected LogFactoryImpl.LogImpl newLogImpl()
Create a new log. The log will be cached.
-
setDefaultLevel
public void setDefaultLevel(java.lang.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(java.lang.String val)
A string to prefix all log messages with. Set tonull
to use the configuration's Id property setting.
-
getDiagnosticContext
public java.lang.String getDiagnosticContext()
A string to prefix all log messages with. Set tonull
to use the configuration's Id property setting.
-
setFile
public void setFile(java.lang.String file)
The stream to write to. Recognized values are:stdout
andstderr
. Any other value will be considered a file name.
-
getStream
public java.io.PrintStream getStream()
The stream to write to.
-
setStream
public void setStream(java.io.PrintStream stream)
The stream to write to.
-
getLevelName
public static java.lang.String getLevelName(short level)
Returns a string representation of the specified log level constant.
-
getLevel
public static short getLevel(java.lang.String str)
Returns a symbolic constant for the specified string level.
-
setConfiguration
public void setConfiguration(Configuration conf)
Description copied from interface:Configurable
Invoked prior to setting bean properties.- Specified by:
setConfiguration
in interfaceConfigurable
-
startConfiguration
public void startConfiguration()
Description copied from interface:Configurable
Invoked before bean property configuration is begun on this object.- Specified by:
startConfiguration
in interfaceConfigurable
-
endConfiguration
public void endConfiguration()
Description copied from interface:Configurable
Invoked upon completion of bean property configuration for this object.- Specified by:
endConfiguration
in interfaceConfigurable
-
setInto
public void setInto(Options opts)
Description copied from interface:GenericConfigurable
Perform any generic configuration based on the data inopts
. This method should remove any values inopts
that have been successfully processed; if any values remain inopts
after this method is executed, an exception will be thrown identifying those key-value pairs as invalid.- Specified by:
setInto
in interfaceGenericConfigurable
-
-