Skip to content

Commit 27378ef

Browse files
committed
Enhance logging UI and increase Solr timeouts
Added clusterNode display to logging pages and model, and improved message/stack trace formatting for better readability. Increased Solr HTTP client timeouts to 60 seconds. Improved URI parameter handling and encoding in TurCommonsUtils.
1 parent 1eb20dd commit 27378ef

File tree

5 files changed

+29
-23
lines changed

5 files changed

+29
-23
lines changed

turing-app/src/main/java/com/viglet/turing/solr/TurSolrConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public CloseableHttpClient closeableHttpClient() {
4545
cm.setDefaultMaxPerRoute(10000);
4646
cm.setValidateAfterInactivity(3000);
4747

48-
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom().setConnectTimeout(30000)
49-
.setSocketTimeout(30000);
48+
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom().setConnectTimeout(60000)
49+
.setSocketTimeout(60000);
5050

5151
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create().setKeepAliveStrategy((response, context) -> -1)
5252
.evictIdleConnections(50000, TimeUnit.MILLISECONDS)

turing-commons/src/main/java/com/viglet/turing/commons/utils/TurCommonsUtils.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,21 @@ public static boolean isValidUrl(URL url) {
8383
return false;
8484
}
8585
}
86+
8687
public static String html2Text(String text) {
8788
return Jsoup.parse(text).text();
8889
}
8990

9091
public static String text2Description(String text, int maxLength) {
91-
if(text != null && text.length() > maxLength) {
92+
if (text != null && text.length() > maxLength) {
9293
BreakIterator bi = BreakIterator.getWordInstance();
9394
bi.setText(text);
9495

95-
if(bi.isBoundary(maxLength-1)) {
96-
return text.substring(0, maxLength-2) + " ...";
96+
if (bi.isBoundary(maxLength - 1)) {
97+
return text.substring(0, maxLength - 2) + " ...";
9798
} else {
98-
int preceding = bi.preceding(maxLength-1);
99-
return text.substring(0, preceding-1) + " ...";
99+
int preceding = bi.preceding(maxLength - 1);
100+
return text.substring(0, preceding - 1) + " ...";
100101
}
101102
} else {
102103
return text + " ...";
@@ -107,9 +108,10 @@ public static String html2Description(String text, int numberChars) {
107108
return text2Description(html2Text(text), numberChars);
108109
}
109110

110-
public static URI addOrReplaceParameter(URI uri, String paramName, Locale locale, boolean decoded) {
111-
return addOrReplaceParameter(uri, paramName, locale.toLanguageTag(), decoded);
111+
public static URI addOrReplaceParameter(URI uri, String paramName, Locale locale, boolean decoded) {
112+
return addOrReplaceParameter(uri, paramName, locale.toLanguageTag(), decoded);
112113
}
114+
113115
public static URI addOrReplaceParameter(URI uri, String paramName, String paramValue, boolean decoded) {
114116
List<NameValuePair> params = new URIBuilder(uri, StandardCharsets.ISO_8859_1).getQueryParams();
115117
StringBuilder sbQueryString = new StringBuilder();
@@ -120,7 +122,7 @@ public static URI addOrReplaceParameter(URI uri, String paramName, String paramV
120122
addParameterToQueryString(sbQueryString, nameValuePair.getName(), paramValue);
121123
} else {
122124
addParameterToQueryString(sbQueryString, nameValuePair.getName(),
123-
decoded? URLDecoder.decode(nameValuePair.getValue(), StandardCharsets.UTF_8):
125+
decoded ? URLDecoder.decode(nameValuePair.getValue(), StandardCharsets.UTF_8) :
124126
nameValuePair.getValue());
125127
}
126128
}
@@ -139,7 +141,10 @@ public static void addParameterToQueryString(StringBuilder sbQueryString, String
139141

140142
public static URI modifiedURI(URI uri, StringBuilder sbQueryString) {
141143
try {
142-
return new URI(uri.getRawPath() + "?" + removeAmpersand(sbQueryString).replaceAll("[\\t\\n\\r]+","%20").replace(" ", "%20"));
144+
return new URI(uri.getRawPath() + "?" + removeAmpersand(sbQueryString)
145+
.replaceAll("[\\t\\n\\r]+", "%20")
146+
.replace(" ", "%20")
147+
.replace("\"", "%22"));
143148
} catch (URISyntaxException e) {
144149
log.error(e.getMessage(), e);
145150
}

turing-ui/projects/console/src/logging/component/aem/logging-aem-page.component.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
<div class="d-table-cell col-1" style="width: 200px;text-wrap: nowrap;">
66
<div>{{ aem.date | amTimeAgo }}</div>
77
</div>
8+
<div class="d-table-cell col-1" style="width: 100px;">
9+
<div>{{ aem.clusterNode }}</div>
10+
</div>
811
<div class="d-table-cell col-1" style="width: 100px;">
912
<div>{{ aem.level }}</div>
1013
</div>
1114
<div class="d-table-cell col-3">
1215
<div style=" overflow-wrap: break-word;width: 300px;">{{ aem.logger }}</div>
1316
</div>
14-
<div class="d-table-cell col-4">
15-
<pre style="overflow-wrap: break-word;max-width: 200px">
16-
{{ aem.message }}</pre>
17-
</div>
18-
<div class="d-table-cell col-3">
19-
<pre style="overflow-wrap: break-word;max-width: 200px">
17+
<div class="d-table-cell col-6">
18+
<pre style="overflow-wrap: break-word;max-width: 600px">
19+
{{ aem.message }}
2020
{{ aem.stackTrace }}</pre>
2121
</div>
2222
</div>

turing-ui/projects/console/src/logging/component/server/logging-server-page.component.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
<div class="d-table-cell col-1" style="width: 200px;text-wrap: nowrap;">
66
<div>{{ server.date | amTimeAgo }}</div>
77
</div>
8+
<div class="d-table-cell col-1" style="width: 100px;">
9+
<div>{{ server.clusterNode }}</div>
10+
</div>
811
<div class="d-table-cell col-1" style="width: 100px;">
912
<div>{{ server.level }}</div>
1013
</div>
1114
<div class="d-table-cell col-3">
1215
<div style=" overflow-wrap: break-word;width: 300px;">{{ server.logger }}</div>
1316
</div>
14-
<div class="d-table-cell col-4">
15-
<pre style="overflow-wrap: break-word;max-width: 200px">
16-
{{ server.message }}</pre>
17-
</div>
18-
<div class="d-table-cell col-3">
19-
<pre style="overflow-wrap: break-word;max-width: 200px">
17+
<div class="d-table-cell col-6">
18+
<pre style="overflow-wrap: break-word;max-width: 600px">
19+
{{ server.message }}
2020
{{ server.stackTrace }}</pre>
2121
</div>
2222
</div>

turing-ui/projects/console/src/logging/model/logging-general.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export class TurLoggingGeneral {
22
date!: Date;
3+
clusterNode!: string;
34
level!: string;
45
logger!: string;
56
message!: string;

0 commit comments

Comments
 (0)