use of com.emc.storageos.db.client.model.uimodels.ExecutionLog in project coprhd-controller by CoprHD.
the class ServiceRunner method dumpOrder.
public static void dumpOrder(Order order) {
print("Order: %s", order.getId());
print(" Status: %s", order.getOrderStatus());
print(" Message: %s", order.getMessage());
CatalogService service = load(order.getCatalogServiceId(), CatalogService.class);
print(" Service: %s (%s)", service.getLabel(), service.getBaseService());
ExecutionState state = load(order.getExecutionStateId(), ExecutionState.class);
print(" Time: %s -> %s (%.1f s)", state.getStartDate(), state.getEndDate(), (state.getEndDate().getTime() - state.getStartDate().getTime()) / 1000.0);
List<ExecutionLog> logs = load(state.getLogIds(), ExecutionLog.class);
Collections.sort(logs, LOG_COMPARATOR);
if (!logs.isEmpty()) {
print(" Logs");
for (ExecutionLog log : logs) {
print(" - %s\t%s\t%s", log.getDate(), log.getLevel(), log.getMessage());
}
}
List<ExecutionTaskLog> taskLogs = load(state.getTaskLogIds(), ExecutionTaskLog.class);
Collections.sort(taskLogs, LOG_COMPARATOR);
if (!taskLogs.isEmpty()) {
print(" Task Logs");
for (ExecutionTaskLog log : taskLogs) {
print(" - %s\t%s\t%s\t%s", log.getDate(), log.getLevel(), log.getMessage(), log.getDetail());
}
}
}
use of com.emc.storageos.db.client.model.uimodels.ExecutionLog in project coprhd-controller by CoprHD.
the class OrderService method getOrderLogs.
/**
* Gets the order logs
*
* @param orderId the URN of an order
* @brief List Order Logs
* @return a list of order logs
* @throws DatabaseException when a DB error occurs
*/
@GET
@Path("/{id}/logs")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public OrderLogList getOrderLogs(@PathParam("id") String orderId) throws DatabaseException {
Order order = queryResource(uri(orderId));
StorageOSUser user = getUserFromContext();
verifyAuthorizedInTenantOrg(uri(order.getTenant()), user);
List<ExecutionLog> executionLogs = orderManager.getOrderExecutionLogs(order);
return toOrderLogList(executionLogs);
}
use of com.emc.storageos.db.client.model.uimodels.ExecutionLog in project coprhd-controller by CoprHD.
the class OrderMapper method toOrderLogList.
public static OrderLogList toOrderLogList(List<ExecutionLog> executionLogs) {
OrderLogList list = new OrderLogList();
for (ExecutionLog executionLog : executionLogs) {
OrderLogRestRep orderLogRestRep = map(executionLog);
list.getOrderLogs().add(orderLogRestRep);
}
return list;
}
use of com.emc.storageos.db.client.model.uimodels.ExecutionLog in project coprhd-controller by CoprHD.
the class ExecutionContext method logMessage.
public void logMessage(LogLevel level, Throwable t, String key, Object... args) {
ExecutionLog log = new ExecutionLog();
log.setDate(new Date());
log.setLevel(level.name());
if (args.length > 0) {
log.setMessage(ExecutionUtils.getMessage(key, args));
} else {
log.setMessage(ExecutionUtils.getMessage(key));
}
if (t != null) {
log.addStackTrace(t);
}
log.setPhase(getExecutionPhaseName());
modelClient.save(log);
executionState.addExecutionLog(log);
modelClient.save(executionState);
}
use of com.emc.storageos.db.client.model.uimodels.ExecutionLog in project coprhd-controller by CoprHD.
the class ExecutionLogTest method create.
protected static ExecutionLog create(String label, String message, LogLevel level) {
ExecutionLog model = new ExecutionLog();
model.setLabel(label);
model.setDate(new Date());
model.setLevel(level.name());
model.setMessage(message);
model.setPhase(ExecutionPhase.EXECUTE.name());
return model;
}
Aggregations