Skip to content

Logging

Deep offers the ability to inject log messages into your running application to augment existing logging to add additional context when it is needed.

To add a log message simply attach the argument log_msg to the tracepoint.

{
  "path": "some/file.py",
  "line_number": 22,
  "args": {
    "log_msg": "This log message will be injected"
  }
}
log{path="some/file.py" line=22 log="This log message will be inhected"}

The log message can also include expressions that will be interpolated and attached as watchers to the snapshot. To include an expression use curly bracers {}, e.g. This log message will get local 'name' {name}.

Languages specifics

As Deep supports a variety of languages the way the expressions need to be defined depends on the language. There are also some caveats depending on the language being used.

Warning

In all cases it is possible to execute code that is potentially harmful to your application. It is therefore the responsibility of the user to ensure the expressions will not have an adverse effect on the application.

Python

Python will evaluate the expressions using eval this allows you to execute any valid python code within the expressions. This allows for a lot of power to collect data, however it also allows for some potential bad scenarios. Where potentially harmful code can be executed. As a result we have tried to defend the user from some scenarios.

  • Global values are not exposed to eval

Java

In Java there is no equivalent of eval this means that to execute code we need to provide an evaluator. The default evaluator is the 'Nashorn' JavaScript engine. This was chosen as it is shipped in the JDK, so we can reduce the size of the Deep agent. However, this evaluator is not available in all version of Java and as such it is possible that expressions will not work in when using Java.

Note

It is planned to release additional evaluators that can be used when Nashorn is not available.

ColdFusion (Adobe/Lucee)

In ColdFusion expression will use the Evaluate function (or evaluate for Lucee) that is available on the page context. This allows for ColdFusion expressions to be evaluated.