web.log-view.index_old.jsp Maven / Gradle / Ivy
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
<%@ page import="org.wso2.carbon.logging.view.ui.LogViewerClient" %>
<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@ page import="org.wso2.carbon.CarbonConstants" %>
<%@ page import="org.wso2.carbon.logging.view.ui.LogViewerStub.LogMessage" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
<%
String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
ConfigurationContext configContext =
(ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
LogViewerClient logViewerClient;
String type;
String keyword;
String action;
LogMessage[] logMessages;
try {
logViewerClient = new LogViewerClient(cookie, backendServerURL, configContext);
type = request.getParameter("type");
keyword = request.getParameter("keyword");
action = request.getParameter("action");
if (action != null && action.equals("clear-logs")) {
logViewerClient.clearLogs();
}
logMessages = logViewerClient.getLogs(type, keyword);
} catch (Exception e) {
CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request, e);
%>
<%
return;
}
%>
<%
int index = -1;
for (LogMessage logMessage : logMessages) {
++index;
if (index % 2 != 0) {
%>
<%
} else {
%>
<%
}
String logLevel = logMessage.getType();
if (logLevel == null || logLevel.equals("")) {
%>
<%
} else {
%>
<%
}
%>
<%
if(logMessage.getLogMessage().equalsIgnoreCase("NO_LOGS")) {
%>
<%
} else {
%>
<%=logMessage.getLogMessage()%>
<% } %>
<%
}
%>
?');return false;"
value=" " class="button"
name="clearLogs" type="button">