Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAPEDWARF-236 No log lines in log viewer in admin console #245

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -79,6 +79,7 @@ public void setSeverity(String severity) {

public Iterable<RequestLogs> getRequestLogs() {
LogQuery logQuery = new LogQuery();
logQuery.includeAppLogs(true);
if (!isShowAll()) {
logQuery = logQuery.minLogLevel(LogService.LogLevel.valueOf(severity));
}
@@ -122,21 +122,29 @@ public CapedwarfLogQueryResult fetch(CapedwarfLogQuery logQuery) {

@SuppressWarnings("unchecked")
private CapedwarfLogQueryResult fetchCapedwarfRequestLogs(CapedwarfLogQuery logQuery) {
List<CapedwarfRequestLogs> list;
int resultCount;
List<String> requestIds = logQuery.getQuery().getRequestIds();
if (requestIds.isEmpty()) {
CacheQuery cacheQuery = createRequestLogsQuery(logQuery);
List<CapedwarfRequestLogs> list = (List<CapedwarfRequestLogs>) (List) cacheQuery.list();
return new CapedwarfLogQueryResult(list, cacheQuery.getResultSize());
list = (List<CapedwarfRequestLogs>) (List) cacheQuery.list();
resultCount = cacheQuery.getResultSize();
} else {
List<CapedwarfRequestLogs> list = new ArrayList<>(requestIds.size());
list = new ArrayList<>(requestIds.size());
for (String requestId : requestIds) {
CapedwarfRequestLogs requestLogs = (CapedwarfRequestLogs) store.get(requestId);
if (requestLogs != null) {
list.add(requestLogs);
}
}
return new CapedwarfLogQueryResult(list, list.size());
resultCount = list.size();
}
for (int i = 0; i < list.size(); i++) {
CapedwarfRequestLogs capedwarfRequestLogs = list.get(i);
list.set(i, capedwarfRequestLogs.clone());
}

return new CapedwarfLogQueryResult(list, resultCount);
}

private CacheQuery createRequestLogsQuery(CapedwarfLogQuery logQuery) {
@@ -23,7 +23,7 @@
*/
@Indexed
@ProvidedId
public class CapedwarfRequestLogs extends CapedwarfLogElement implements Externalizable {
public class CapedwarfRequestLogs extends CapedwarfLogElement implements Externalizable, Cloneable {
public static final String END_TIME_USEC = "endTimeUsec";
public static final String MAX_LOG_LEVEL = "maxLogLevel";
public static final String FINISHED = "finished";
@@ -171,4 +171,47 @@ private String readUTF(ObjectInput in) throws IOException, ClassNotFoundExceptio
return in.readUTF();
}
}

@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
@Override
public CapedwarfRequestLogs clone() {
try {
CapedwarfRequestLogs clone = (CapedwarfRequestLogs) super.clone();
clone.requestLogs = new RequestLogs();
clone.requestLogs.setAppId(requestLogs.getAppId());
clone.requestLogs.setModuleId(requestLogs.getModuleId());
clone.requestLogs.setVersionId(requestLogs.getVersionId());
clone.requestLogs.setRequestId(requestLogs.getRequestId());
clone.requestLogs.setOffset(requestLogs.getOffset());
clone.requestLogs.setIp(requestLogs.getIp());
clone.requestLogs.setNickname(requestLogs.getNickname());
clone.requestLogs.setStartTimeUsec(requestLogs.getStartTimeUsec());
clone.requestLogs.setEndTimeUsec(requestLogs.getEndTimeUsec());
clone.requestLogs.setLatency(requestLogs.getLatencyUsec());
clone.requestLogs.setMcycles(requestLogs.getMcycles());
clone.requestLogs.setMethod(requestLogs.getMethod());
clone.requestLogs.setResource(requestLogs.getResource());
clone.requestLogs.setHttpVersion(requestLogs.getHttpVersion());
clone.requestLogs.setStatus(requestLogs.getStatus());
clone.requestLogs.setResponseSize(requestLogs.getResponseSize());
clone.requestLogs.setReferrer(requestLogs.getReferrer());
clone.requestLogs.setUserAgent(requestLogs.getUserAgent());
clone.requestLogs.setUrlMapEntry(requestLogs.getUrlMapEntry());
clone.requestLogs.setCombined(requestLogs.getCombined());
clone.requestLogs.setApiMcycles(requestLogs.getApiMcycles());
clone.requestLogs.setHost(requestLogs.getHost());
clone.requestLogs.setCost(requestLogs.getCost());
clone.requestLogs.setTaskQueueName(requestLogs.getTaskQueueName());
clone.requestLogs.setTaskName(requestLogs.getTaskName());
clone.requestLogs.setWasLoadingRequest(requestLogs.isLoadingRequest());
clone.requestLogs.setPendingTime(requestLogs.getPendingTimeUsec());
clone.requestLogs.setReplicaIndex(requestLogs.getReplicaIndex());
clone.requestLogs.setFinished(requestLogs.isFinished());
clone.requestLogs.setInstanceKey(requestLogs.getInstanceKey());
setAppEngineRelease.invokeWithTarget(clone.requestLogs, requestLogs.getAppEngineRelease());
return clone;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.