Search in sources :

Example 1 with ExecutionLog

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());
        }
    }
}
Also used : ExecutionState(com.emc.storageos.db.client.model.uimodels.ExecutionState) ExecutionLog(com.emc.storageos.db.client.model.uimodels.ExecutionLog) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog)

Example 2 with ExecutionLog

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);
}
Also used : Order(com.emc.storageos.db.client.model.uimodels.Order) ExecutionLog(com.emc.storageos.db.client.model.uimodels.ExecutionLog) StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 3 with ExecutionLog

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;
}
Also used : ExecutionLog(com.emc.storageos.db.client.model.uimodels.ExecutionLog) OrderLogList(com.emc.vipr.model.catalog.OrderLogList) OrderLogRestRep(com.emc.vipr.model.catalog.OrderLogRestRep)

Example 4 with ExecutionLog

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);
}
Also used : ExecutionLog(com.emc.storageos.db.client.model.uimodels.ExecutionLog) Date(java.util.Date)

Example 5 with ExecutionLog

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;
}
Also used : ExecutionLog(com.emc.storageos.db.client.model.uimodels.ExecutionLog) Date(java.util.Date)

Aggregations

ExecutionLog (com.emc.storageos.db.client.model.uimodels.ExecutionLog)9 Date (java.util.Date)4 ExecutionState (com.emc.storageos.db.client.model.uimodels.ExecutionState)3 BaseModelTest (com.emc.sa.model.BaseModelTest)2 ExecutionTaskLog (com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog)2 Order (com.emc.storageos.db.client.model.uimodels.Order)2 Test (org.junit.Test)2 ModelClient (com.emc.sa.model.dao.ModelClient)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)1 OrderParameter (com.emc.storageos.db.client.model.uimodels.OrderParameter)1 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)1 OrderLogList (com.emc.vipr.model.catalog.OrderLogList)1 OrderLogRestRep (com.emc.vipr.model.catalog.OrderLogRestRep)1 URI (java.net.URI)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1