You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 14
Next »
Defaults
For both the GUI and the CLI, there is logging to the console. Both the GUI and the CLI are configured to send log messages at level DEBUG and above to file daticaldb.log
.
The system also automatically creates date-stamped versions of the daticaldb.log
file. It automatically deletes log files older than 30 days.
Logging Systems
The logging systems (SLF4J and Logback) define basic logging concepts.
Log Levels
SLF4J defines logging levels. The levels are used during development and at runtime. When a developer puts a line in the code to log a message, they select the level of that message. At run time, the logging system presents log messages at the level selected.
Log Level | Description |
ALL | When set, messages from all logging levels will be recorded in the configured logs. |
ERROR | This level will only record error or exception messages to the log. |
WARNING | This level is used to communicate application conditions that could lead to an error. Also includes ERROR messages. |
INFO | This level is used to communicate general information about application usage. Also includes ERROR & WARNING messages. |
DEBUG | This level includes more specific information about the operation environment to assist in diagnosing runtime issues in errors. Also includes ERROR, WARNING & INFO messages. |
TRACE | This level is available, but not used in Datical DB. The output is identical to the DEBUG option. |
OFF | Turns off all logging. |
Configuring Other Aspects of Logging
Locations
The two logging configuration files are located in your product installation directories.
- For desktop client/Eclipse GUI operations: <datical_install_dir>/logging-config.xml
- For command line/hammer operations: <datical_install_dir>/repl/logging-config.xml
Main Logger
The main logger to adjust is the liquibase logger and this line:
<logger name="liquibase" level="INFO"/>
Update to:
<logger name="liquibase" level="DEBUG"/>
Full Sample File
Expand open below to see a sample logging-config.xml file:
<!-- Scan/scan period mean that as the application is running, logback will check the
file every 30 seconds for changes and re-load the configuration as needed -->
<configuration scan="true" scanPeriod="30 seconds">
<!-- This creates an appender (a place for log messages to go), names it "STDOUT"
and says that this appender uses the built-in ConsoleAppender, which writes to the
standard output stream. It can also be configured to write to standard error. -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- This filter prevents logging messages below the given level from being written
to the appender. -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<!-- By default, the console appender is OFF. Change as needed. -->
<level>OFF</level>
</filter>
<!-- Encoders determine what the output looks like. Here we have each log message
start with a date/time stamp that just shows the time, down to the millisecond.
The thread name and log level are shown, and then the name of the logger (limited to
36 characters). Finally, the message itself, followed by a newline -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- This creates a second appender, names it "FILE" and says that it WILL be using
the built-in RollingFileAppender. That appender writes to a file, and then
periodically archives old logs. The rolling strategy is completely configurable -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- The name of the 'base' log file. No path is given, so the file will be located
in the 'current' directory. For the GUI, that means that the file will be in the
installation directory. For the REPL, this will be whatever directory the REPL was
started from. Note that this means there may be many daticaldb.log files scattered
around the user's disk. Users may want to do this differently. -->
<file>daticaldb.log</file>
<!-- As with the console appender above, this filters out messages below the given
level. That means that DEBUG messages will be shown, but not TRACE messages. -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- This configures the rolling policy to create a new log file each day, naming the
'rolled' file 'daticaldb-2016-01-23.log' or similar, and to keep at most 30 days
worth of log files. -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>daticaldb.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<!-- This encoder is identical to the one used above by the console appender -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- This configures what is called the 'root' logger. Logback allows for a hierarchy
of loggers, making it possible for different loggers in the code to send output to
zero, one, or many different destinations. We set the default log level to 'DEBUG',
and then reference both of the named appenders. It would be possible to refer to named
loggers here, so that, for instance, all the messages from the
com.datical.hammer.core package (and sub-packages) went to a specific appender, and
all the messages from another package went to a different appender. -->
<root level="debug">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
<!-- There is a 'special' logger for liquibase, which performs much of the internal
implementation of Datical DB. This line configures the liquibase logger to log things
at the INFO level. Change this as needed. -->
<logger name="liquibase" level="INFO"/>
<!-- Define loggers for Drools to reduce logging -->
<logger name="org.drools" level="WARN"/>
<logger name="org.kie" level="WARN"/>
<logger name="org.apache" level="WARN" />
<logger name="httpclient" level="WARN" />
<logger name="org.eclipse.jgit" level="WARN" />
</configuration>
Modification Example
How to include the date in the timestamps in daticaldb.log
- For that example, you would find both of the lines in your logging-config.xml files that by default have this:
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
- And replace it with this instead on both lines:
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
Upgrade Note
If you modify your logging-config.xml files, note that when you upgrade to a newer version of Liquibase Enterprise/Datical DB in the future that the new installation directory will have the default logging-config.xml. So you will need to modify the logging-config.xml files in your installation of your newer Liquibase Enterprise version after each upgrade.