Skip to content

Tracing & Logging

BlueNimble edited this page Apr 2, 2018 · 7 revisions

In BlueNimble, we call logging tracing. Tracing is managed by plugins and injected into the "Server", "Plugin", "Space" and "Api" components.

The default tracing plugin is Log4J Tracer, It's configurable through the the Log4J.xml Config File Log4J supports many appenders such as elasticsearch, karfa, splunk and socket.

You could add other appender when needed to enhance the plugin. If you want to use a different concept/mechanism of tracing, create a new plugin and implement the Tracer interface.

The default tracing plugin uses the Console plugin, make sure you disable this appender in production environments.

Server Tracing

You can enable, disable or change tracing implementations by editing the instance.json config file located under [BlueNimble Install Home]/config

...
...
"tracer": {
  "class": "!tracing.log4j:default"
}
...
...

We add the (!) sign to ignore the tracer implementation if tracing.log4j plugin isn't installed

Plugins Tracing

You can enable, disable or change tracing implementations for a specific plugin by editing the plugin.json config file located under the plugin home directory [BlueNimble Install Home]/plugins/ThePlugin/plugin.json

...
...
"tracer": {
  "class": "!tracing.log4j:default"
}
...
...

Space Tracing

You can enable, disable or change tracing implementations for a specific space by editing the space.json config file located under the space home directory [BlueNimble Install Home]/spaces/TheSpace/space.json

...
...
"tracer": {
  "class": "!tracing.log4j:default"
}
...
...

Api and Functions Tracing

You can enable, disable or change tracing implementations for your api in the api.json or api.yaml descriptor file.

...
...
"tracer": {
  "class": "!tracing.log4j:default"
}
...
...

In order to log from functions, access the tarcer instance attached to the api.

For javascript developers,

api.tracer.info ('A Message');

For java, scala, ... developers,

api.tracer ().info ('A Message');