Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

The VIVO log file contains time-stamped statements intended to help you

...

Here is an example of some code that writes to the log

Panelcode
private static final Log log = LogFactory.getLog(WebappDaoSetup.class);


...


log.info(elapsedSeconds + " seconds to set up models and DAO factories");

and here is the resulting line in the log:

Panelcode
2012-11-15 12:20:37,406 INFO
[WebappDaoSetup] 3 seconds to set up models and DAO
 [<span class="confluence-link">WebappDaoSetup</span>] 3 seconds to set up models and DAO factories

The log holds the time that the statement was written, the severity level of the message,
the name of the Java class that wrote the statement, and the contents of the statement itself.

Writing Exceptions exceptions to the log can be tricky: check out this page on
writing exceptions on Writing Exceptions to the logLog

What is the right level for a log message?

...

The output levels for VIVO are determined by a file called
called [vitro-core]/webapp/config/default.log4j.properties

This file sets the general output level to INFO, which means that messages at the
INFO level or higher will be written to the log. Messages at DEBUG or lower
will not be written to the log.

The file also sets higher output levels for some classes that are otherwise too chatty with their
log their log messages. So for example, the StartupStatus class is assigned an output level of WARN.
This  This means that messages at the WARN level or higher will be written to the log,
and messages at INFO or lower will not.

...

Developers can make temporary changes to these settings by creating a file called
called [vitro-core]/webapp/config/debug.log4j.properties

When VIVO is rebuilt, the settings in this file will be used instead of the
settings the settings in the default file. A developer will commonly change the output level of the
classes the classes or packages he is currently working on, using this file.

The debug settings file is ignored by Git. As a result it remains unique to the individual
developer, and can be changed without concern.

...