Plugins You can find out about all the publicly available Grails plugins.

OohLaLog Plugin

1 vote
compile "org.grails.plugins:ooh-la-log:1.0.2"

 Documentation  Source  Issues


Grails Oohlalog Log4j Appender for Passing logs to the oohlalog API.


grails install-plugin ooh-la-log


The Grails OohLaLog plugin adds a log4j appender to forward traffic to the oohlalog api service. This allows its users to aggregate logs across multiple servers, setup alarms, custom counters, and realtime monitor their application. See OohLaLog.

Log4J Appender

Modify your Config.groovy file to add an appender to log4j.


log4j = {
  appenders {
    appender new com.oohlalog.log4j.OohLaLogAppender( 
       name: "oohlalog", 
       authToken: "my-api-token",
       host: "")
  root {
  	info 'oohlalog'

Appender properties:

The above configuration will automatically forward log messages of info level or higher to your oohlalog app. Simply visit to signup and get your api token.

Grails Artefact Logging and Counting

The following methods are available in all Domain Classes, Controllers, and Services

void oohlaCount(String counterName, int increment = 1)

void oohlaLog(String level, String message, String category = "[artifact name]", Object exceptionOrStringDetails = null, String token = null, Long timestamp = System.currentTimeMillis() )

These methods bypass Log4J level threshold checks.

Level should be one of the standard log4J levels (TRACE, DEBUG, INFO, WARN, ALL, ERROR, FATAL)

Token can be used to relate a sequence of logs together (i.e. specific user activity)


class myService {
	def myMethod() {
        oohlaLog('DEBUG','interesting!') //always sent to OohLaLog

def myOtherMethod() { log.debug('toooo interesting!') // not sent to OohLaLog if threshold is INFO (as above) }


To use these methods please configure the OohLaLoh log4j appender as mentioned above or add the following Config.groovy setting:

oohlalog.path="/api/logging/save.json" // OPTIONAL 
oohlalog.port=80 // OPTIONAL // OPTIONAL 
oohlalog.debug=false // OPTIONAL 
oohlalog.hostName=null // OPTIONAL how the log source will appear

Appender properties:

Web Transaction Counting

Static Property

You may enable Controller Action counters by adding a static property to your Controllers:


class MyController {
	static oohLaLogCountActions = true

All action requests will be counted as "Controller name (+).Action name (+)"


You may also enable Controller Action counters via Config.groovy configuration:

// globally enables counting 
oohlalog.webtransactions = true 
// enables counting for a specific controller
oohlalog.webtransactions.myController = true 
// enables counting for a specific controller with a custom counter
namespaceoohlalog.webtransactions.myController = 'MyCtrlr' 
// enables counting for a specific controller action the default counter
nameoohlalog.webtransactions.myController.myAction = true 
// enables counting for a specific controller action with a custom counter namespace
oohlalog.webtransactions.myController.myAction = 'myAct'

To use these configurations please configure the OohLaLoh log4j appender or Config setting as mentioned above.


You may also enable controler Controller Action counters via Annotation. The Annotation can be used for the Controller class and the Controller Actions:


import com.oohlalog.grails.OohLaLogWebTransaction
class MyController {
  def test() { 
	render text:'test!' // counts as "mycont.test"

@OohLaLogWebTransaction('my.idx') def index() { render text:'index!' // counts as "my.idx" } }

To use the taglib please configure the OohLaLoh log4j appender or Config setting as mentioned above.

Integration With Spring Security

It you have the Spring Security Core plugin installed you can automatically capture the principal's username (if available) as the log message "token". This can be used to trace user activity.

To enable this feature:

  1. Install the Spring Security Core Plugin
2. Add the following to `Config.groovy`.
oohlalog.springSecurityContext = true

Web Browser Logging and Counting

There are three tags available:

  • <olo:lib> - adds and configures the JavaScript library. Accepts "version" and "minified" attributes. The OohLaLog API JS global is "olo".
  • <olo:counterImage> - adds an image that will increment a counter when loaded by a client. Accepts "name" attribute.
  • <olo:logImage> - adds an image that will submit a log when loaded by a client. Accepts "level", "category", and "message" attributes.
<input type="button" value="Count!" onclick="olo.count('mycounter',1);"/>
Counter Image
<olo:counterImage name="myImageCounter"/>
Log Image
<olo:logImage level="INFO" category="myCat" message="hello world"/>

JavaScript API:

olo.count(code,incr,name+,callback+, apiKey+),category,details+,priority+,token+,callback+,apiKey+)


Low Level API:



"error">code: null
}); olo.counter.get(
"error">code: null
}); olo.warn('my msg','my cat');{category:'spanky',level:'DEBUG',message:'Howdy',callback:function(obj){alert('success='+obj.success)}}); olo.trace('my msg','my cat');

All methods support chaining.

To use the taglib please configure the OohLaLoh log4j appender or Config setting as mentioned above.