Ibator reports logging information in several different ways:
-verbose
command line argument. Or, if you are running Ibator with the built in Ant task, these
messages may be enabled by setting the verbose
attribute to true
,
and then running Ant in verbose mode.In general, Ibator will not repeat messages. So if Ibator generates a warning, that warning is typically not also logged. In some situations it may be useful to enable logging as well as asking Ibator to be verbose with progress messages. This may generate a substantial output, but it will also give a very complete picture of what's happening internally during the Ibator run.
Ibator will use Apache Log4J logging if Log4J is in the runtime classpath. See http://logging.apache.org/log4j/ for more information about Log4J. If Log4J is not in the runtime classpath, Ibator will use standard Java logging.
If for any reason you prefer to force the use of standard Java logging, even
if Log4J is in the runtime classpath, you may specify the -forceJavaLogging
command line argument, or specify the following line of code when running
Ibator from Java:
org.apache.ibatis.ibator.logging.LogFactory.forceJavaLogging();
Important: You should specify the above line of code before any other Ibator code.
If you prefer to use a different logging implementation than Log4J or standard Java logging, you may supply an alternate implementation of the key logging interfaces as follows:
org.apache.ibatis.ibator.logging.Log
interface that implements the key logging methods for you logging implementation
of choice.org.apache.ibatis.ibator.logging.AbstractLogFactory
interface that will return instances of your Log
implementation.org.apache.ibatis.ibator.logging.LogFactory.setLogFactory(AbstractLogFactory)
and supplying an instance of your AbstractLogFactory
implementation.The following is a sample Log4J configuration file:
# Set root logger log4j.rootLogger=INFO, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c - %m%n # Ibator logging configuration... log4j.logger.org.apache.ibatis.ibator=DEBUG
This file will instruct Log4J to write all Ibator debug messages to the console. To use this file:
log4j.properties
in the
root of your runtime classpathYou should see many log messages in the console.
You may also configure Log4J in any of the other supported methods if you prefer.
The following is a sample Java logging configuration file:
# Specify the handlers to create in the root logger # (all loggers are children of the root logger) handlers = java.util.logging.ConsoleHandler # Set the default logging level for the root logger .level = INFO # Set the default logging level for new ConsoleHandler instances java.util.logging.ConsoleHandler.level = ALL # Set the default formatter for new ConsoleHandler instances java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter # Set the default logging level for the logger named org.apache.ibatis.ibator org.apache.ibatis.ibator.level = FINE
This file will instruct Java to write all Ibator debug messages to the console. To use this file:
logging.properties
(or any
file name you prefer). The file can exist anywhere in
the file system (for example, in a \temp
directory).-Djava.util.logging.config.file=\temp\logging.properties
(specify whatever actual file name and directory you used)
You should see many log messages in the console.
You may also configure Java logging in any of the other supported methods if you prefer.