WARNING this article is out of date - please refer to more recent documentation.
Logging in Teiid is controlled by the Log4J framework. The log4j system is configured using the "<teiid-install>/deploy/log4j.xml" file in Teiid. The logging system controls
- Process Logging - runtime logging of various events pertaining to operation of the Teiid system
- Audit Logging - logging of administrative events, such who deployed the VDB or who restarted the system, etc.
- Command Logging - logging of commands that are submitted to the system by the user, and corresponding source level commands that are sent to the underlying data sources along with their operation times and status messages.
The default "log4j.xml" file looks like
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <appender name="ASYNC" class="org.apache.log4j.AsyncAppender"> <appender-ref ref="FILE"/> </appender> <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="${dqp.log4jFile}"/> <param name="MaxFileSize" value="1000KB"/> <param name="MaxBackupIndex" value="25"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/> </layout> </appender> <!-- ================ --> <!-- categories --> <!-- ================ --> <category name="org.jgroups"> <priority value="WARN"/> </category> <category name="com.arjuna"> <priority value="WARN" /> </category> <category name="org.jboss"> <priority value="WARN"/> </category> <category name="org.teiid"> <priority value="WARN" /> </category> <root> <appender-ref ref="ASYNC"/> </root> </log4j:configuration>
By default only WARN messages and above are logged by the system. Process logging also includes logging from various sub-systems like JBoss Cache, JBoss transactions etc. Log levels for each logging context can be configured independently, to suit the needs. For example, if you want to turn on the "transactions" specific logging at DEBUG level then set
<category name="com.arjuna"> <priority value="DEBUG" /> </category>
and restart the system so the changes will take effect.
If you want to capture the "command logging" in a separate file, then add the following lines to the "log4j.xml" file. (log4j.xml file already has commented section of below code)
<appender name="COMMAND" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="log/command.log"/> <param name="MaxFileSize" value="1000KB"/> <param name="MaxBackupIndex" value="25"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %p [%t] %c - %m%n"/> </layout> </appender> <category name="org.teiid.COMMAND_LOG"> <priority value="INFO"/> <appender-ref ref="COMMAND"/> </category>
This will generate the "command.log" file in the "<teiid-install>/log" directory containing all the commands that are submitted by the user to the Teiid system. This technique can be extended for capturing any one specific category of logging events to any type of appenders. Below is the complete list of logging categories available in the Teiid system
com.arjuna org.jboss org.teiid org.teiid.dqp org.teiid.CONNECTOR org.teiid.BUFFER_MGR org.teiid.STORAGE_MGR org.teiid.TXN_LOG org.teiid.EXTENSION_MODULE org.teiid.COMMAND_LOG org.teiid.AUDIT_LOG org.teiid.ADMIN_API org.teiid.QUERY_SERVICE org.teiid.CONFIG org.teiid.COMMUNICATION org.teiid.SESSON org.teiid.MEMBERSHIP org.teiid.AUTHORIZATION org.teiid.SERVER org.teiid.ADMIN
By default all the log messages are only written to a file, however Log4J system can be configured to write the messages to vareity of destinations using Log4J appenders. For all the available Log4J appenders and how to configure them check out the Log4J site. One another useful Log4J tutorial can be found here.
Users can also manage the logging levels of different contexts through Admin API. For example, the logging level of log category "org.teiid.ADMIN" can be changed from WARN to DEBUG using the "setLogConfiguration" call on the Admin API. For more complete information check out Teiid's ADMIN API.
Comments