use of com.emc.vipr.model.sys.logging.LogMessage in project coprhd-controller by CoprHD.
the class TaskLogsDataTable method fetch.
public static List<Log> fetch(URI taskId) {
if (taskId == null) {
return Collections.EMPTY_LIST;
}
List<LogMessage> logMessages = TaskUtils.getTaskLogs(taskId);
List<Log> logs = Lists.newArrayList();
if (logMessages != null) {
for (LogMessage logMessage : logMessages) {
logs.add(new Log(logMessage));
}
}
return logs;
}
use of com.emc.vipr.model.sys.logging.LogMessage in project coprhd-controller by CoprHD.
the class Logs method getAsItems.
/**
* @deprecated Replaced by
* @see #getAsItems(ItemProcessor, Collection, Collection, Collection, Integer, String, String, String, Integer)
*/
@Deprecated
public void getAsItems(ItemProcessor<LogMessage> processor, Collection<String> nodeIds, Collection<String> logNames, Integer severity, String start, String end, String regex, Integer maxCount) {
ListProcessor<LogMessage> listProcessor = new ListProcessor<LogMessage>(LogMessage.class, processor);
InputStream in = getAsStream(nodeIds, logNames, severity, start, end, regex, maxCount);
try {
listProcessor.process(in);
} catch (Exception e) {
throw new ViPRException(e);
} finally {
try {
in.close();
} catch (IOException e) {
// Silently ignore
}
}
}
use of com.emc.vipr.model.sys.logging.LogMessage in project coprhd-controller by CoprHD.
the class TaskUtils method getTaskLogs.
public static List<LogMessage> getTaskLogs(TaskResourceRep task) {
if (task == null) {
return null;
}
ViPRSystemClient systemClient = BourneUtil.getSysClient();
List<String> nodeIds = Lists.newArrayList();
List<NodeHealth> nodeHealthList = systemClient.health().getHealth().getNodeHealthList();
if (nodeHealthList != null) {
for (NodeHealth nodeHealth : nodeHealthList) {
if (nodeHealth != null) {
nodeIds.add(nodeHealth.getNodeId());
}
}
}
String start = null;
if (task.getStartTime() != null) {
start = Long.toString(task.getStartTime().getTimeInMillis());
}
String end = null;
if (task.getEndTime() != null) {
end = Long.toString(task.getEndTime().getTimeInMillis());
}
String regex = "(?i).*" + task.getOpId() + ".*";
final List<LogMessage> logMessages = Lists.newArrayList();
LogMessageProcessor processor = new LogMessageProcessor() {
@Override
public void processItem(LogMessage logMessage) throws Exception {
logMessages.add(logMessage);
}
};
systemClient.logs().getAsItems(processor, nodeIds, null, LOG_NAMES, LOG_SEVERITY, start, end, regex, LOGS_MAX_COUNT);
return logMessages;
}
Aggregations