Warning! This documentation is a work in progress. Expect things to be out of date and not actually work according to instructions.

Logging

You can log using Stallion’s simple wrapper around java.util.Logger – io.stallion.services.Log.

Log.info("Found user with id {0}", user.id);
Log.warn("Book not found! {0} {1}", authorName, title);
Log.fine("A debug message...");
try {
...
} catch(Exception ex) {
   Log.exception(ex, "Something went wrong when accessing {0}", thing.id);
}

If you have email configured, logging an exception will send an email to the site admin.

The available log levels are: WARNING, INFO, FINE, FINER, FINEST

You can set a log level via the command line:

>stallion serve -logLevel=FINE

When you are running on a server, or when you run with the -localMode=false flag, all log statements will go to a file. By default, the log file will be /tmp/log/stallion/<your stallion folder slugified>.log. But you can override this with the logFile setting in your stallion.toml.

This file logging will use a rotate logs every 50 megabytes while storing the last 7 files.

© 2024 Stallion Software LLC