use of co.cask.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class MapReduceClassLoader method getTaskContextProvider.
/**
* Returns the {@link MapReduceTaskContextProvider} associated with this ClassLoader.
*/
public MapReduceTaskContextProvider getTaskContextProvider() {
// Logging context needs to be set in main thread.
LoggingContext loggingContext = createMapReduceLoggingContext();
LoggingContextAccessor.setLoggingContext(loggingContext);
synchronized (this) {
taskContextProvider = Optional.fromNullable(taskContextProvider).or(taskContextProviderSupplier);
}
taskContextProvider.startAndWait();
return taskContextProvider;
}
use of co.cask.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHandler method getRunIdLogs.
@GET
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/runs/{run-id}/logs")
public void getRunIdLogs(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId, @PathParam("run-id") String runId, @QueryParam("start") @DefaultValue("-1") long fromTimeSecsParam, @QueryParam("stop") @DefaultValue("-1") long toTimeSecsParam, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr, @QueryParam("format") @DefaultValue("text") String format, @QueryParam("suppress") List<String> suppress) throws NotFoundException {
ProgramType type = ProgramType.valueOfCategoryName(programType);
RunRecordMeta runRecord = getRunRecordMeta(namespaceId, appId, type, programId, runId);
LoggingContext loggingContext = LoggingContextHelper.getLoggingContextWithRunId(namespaceId, appId, programId, type, runId, runRecord.getSystemArgs());
doGetLogs(responder, loggingContext, fromTimeSecsParam, toTimeSecsParam, escape, filterStr, runRecord, format, suppress);
}
use of co.cask.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHandler method prev.
@GET
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/logs/prev")
public void prev(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId, @QueryParam("max") @DefaultValue("50") int maxEvents, @QueryParam("fromOffset") @DefaultValue("") String fromOffsetStr, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr) {
LoggingContext loggingContext = LoggingContextHelper.getLoggingContext(namespaceId, appId, programId, ProgramType.valueOfCategoryName(programType));
doPrev(responder, loggingContext, maxEvents, fromOffsetStr, escape, filterStr, null, "text", ImmutableList.<String>of());
}
use of co.cask.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHandler method sysNext.
@GET
@Path("/system/{component-id}/{service-id}/logs/next")
public void sysNext(HttpRequest request, HttpResponder responder, @PathParam("component-id") String componentId, @PathParam("service-id") String serviceId, @QueryParam("max") @DefaultValue("50") int maxEvents, @QueryParam("fromOffset") @DefaultValue("") String fromOffsetStr, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr, @QueryParam("format") @DefaultValue("text") String format, @QueryParam("suppress") List<String> suppress) {
LoggingContext loggingContext = LoggingContextHelper.getLoggingContext(Id.Namespace.SYSTEM.getId(), componentId, serviceId);
doNext(responder, loggingContext, maxEvents, fromOffsetStr, escape, filterStr, null, format, suppress);
}
use of co.cask.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHandler method getLogs.
@GET
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/logs")
public void getLogs(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId, @QueryParam("start") @DefaultValue("-1") long fromTimeSecsParam, @QueryParam("stop") @DefaultValue("-1") long toTimeSecsParam, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr) {
LoggingContext loggingContext = LoggingContextHelper.getLoggingContext(namespaceId, appId, programId, ProgramType.valueOfCategoryName(programType));
doGetLogs(responder, loggingContext, fromTimeSecsParam, toTimeSecsParam, escape, filterStr, null, "text", ImmutableList.<String>of());
}
Aggregations