8119 |
06 Mar 23 |
nicklas |
1 |
<%@ page pageEncoding="UTF-8" session="false" |
8119 |
06 Mar 23 |
nicklas |
2 |
import="net.sf.basedb.core.SessionControl" |
8119 |
06 Mar 23 |
nicklas |
3 |
import="net.sf.basedb.core.Application" |
8119 |
06 Mar 23 |
nicklas |
4 |
import="net.sf.basedb.core.DbControl" |
8119 |
06 Mar 23 |
nicklas |
5 |
import="net.sf.basedb.core.Permission" |
8119 |
06 Mar 23 |
nicklas |
6 |
import="net.sf.basedb.core.DateUtil" |
8119 |
06 Mar 23 |
nicklas |
7 |
import="net.sf.basedb.util.Values" |
8119 |
06 Mar 23 |
nicklas |
8 |
import="net.sf.basedb.util.error.ThrowableUtil" |
8119 |
06 Mar 23 |
nicklas |
9 |
import="net.sf.basedb.util.extensions.ActionIterator" |
8119 |
06 Mar 23 |
nicklas |
10 |
import="net.sf.basedb.util.extensions.Extension" |
8119 |
06 Mar 23 |
nicklas |
11 |
import="net.sf.basedb.util.extensions.ExtensionsFilter" |
8119 |
06 Mar 23 |
nicklas |
12 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
8119 |
06 Mar 23 |
nicklas |
13 |
import="net.sf.basedb.util.extensions.Registry" |
8119 |
06 Mar 23 |
nicklas |
14 |
import="net.sf.basedb.clients.web.Base" |
8119 |
06 Mar 23 |
nicklas |
15 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
8119 |
06 Mar 23 |
nicklas |
16 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
8119 |
06 Mar 23 |
nicklas |
17 |
import="net.sf.basedb.clients.web.extensions.service.ServiceControllerAction" |
8119 |
06 Mar 23 |
nicklas |
18 |
import="net.sf.basedb.clients.web.extensions.service.Services" |
8125 |
09 Mar 23 |
nicklas |
19 |
import="net.sf.basedb.util.extensions.logging.ExtensionsLog" |
8125 |
09 Mar 23 |
nicklas |
20 |
import="net.sf.basedb.util.extensions.logging.LogEntry" |
8119 |
06 Mar 23 |
nicklas |
21 |
import="net.sf.basedb.clients.web.util.HTML" |
8119 |
06 Mar 23 |
nicklas |
22 |
import="java.util.Date" |
8119 |
06 Mar 23 |
nicklas |
23 |
import="java.util.Iterator" |
8119 |
06 Mar 23 |
nicklas |
24 |
%> |
8119 |
06 Mar 23 |
nicklas |
25 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
8119 |
06 Mar 23 |
nicklas |
26 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
8119 |
06 Mar 23 |
nicklas |
27 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
8119 |
06 Mar 23 |
nicklas |
28 |
<% |
8119 |
06 Mar 23 |
nicklas |
29 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
8119 |
06 Mar 23 |
nicklas |
30 |
final String ID = sc.getId(); |
8119 |
06 Mar 23 |
nicklas |
31 |
final String xtId = Values.getString(request.getParameter("extensionId")); |
8119 |
06 Mar 23 |
nicklas |
32 |
final boolean autoUpdate = Values.getBoolean(request.getParameter("autoUpdate")); |
8160 |
07 Jun 23 |
nicklas |
33 |
Extension<?> ext = ExtensionsControl.get(null).getExtension(xtId); |
8125 |
09 Mar 23 |
nicklas |
34 |
ExtensionsLog serviceLog = ExtensionsLog.getLog(ext.getId(), true); |
8119 |
06 Mar 23 |
nicklas |
35 |
try |
8119 |
06 Mar 23 |
nicklas |
36 |
{ |
8125 |
09 Mar 23 |
nicklas |
37 |
%> |
8119 |
06 Mar 23 |
nicklas |
38 |
<base:page type="popup" title="View log" id="view-page"> |
8128 |
10 Mar 23 |
nicklas |
39 |
<base:head scripts="table.js,~view_log.js" styles="table.css,toolbar.css"> |
8119 |
06 Mar 23 |
nicklas |
40 |
<style> |
8119 |
06 Mar 23 |
nicklas |
41 |
.level |
8119 |
06 Mar 23 |
nicklas |
42 |
{ |
8119 |
06 Mar 23 |
nicklas |
43 |
width: 5em !important; |
8119 |
06 Mar 23 |
nicklas |
44 |
min-width: 5em !important; |
8119 |
06 Mar 23 |
nicklas |
45 |
text-align: right; |
8119 |
06 Mar 23 |
nicklas |
46 |
font-weight: bold; |
8119 |
06 Mar 23 |
nicklas |
47 |
} |
8119 |
06 Mar 23 |
nicklas |
48 |
.level > span |
8119 |
06 Mar 23 |
nicklas |
49 |
{ |
8119 |
06 Mar 23 |
nicklas |
50 |
margin-left: 0.5em; |
8119 |
06 Mar 23 |
nicklas |
51 |
margin-right: 0.25em; |
8119 |
06 Mar 23 |
nicklas |
52 |
} |
8119 |
06 Mar 23 |
nicklas |
53 |
.timestamp |
8119 |
06 Mar 23 |
nicklas |
54 |
{ |
8119 |
06 Mar 23 |
nicklas |
55 |
width: 15em !important; |
8119 |
06 Mar 23 |
nicklas |
56 |
text-align: center !important; |
8119 |
06 Mar 23 |
nicklas |
57 |
} |
8135 |
31 Mar 23 |
nicklas |
58 |
.stacktrace |
8135 |
31 Mar 23 |
nicklas |
59 |
{ |
8135 |
31 Mar 23 |
nicklas |
60 |
white-space: pre-wrap !important; |
8135 |
31 Mar 23 |
nicklas |
61 |
} |
8119 |
06 Mar 23 |
nicklas |
62 |
</style> |
8119 |
06 Mar 23 |
nicklas |
63 |
</base:head> |
8122 |
08 Mar 23 |
nicklas |
64 |
<base:body data-read-only="1"> |
8119 |
06 Mar 23 |
nicklas |
65 |
<h1>Event log - <%=ext.getAbout().getName()%></h1> |
8119 |
06 Mar 23 |
nicklas |
66 |
|
8119 |
06 Mar 23 |
nicklas |
67 |
<div id="page-data" data-extension-id="<%=HTML.encodeTags(xtId)%>"></div> |
8119 |
06 Mar 23 |
nicklas |
68 |
|
8119 |
06 Mar 23 |
nicklas |
69 |
<div class="content"> |
8119 |
06 Mar 23 |
nicklas |
70 |
<tbl:table |
8119 |
06 Mar 23 |
nicklas |
71 |
id="services" |
8119 |
06 Mar 23 |
nicklas |
72 |
subclass="fulltable topborder" |
8119 |
06 Mar 23 |
nicklas |
73 |
columns="all" |
8119 |
06 Mar 23 |
nicklas |
74 |
stickyheaders="<%=null%>" |
8119 |
06 Mar 23 |
nicklas |
75 |
> |
8119 |
06 Mar 23 |
nicklas |
76 |
<tbl:columndef |
8119 |
06 Mar 23 |
nicklas |
77 |
id="level" |
8119 |
06 Mar 23 |
nicklas |
78 |
title="" |
8119 |
06 Mar 23 |
nicklas |
79 |
subclass="level" |
8119 |
06 Mar 23 |
nicklas |
80 |
/> |
8119 |
06 Mar 23 |
nicklas |
81 |
<tbl:columndef |
8119 |
06 Mar 23 |
nicklas |
82 |
id="timestamp" |
8119 |
06 Mar 23 |
nicklas |
83 |
title="Time" |
8119 |
06 Mar 23 |
nicklas |
84 |
subclass="timestamp" |
8119 |
06 Mar 23 |
nicklas |
85 |
/> |
8119 |
06 Mar 23 |
nicklas |
86 |
<tbl:columndef |
8119 |
06 Mar 23 |
nicklas |
87 |
id="message" |
8119 |
06 Mar 23 |
nicklas |
88 |
title="Message" |
8119 |
06 Mar 23 |
nicklas |
89 |
/> |
8120 |
07 Mar 23 |
nicklas |
90 |
<div class="panelgroup bg-filled-50 bottomborder" style="height: 1.9em;"> |
8120 |
07 Mar 23 |
nicklas |
91 |
<tbl:toolbar> |
8120 |
07 Mar 23 |
nicklas |
92 |
<tbl:button |
8129 |
14 Mar 23 |
nicklas |
93 |
id="btnUpdate" |
8129 |
14 Mar 23 |
nicklas |
94 |
title="Update" |
8129 |
14 Mar 23 |
nicklas |
95 |
image="refresh.png" |
8129 |
14 Mar 23 |
nicklas |
96 |
tooltip="Re-load this page" |
8129 |
14 Mar 23 |
nicklas |
97 |
/> |
8129 |
14 Mar 23 |
nicklas |
98 |
<tbl:button |
8120 |
07 Mar 23 |
nicklas |
99 |
id="btnClearLog" |
8120 |
07 Mar 23 |
nicklas |
100 |
title="Clear the log" |
8120 |
07 Mar 23 |
nicklas |
101 |
image="delete.png" |
8129 |
14 Mar 23 |
nicklas |
102 |
tooltip="Delete all entries from the log" |
8120 |
07 Mar 23 |
nicklas |
103 |
/> |
8120 |
07 Mar 23 |
nicklas |
104 |
<tbl:label style="padding-right: 1em;"> |
8123 |
09 Mar 23 |
nicklas |
105 |
<label><input type="checkbox" name="enableDebug" |
8123 |
09 Mar 23 |
nicklas |
106 |
id="enableDebug" <%=serviceLog.isDebugEnabled()?"checked":""%> |
8123 |
09 Mar 23 |
nicklas |
107 |
>Enable debug logging</label> |
8120 |
07 Mar 23 |
nicklas |
108 |
</tbl:label> |
8120 |
07 Mar 23 |
nicklas |
109 |
<tbl:label style="padding-right: 1em;"> |
8123 |
09 Mar 23 |
nicklas |
110 |
<label title="All log entries are copied to the regular log file (including TRACE-level entries)" |
8123 |
09 Mar 23 |
nicklas |
111 |
><input type="checkbox" name="copyToStdout" |
8123 |
09 Mar 23 |
nicklas |
112 |
id="copyToStdout" <%=serviceLog.isCopyingToStdout()?"checked":""%> |
8123 |
09 Mar 23 |
nicklas |
113 |
>Copy to stdout</label> |
8120 |
07 Mar 23 |
nicklas |
114 |
</tbl:label> |
8123 |
09 Mar 23 |
nicklas |
115 |
<tbl:label style="padding-right: 1em;"> |
8123 |
09 Mar 23 |
nicklas |
116 |
<label><input type="checkbox" name="autoUpdate" |
8123 |
09 Mar 23 |
nicklas |
117 |
id="autoUpdate" <%=autoUpdate?"checked":"" %> |
8123 |
09 Mar 23 |
nicklas |
118 |
>Auto update</label> |
8123 |
09 Mar 23 |
nicklas |
119 |
</tbl:label> |
8120 |
07 Mar 23 |
nicklas |
120 |
</tbl:toolbar> |
8119 |
06 Mar 23 |
nicklas |
121 |
</div> |
8119 |
06 Mar 23 |
nicklas |
122 |
<tbl:data style="top: 1.9em; margin-top: 0px;"> |
8119 |
06 Mar 23 |
nicklas |
123 |
<tbl:headers> |
8119 |
06 Mar 23 |
nicklas |
124 |
<tbl:headerrow> |
8119 |
06 Mar 23 |
nicklas |
125 |
<tbl:columnheaders /> |
8119 |
06 Mar 23 |
nicklas |
126 |
</tbl:headerrow> |
8119 |
06 Mar 23 |
nicklas |
127 |
</tbl:headers> |
8119 |
06 Mar 23 |
nicklas |
128 |
<tbl:rows> |
8119 |
06 Mar 23 |
nicklas |
129 |
<% |
8119 |
06 Mar 23 |
nicklas |
130 |
Iterator<LogEntry> it = serviceLog.getLogEntries(); |
8119 |
06 Mar 23 |
nicklas |
131 |
int entryNo = 0; |
8119 |
06 Mar 23 |
nicklas |
132 |
while (it.hasNext()) |
8119 |
06 Mar 23 |
nicklas |
133 |
{ |
8119 |
06 Mar 23 |
nicklas |
134 |
entryNo++; |
8119 |
06 Mar 23 |
nicklas |
135 |
LogEntry e = it.next(); |
8122 |
08 Mar 23 |
nicklas |
136 |
Throwable stacktrace = e.getStacktrace(); |
8119 |
06 Mar 23 |
nicklas |
137 |
%> |
8119 |
06 Mar 23 |
nicklas |
138 |
<tbl:row> |
8119 |
06 Mar 23 |
nicklas |
139 |
<tbl:cell column="level" subclass="level"><%=entryNo%><base:icon image="<%=e.getLevel().getIcon()%>"/></tbl:cell> |
8119 |
06 Mar 23 |
nicklas |
140 |
<tbl:cell column="timestamp" subclass="timestamp"><%=DateUtil.formatTimestamp(e.getDate()) %></tbl:cell> |
8122 |
08 Mar 23 |
nicklas |
141 |
<tbl:cell column="message"><%=HTML.encodeTags(e.getMessage()) %> |
8122 |
08 Mar 23 |
nicklas |
142 |
<% |
8122 |
08 Mar 23 |
nicklas |
143 |
if (stacktrace != null) |
8122 |
08 Mar 23 |
nicklas |
144 |
{ |
8122 |
08 Mar 23 |
nicklas |
145 |
%> |
8122 |
08 Mar 23 |
nicklas |
146 |
<base:icon |
8122 |
08 Mar 23 |
nicklas |
147 |
id="<%="toggle-stacktrace."+entryNo%>" subclass="auto-init" |
8122 |
08 Mar 23 |
nicklas |
148 |
data-auto-init="toggle-stacktrace" |
8122 |
08 Mar 23 |
nicklas |
149 |
data-extension-id="<%=entryNo%>" |
8122 |
08 Mar 23 |
nicklas |
150 |
tooltip="Click to show full stacktrace" |
8122 |
08 Mar 23 |
nicklas |
151 |
image="gonext.png" |
8122 |
08 Mar 23 |
nicklas |
152 |
/> |
8122 |
08 Mar 23 |
nicklas |
153 |
<div id="stacktrace.<%=entryNo%>" |
8122 |
08 Mar 23 |
nicklas |
154 |
class="stacktrace messagecontainer error" |
8122 |
08 Mar 23 |
nicklas |
155 |
style="display: none;" |
8122 |
08 Mar 23 |
nicklas |
156 |
><%=ThrowableUtil.stackTraceToString(stacktrace)%></div> |
8122 |
08 Mar 23 |
nicklas |
157 |
<% |
8122 |
08 Mar 23 |
nicklas |
158 |
} |
8122 |
08 Mar 23 |
nicklas |
159 |
%> |
8122 |
08 Mar 23 |
nicklas |
160 |
</tbl:cell> |
8119 |
06 Mar 23 |
nicklas |
161 |
</tbl:row> |
8119 |
06 Mar 23 |
nicklas |
162 |
<% |
8119 |
06 Mar 23 |
nicklas |
163 |
} |
8129 |
14 Mar 23 |
nicklas |
164 |
if (entryNo == 0) |
8129 |
14 Mar 23 |
nicklas |
165 |
{ |
8129 |
14 Mar 23 |
nicklas |
166 |
%> |
8129 |
14 Mar 23 |
nicklas |
167 |
<tbl:panel subclass="bg-filled-50"> |
8129 |
14 Mar 23 |
nicklas |
168 |
<div class="messagecontainer note"> |
8129 |
14 Mar 23 |
nicklas |
169 |
No entries in this log. |
8129 |
14 Mar 23 |
nicklas |
170 |
</div> |
8129 |
14 Mar 23 |
nicklas |
171 |
</tbl:panel> |
8129 |
14 Mar 23 |
nicklas |
172 |
<% |
8129 |
14 Mar 23 |
nicklas |
173 |
} |
8119 |
06 Mar 23 |
nicklas |
174 |
%> |
8119 |
06 Mar 23 |
nicklas |
175 |
</tbl:rows> |
8119 |
06 Mar 23 |
nicklas |
176 |
</tbl:data> |
8119 |
06 Mar 23 |
nicklas |
177 |
</tbl:table> |
8119 |
06 Mar 23 |
nicklas |
178 |
</div> |
8119 |
06 Mar 23 |
nicklas |
179 |
<base:buttongroup subclass="dialogbuttons"> |
8119 |
06 Mar 23 |
nicklas |
180 |
<base:button id="close" title="Close" /> |
8119 |
06 Mar 23 |
nicklas |
181 |
</base:buttongroup> |
8119 |
06 Mar 23 |
nicklas |
182 |
</base:body> |
8119 |
06 Mar 23 |
nicklas |
183 |
</base:page> |
8119 |
06 Mar 23 |
nicklas |
184 |
<% |
8119 |
06 Mar 23 |
nicklas |
185 |
} |
8119 |
06 Mar 23 |
nicklas |
186 |
finally |
8119 |
06 Mar 23 |
nicklas |
187 |
{ |
8119 |
06 Mar 23 |
nicklas |
188 |
|
8119 |
06 Mar 23 |
nicklas |
189 |
} |
8119 |
06 Mar 23 |
nicklas |
190 |
%> |