Revel provides four loggers: * TRACE - debugging information only. * INFO - informational. * WARN - something unexpected but not harmful. * ERROR - someone should take a look at this.

Example usage within a Revel app:

now := time.Now()
revel.TRACE.Printf("%s", now.String())

Each of these is a variable to a default go logger.

Loggers may be configured in app.conf. Here is an example: = sampleapp

log.trace.output = stdout  = stdout
log.warn.output  = stderr
log.error.output = stderr

log.trace.prefix = "TRACE "  = "INFO  "

log.trace.flags  = 10   = 10

log.trace.output = off  = off
log.warn.output  = log/%(
log.error.output = log/%(

In dev mode:

  • even the most detailed logs will be shown.
  • everything logged at info or trace will be prefixed with its logging level.

In prod mode:

  • info and trace logs are ignored.
  • both warnings and errors are appended to the log/sampleapp.log file.

To specify logger flags, you must calculate the flag value from the flag constants. For example, to the format 01:23:23 /a/b/c/d.go:23 Message requires the flags Ltime | Llongfile = 2 | 8 = 10.

Areas for development:

  • Revel should create the log directory if it does not already exist.