What CDAP platform provides:
API used by apps for logging the debug data
Code Block language java /** * Interface used by CDAP applications to log the data useful for debugging during runtime. */ public interface DebugLoggerFactory { /** * Returns {@code true} if application is running in debug mode otherwise false is returned. */ boolean isEnabled(); /** * Get the {@link Logger} used to log the debug data. * @param loggerName the name of the logger with which the log data to be associated * @return the instance of the Logger */ Logger getLogger(String loggerName); }
...
/** * Interface used by the CDAP applications to log the debug data. */ public interface Logger { /** * Logs the data at INFO level. Multiple values can be logged against the same property. * @param propertyName the the name of the property * @param propertyValue the value associated with the property */ void info(String propertyName, Object propertyValue);
...
/** * Logs the data at DEBUG level. Multiple values can be logged against the same property. * @param propertyName the the name of the property * @param propertyValue the value associated with the property */ void debug(String propertyName, Object propertyValue); /** * Logs the data at ERROR level. Multiple values can be logged against the same property. * @param propertyName the the name of the property * @param propertyValue the value associated with the property */ void error(String propertyName, Object propertyValue);
...
/** * Return the name of the logger instance. */ String getName(); }
- REST endpoints
To start a preview
Code Block language java POST /v3/namespaces/{namespace-id}/preview?mode=info where namespace-id is the name of the namespace mode is a query string parameter which can be one of <info,debug,warn> and it controls the logging level for preview. Response will contain the CDAP generated unique preview-id which can be used further to get the preview data.
To get the status of the preview
Code Block language java GET /v3/namespaces/{namespace-id}/previews/{preview-id}/status where namespace-id is the name of the namespace preview-id is the id of the preview for which status is to be requested
To get the data associated with the preview
Code Block language java GET /v3/namespaces/{namespace-id}/previews/{preview-id}/loggers/{logger-id} where namespace-id is the name of the namespace preview-id is the id of the preview for which data is to be requested stage-id is the unique name used to identify the emitter
Config changes for preview:
Code Block language java Application configuration will have preview related configurations which will be used by CDAP. Currently there are programId and programType configurations which will be used to identify the program to be executed as a part of preview. { "preview": { "programId": "MyProgram", "programType": "workflow" } }