public class LocalLog extends Object implements Log
Class which implements our Log interface so we can bypass external logging classes if they are not available.
You can set the log level by setting the System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "trace"). Acceptable values are: TRACE, DEBUG, INFO, WARN, ERROR, and FATAL. You can also redirect the log to a file by setting the System.setProperty(LocalLog.LOCAL_LOG_FILE_PROPERTY, "log.out"). Otherwise, log output will go to stdout.
It also supports a file ormliteLocalLog.properties file which contains lines such as:
# regex-pattern = Level log4j\.logger\.com\.j256\.ormlite.*=DEBUG log4j\.logger\.com\.j256\.ormlite\.stmt\.mapped.BaseMappedStatement=TRACE log4j\.logger\.com\.j256\.ormlite\.stmt\.mapped.MappedCreate=TRACE log4j\.logger\.com\.j256\.ormlite\.stmt\.StatementExecutor=TRACE
| Modifier and Type | Field and Description |
|---|---|
static String |
LOCAL_LOG_FILE_PROPERTY |
static String |
LOCAL_LOG_LEVEL_PROPERTY |
static String |
LOCAL_LOG_PROPERTIES_FILE |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLevelEnabled(Log.Level level)
Returns true if the log mode is in trace or higher.
|
void |
log(Log.Level level,
String msg)
Log a trace message.
|
void |
log(Log.Level level,
String msg,
Throwable throwable)
Log a trace message with a throwable.
|
static void |
openLogFile(String logPath)
Reopen the associated static logging stream.
|
public static final String LOCAL_LOG_LEVEL_PROPERTY
public static final String LOCAL_LOG_FILE_PROPERTY
public static final String LOCAL_LOG_PROPERTIES_FILE
public LocalLog(String className)
public static void openLogFile(String logPath)
public boolean isLevelEnabled(Log.Level level)
LogisLevelEnabled in interface Logpublic void log(Log.Level level, String msg)
LogThis documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.