You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_addIssue( report, "warning", "CACHEBOX_DISABLED", "Cache '#cacheName#' is disabled", "Enable the cache if caching is expected for this region", cacheName, { "enabled" : false } )
Copy file name to clipboardExpand all lines: models/tools/LogBoxTools.bx
+67Lines changed: 67 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -277,6 +277,73 @@ class extends="BaseTool"{
277
277
return results
278
278
}
279
279
280
+
/**
281
+
* Get a health assessment of the LogBox logging infrastructure.
282
+
*
283
+
* Returns a structured health report with status, score, and logger/appender issues.
284
+
*
285
+
* Status indicators:
286
+
* - healthy : All appenders are initialized and logger coverage looks normal
287
+
* - warning : One or more appenders are not initialized or a logger has no appenders
288
+
* - critical : Not used for LogBox health in this report
289
+
*/
290
+
@mcpTool
291
+
@AITool
292
+
function logbox_get_health() {
293
+
var logBox = application.cbController.getLogBox()
294
+
var report = _newHealthReport()
295
+
var loggerRegistry = logBox.getLoggerRegistry()
296
+
var appenderRegistry = logBox.getAppenderRegistry()
297
+
var totalLoggers = loggerRegistry.len()
298
+
var totalAppenders = appenderRegistry.len()
299
+
var initialized = 0
300
+
var uninitialized = 0
301
+
var fileAppenders = 0
302
+
var recentErrors = 0
303
+
304
+
appenderRegistry.each( ( name, appender ) => {
305
+
if ( appender.isInitialized() ) {
306
+
initialized++
307
+
} else {
308
+
uninitialized++
309
+
_addIssue( report, "warning", "LOGBOX_APPENDER_NOT_INITIALIZED", "Appender '#name#' is not initialized", "Verify appender configuration and target path or destination", name )
310
+
}
311
+
312
+
if ( isInstanceOf( appender, "coldbox.system.logging.appenders.FileAppender" ) ) {
313
+
fileAppenders++
314
+
var logFile = appender.getLogFullpath()
315
+
if ( fileExists( logFile ) ) {
316
+
var rawLines = fileRead( logFile ).listToArray( char( 10 ) )
317
+
var startIdx = max( 1, rawLines.len() - 100 + 1 )
318
+
for ( var i = rawLines.len(); i >= startIdx; i-- ) {
_addIssue( report, "warning", "LOGBOX_LOGGER_NO_APPENDERS", "Logger '#category#' has no appenders", "Attach an appender or verify root logger coverage", category )
331
+
} )
332
+
333
+
if ( recentErrors > 0 ) {
334
+
_addIssue( report, "info", "LOGBOX_RECENT_ERRORS", "Detected #recentErrors# recent ERROR/FATAL log entries across file appenders", "Review recent log output for the related appenders or categories" )
335
+
}
336
+
337
+
return _buildHealthReport( report, {
338
+
"totalLoggers" : totalLoggers,
339
+
"totalAppenders" : totalAppenders,
340
+
"initializedAppenders" : initialized,
341
+
"uninitializedAppenders" : uninitialized,
342
+
"fileAppenders" : fileAppenders,
343
+
"recentErrors" : recentErrors
344
+
} )
345
+
}
346
+
280
347
/**
281
348
* Parse a single CSV log line written by FileAppender into a struct.
Copy file name to clipboardExpand all lines: models/tools/SchedulerTools.bx
+63Lines changed: 63 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,69 @@ class extends="BaseTool"{
118
118
return "Task '#arguments.taskName#' in scheduler '#arguments.schedulerName#' has been resumed."
119
119
}
120
120
121
+
/**
122
+
* Get a health assessment of all schedulers and their tasks.
123
+
*
124
+
* Returns a structured health report with status, score, and per-scheduler issues.
125
+
*
126
+
* Status indicators:
127
+
* - healthy : All schedulers started and tasks are active
128
+
* - warning : One or more schedulers are not started or all tasks are paused
129
+
* - critical : Not used for scheduler health in this report
130
+
*/
131
+
@mcpTool
132
+
@AITool
133
+
function scheduler_get_health() {
134
+
var report = _newHealthReport()
135
+
var schedulers = getSchedulerMap()
136
+
var totalTasks = 0
137
+
var activeTasks = 0
138
+
var pausedTasks = 0
139
+
var startedCount = 0
140
+
141
+
schedulers.each( ( key, scheduler ) => {
142
+
var schedName = scheduler.getSchedulerName()
143
+
144
+
if ( scheduler.hasStarted() ) {
145
+
startedCount++
146
+
} else {
147
+
_addIssue( report, "warning", "SCHEDULER_NOT_STARTED", "Scheduler '#schedName#' has not been started", "Start the scheduler during application startup", schedName )
_addIssue( report, "warning", "SCHEDULER_ALL_TASKS_PAUSED", "All #pausedCount# task(s) in scheduler '#schedName#' are paused", "Resume tasks using scheduler_resume_task()", schedName )
169
+
}
170
+
} )
171
+
172
+
var stoppedCount = schedulers.size() - startedCount
Copy file name to clipboardExpand all lines: models/tools/SystemTools.bx
+78Lines changed: 78 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,22 @@
7
7
*/
8
8
class extends="BaseTool"{
9
9
10
+
/**
11
+
* Safely call a subsystem health method and normalize failures into warning issues.
12
+
*
13
+
* @caller The closure that returns a subsystem health report
14
+
* @label The subsystem label used in fallback messages
15
+
*/
16
+
private struct function _safeHealthCall( required any caller, required string label ) {
17
+
try {
18
+
return arguments.caller()
19
+
} catch ( any e ) {
20
+
var report = _newHealthReport()
21
+
_addIssue( report, "warning", "SYSTEM_SUBSYSTEM_ERROR", "Unable to retrieve health for #arguments.label#: #e.message#", "Check runtime logs for errors related to #arguments.label#" )
0 commit comments