Skip to content

Commit 44117d3

Browse files
committed
System Touch
1 parent 4d8cd3a commit 44117d3

1 file changed

Lines changed: 30 additions & 8 deletions

File tree

source/commons/CommonRails.java

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,29 @@ public static void printSystemComponent(Object object, Integer hashcode, String
8080

8181
String date = "[Date: "+formatter.format(new Date())+"]";
8282

83-
String reference = object_id + " " + date + " " + classnamePadded + " " + line;
83+
// Uppercase the first alphanumeric token in the provided line (the fourth printed field)
84+
String lineFixed = line;
85+
if (lineFixed != null && lineFixed.length() > 0)
86+
{
87+
int i = 0;
88+
// skip non-alphanumeric leading characters (punctuation, spaces)
89+
while (i < lineFixed.length() && !Character.isLetterOrDigit(lineFixed.charAt(i))) i++;
90+
91+
int start = i;
92+
while (i < lineFixed.length() && (Character.isLetterOrDigit(lineFixed.charAt(i)) || lineFixed.charAt(i) == '_')) i++;
93+
94+
if (start < i)
95+
{
96+
String token = lineFixed.substring(start, i);
97+
98+
// Replace token with fully uppercased form
99+
String upper = token.toUpperCase();
100+
101+
lineFixed = lineFixed.substring(0, start) + upper + lineFixed.substring(i);
102+
}
103+
}
104+
105+
String reference = object_id + " " + date + " " + classnamePadded + " " + lineFixed;
84106

85107
// Record reference order for startup ordering backend (best-effort)
86108
try
@@ -220,18 +242,18 @@ public static synchronized void registerProcess(ProcessBuilder pb, Process proce
220242

221243
try
222244
{
223-
CommonRails.printSystemComponent(printer, process.hashCode(), ". CommonRails registerProcess >> registered process: " + process);
245+
CommonRails.printSystemComponent(printer, process.hashCode(), ". CommonRails registerProcess >> registered process: " + process + " . ");
224246

225247
// Attach onExit listener
226248
process.onExit().thenAccept(p -> {
227249
try
228250
{
229-
CommonRails.printSystemComponent(printer, p.hashCode(), ". CommonRails processExited >> process closed: " + p + " exit=" + p.exitValue());
251+
CommonRails.printSystemComponent(printer, p.hashCode(), ". CommonRails processExited >> process closed: " + p + " exit=" + p.exitValue() + " . ");
230252
}
231253
catch (Throwable t)
232254
{
233255
// Best-effort printing
234-
CommonRails.printSystemComponent(printer, p.hashCode(), ". CommonRails processExited >> process closed: " + p);
256+
CommonRails.printSystemComponent(printer, p.hashCode(), ". CommonRails processExited >> process closed: " + p + " . ");
235257
}
236258
finally
237259
{
@@ -245,7 +267,7 @@ public static synchronized void registerProcess(ProcessBuilder pb, Process proce
245267
{
246268
if (!process.waitFor(2, TimeUnit.HOURS))
247269
{
248-
CommonRails.printSystemComponent(printer, process.hashCode(), ". CommonRails process timeout (2 hours) exceeded; destroying: " + process);
270+
CommonRails.printSystemComponent(printer, process.hashCode(), ". CommonRails process timeout (2 hours) exceeded; destroying: " + process + " . ");
249271

250272
try { process.destroyForcibly(); } catch (Throwable ignored) {}
251273
}
@@ -268,11 +290,11 @@ public static synchronized void registerProcess(ProcessBuilder pb, Process proce
268290
{
269291
int rv = process.exitValue();
270292

271-
CommonRails.printSystemComponent(printer, process.hashCode(), ". CommonRails processExited(watcher) >> process closed: " + process + " exit=" + rv);
293+
CommonRails.printSystemComponent(printer, process.hashCode(), ". CommonRails processExited(watcher) >> process closed: " + process + " exit=" + rv + " . ");
272294
}
273295
else
274296
{
275-
CommonRails.printSystemComponent(printer, process.hashCode(), ". CommonRails process watcher timeout (2 hours) exceeded; destroying: " + process);
297+
CommonRails.printSystemComponent(printer, process.hashCode(), ". CommonRails process watcher timeout (2 hours) exceeded; destroying: " + process + " . ");
276298

277299
try { process.destroyForcibly(); } catch (Throwable ignored) {}
278300
}
@@ -316,7 +338,7 @@ public void run()
316338
{
317339
int return_value = p.exitValue();
318340

319-
CommonRails.printSystemComponent(this, p.hashCode(), ". TelnetCallOnComplete >> process exited: " + p + " exit=" + return_value);
341+
CommonRails.printSystemComponent(this, p.hashCode(), ". TelnetCallOnComplete >> process exited: " + p + " exit=" + return_value + " . ");
320342
}
321343
else
322344
{

0 commit comments

Comments
 (0)