com.j256.ormlite.logger
Class LocalLog

java.lang.Object
  extended by com.j256.ormlite.logger.LocalLog
All Implemented Interfaces:
Log

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
 

Author:
graywatson

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.j256.ormlite.logger.Log
Log.Level
 
Field Summary
static String LOCAL_LOG_FILE_PROPERTY
           
static String LOCAL_LOG_LEVEL_PROPERTY
           
static String LOCAL_LOG_PROPERTIES_FILE
           
 
Constructor Summary
LocalLog(String className)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCAL_LOG_LEVEL_PROPERTY

public static final String LOCAL_LOG_LEVEL_PROPERTY
See Also:
Constant Field Values

LOCAL_LOG_FILE_PROPERTY

public static final String LOCAL_LOG_FILE_PROPERTY
See Also:
Constant Field Values

LOCAL_LOG_PROPERTIES_FILE

public static final String LOCAL_LOG_PROPERTIES_FILE
See Also:
Constant Field Values
Constructor Detail

LocalLog

public LocalLog(String className)
Method Detail

openLogFile

public static void openLogFile(String logPath)
Reopen the associated static logging stream. Set to null to redirect to System.out.


isLevelEnabled

public boolean isLevelEnabled(Log.Level level)
Description copied from interface: Log
Returns true if the log mode is in trace or higher.

Specified by:
isLevelEnabled in interface Log

log

public void log(Log.Level level,
                String msg)
Description copied from interface: Log
Log a trace message.

Specified by:
log in interface Log

log

public void log(Log.Level level,
                String msg,
                Throwable throwable)
Description copied from interface: Log
Log a trace message with a throwable.

Specified by:
log in interface Log


This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.