e7915561 by Ean Schuessler

Reduce logging noise in MCP services - shift busy debug logs from info to debug level

- Move list#Tools recursive screen processing logs to debug level
- Move ResourcesList entity discovery logs to debug level
- Keep high-level summary logs at info level for operational visibility
- Significantly reduces log noise during normal MCP operations
1 parent 93d60083
...@@ -383,7 +383,7 @@ ...@@ -383,7 +383,7 @@
383 // Use curated list of commonly used entities instead of discovering all entities 383 // Use curated list of commonly used entities instead of discovering all entities
384 def availableResources = [] 384 def availableResources = []
385 385
386 ec.logger.info("MCP ResourcesList: Starting permissions-based entity discovery ${userGroups}") 386 ec.logger.debug("MCP ResourcesList: Starting permissions-based entity discovery ${userGroups}")
387 387
388 // Get user's accessible entities using Moqui's optimized ArtifactAuthzCheckView 388 // Get user's accessible entities using Moqui's optimized ArtifactAuthzCheckView
389 def userAccessibleEntities = null as Set<String> 389 def userAccessibleEntities = null as Set<String>
...@@ -431,7 +431,7 @@ ...@@ -431,7 +431,7 @@
431 description = "Moqui ViewEntity: ${entityName} (pre-joined data for LLM convenience)" 431 description = "Moqui ViewEntity: ${entityName} (pre-joined data for LLM convenience)"
432 } 432 }
433 433
434 ec.logger.info("MCP ResourcesList: Adding entity: ${entityName}") 434 ec.logger.debug("MCP ResourcesList: Adding entity: ${entityName}")
435 availableResources << [ 435 availableResources << [
436 uri: "entity://${entityName}", 436 uri: "entity://${entityName}",
437 name: entityName, 437 name: entityName,
...@@ -1398,7 +1398,7 @@ def startTime = System.currentTimeMillis() ...@@ -1398,7 +1398,7 @@ def startTime = System.currentTimeMillis()
1398 // Helper function to recursively process screens and create tools 1398 // Helper function to recursively process screens and create tools
1399 def processScreenWithSubscreens 1399 def processScreenWithSubscreens
1400 processScreenWithSubscreens = { screenPath, parentScreenPath = null, processedScreens = null, toolsAccumulator = null, parentToolName = null, level = 1 -> 1400 processScreenWithSubscreens = { screenPath, parentScreenPath = null, processedScreens = null, toolsAccumulator = null, parentToolName = null, level = 1 ->
1401 ec.logger.info("list#Tools: Processing screen ${screenPath} (parent: ${parentScreenPath}, parentToolName: ${parentToolName}, level: ${level})") 1401 ec.logger.debug("list#Tools: Processing screen ${screenPath} (parent: ${parentScreenPath}, parentToolName: ${parentToolName}, level: ${level})")
1402 1402
1403 // Initialize processedScreens and toolsAccumulator if null 1403 // Initialize processedScreens and toolsAccumulator if null
1404 if (processedScreens == null) processedScreens = [] as Set<String> 1404 if (processedScreens == null) processedScreens = [] as Set<String>
...@@ -1408,7 +1408,7 @@ def startTime = System.currentTimeMillis() ...@@ -1408,7 +1408,7 @@ def startTime = System.currentTimeMillis()
1408 def accessPathKey = screenPath + "|" + (parentScreenPath ?: "ROOT") 1408 def accessPathKey = screenPath + "|" + (parentScreenPath ?: "ROOT")
1409 1409
1410 if (processedScreens.contains(accessPathKey)) { 1410 if (processedScreens.contains(accessPathKey)) {
1411 ec.logger.info("list#Tools: Already processed ${screenPath} from parent ${parentScreenPath}, skipping") 1411 ec.logger.debug("list#Tools: Already processed ${screenPath} from parent ${parentScreenPath}, skipping")
1412 return 1412 return
1413 } 1413 }
1414 1414
...@@ -1417,7 +1417,7 @@ def startTime = System.currentTimeMillis() ...@@ -1417,7 +1417,7 @@ def startTime = System.currentTimeMillis()
1417 try { 1417 try {
1418 // Skip problematic patterns early 1418 // Skip problematic patterns early
1419 if (screenPath.contains("/error/") || screenPath.contains("/system/")) { 1419 if (screenPath.contains("/error/") || screenPath.contains("/system/")) {
1420 ec.logger.info("list#Tools: Skipping system screen ${screenPath}") 1420 ec.logger.debug("list#Tools: Skipping system screen ${screenPath}")
1421 return 1421 return
1422 } 1422 }
1423 1423
...@@ -1481,13 +1481,13 @@ def startTime = System.currentTimeMillis() ...@@ -1481,13 +1481,13 @@ def startTime = System.currentTimeMillis()
1481 // Replace last dot with underscore and append new subscreen name 1481 // Replace last dot with underscore and append new subscreen name
1482 toolName = parentToolName + "_" + subscreenName // .replaceAll('\\.[^.]*$', '_' + subscreenName) 1482 toolName = parentToolName + "_" + subscreenName // .replaceAll('\\.[^.]*$', '_' + subscreenName)
1483 } 1483 }
1484 ec.logger.info("list#Tools: Creating subscreen tool ${toolName} for ${screenPath} (parentToolName: ${parentToolName}, level: ${level})") 1484 ec.logger.debug("list#Tools: Creating subscreen tool ${toolName} for ${screenPath} (parentToolName: ${parentToolName}, level: ${level})")
1485 } else if (isSubscreen && parentScreenPath) { 1485 } else if (isSubscreen && parentScreenPath) {
1486 toolName = parentToolName + screenPathToToolNameWithSubscreens(screenPath, parentScreenPath) 1486 toolName = parentToolName + screenPathToToolNameWithSubscreens(screenPath, parentScreenPath)
1487 ec.logger.info("list#Tools: Creating subscreen tool ${toolName} for ${screenPath} (parent: ${parentScreenPath})") 1487 ec.logger.debug("list#Tools: Creating subscreen tool ${toolName} for ${screenPath} (parent: ${parentScreenPath})")
1488 } else { 1488 } else {
1489 toolName = parentToolName + screenPathToToolName(screenPath) 1489 toolName = parentToolName + screenPathToToolName(screenPath)
1490 ec.logger.info("list#Tools: Creating main screen tool ${toolName} for ${screenPath}") 1490 ec.logger.debug("list#Tools: Creating main screen tool ${toolName} for ${screenPath}")
1491 } 1491 }
1492 1492
1493 def tool = [ 1493 def tool = [
...@@ -1501,7 +1501,7 @@ def startTime = System.currentTimeMillis() ...@@ -1501,7 +1501,7 @@ def startTime = System.currentTimeMillis()
1501 ] 1501 ]
1502 ] 1502 ]
1503 1503
1504 ec.logger.info("list#Tools: Adding accessible screen tool ${toolName} for ${screenPath}") 1504 ec.logger.debug("list#Tools: Adding accessible screen tool ${toolName} for ${screenPath}")
1505 toolsAccumulator << tool 1505 toolsAccumulator << tool
1506 1506
1507 // Recursively process subscreens 1507 // Recursively process subscreens
...@@ -1509,11 +1509,11 @@ def startTime = System.currentTimeMillis() ...@@ -1509,11 +1509,11 @@ def startTime = System.currentTimeMillis()
1509 def screenInfoList = ec.screen.getScreenInfoList(screenPath, 1) 1509 def screenInfoList = ec.screen.getScreenInfoList(screenPath, 1)
1510 def screenInfo = screenInfoList?.first() 1510 def screenInfo = screenInfoList?.first()
1511 if (screenInfo?.subscreenInfoByName) { 1511 if (screenInfo?.subscreenInfoByName) {
1512 ec.logger.info("list#Tools: Found ${screenInfo.subscreenInfoByName.size()} subscreens for ${screenPath}: ${screenInfo.subscreenInfoByName.keySet()}") 1512 ec.logger.debug("list#Tools: Found ${screenInfo.subscreenInfoByName.size()} subscreens for ${screenPath}: ${screenInfo.subscreenInfoByName.keySet()}")
1513 for (subScreenEntry in screenInfo.subscreenInfoByName) { 1513 for (subScreenEntry in screenInfo.subscreenInfoByName) {
1514 def subScreenInfo = subScreenEntry.value 1514 def subScreenInfo = subScreenEntry.value
1515 def subScreenPathList = subScreenInfo?.screenPath 1515 def subScreenPathList = subScreenInfo?.screenPath
1516 ec.logger.info("list#Tools: Processing subscreen ${subScreenEntry.key}, subScreenInfo.screenPath: ${subScreenInfo.screenPath}") 1516 ec.logger.debug("list#Tools: Processing subscreen ${subScreenEntry.key}, subScreenInfo.screenPath: ${subScreenInfo.screenPath}")
1517 1517
1518 // Get the actual subscreen location from screenInfo (should have correct cross-component paths) 1518 // Get the actual subscreen location from screenInfo (should have correct cross-component paths)
1519 def actualSubScreenPath = null 1519 def actualSubScreenPath = null
...@@ -1527,10 +1527,10 @@ def startTime = System.currentTimeMillis() ...@@ -1527,10 +1527,10 @@ def startTime = System.currentTimeMillis()
1527 def screenDef = subScreenInfo.sd 1527 def screenDef = subScreenInfo.sd
1528 if (screenDef?.hasProperty('screenLocation')) { 1528 if (screenDef?.hasProperty('screenLocation')) {
1529 actualSubScreenPath = screenDef.screenLocation 1529 actualSubScreenPath = screenDef.screenLocation
1530 ec.logger.info("list#Tools: Found screenLocation from sd for ${subScreenEntry.key}: ${actualSubScreenPath}") 1530 ec.logger.debug("list#Tools: Found screenLocation from sd for ${subScreenEntry.key}: ${actualSubScreenPath}")
1531 } else if (screenDef?.hasProperty('location')) { 1531 } else if (screenDef?.hasProperty('location')) {
1532 actualSubScreenPath = screenDef.location 1532 actualSubScreenPath = screenDef.location
1533 ec.logger.info("list#Tools: Found location from sd for ${subScreenEntry.key}: ${actualSubScreenPath}") 1533 ec.logger.debug("list#Tools: Found location from sd for ${subScreenEntry.key}: ${actualSubScreenPath}")
1534 } 1534 }
1535 } 1535 }
1536 1536
...@@ -1576,7 +1576,7 @@ def startTime = System.currentTimeMillis() ...@@ -1576,7 +1576,7 @@ def startTime = System.currentTimeMillis()
1576 } 1576 }
1577 if (subscreenItem?.hasAttribute('location')) { 1577 if (subscreenItem?.hasAttribute('location')) {
1578 actualSubScreenPath = subscreenItem.attribute('location') 1578 actualSubScreenPath = subscreenItem.attribute('location')
1579 ec.logger.info("list#Tools: Found XML location for ${subScreenEntry.key}: ${actualSubScreenPath}") 1579 ec.logger.debug("list#Tools: Found XML location for ${subScreenEntry.key}: ${actualSubScreenPath}")
1580 } 1580 }
1581 } 1581 }
1582 } 1582 }
...@@ -1593,12 +1593,12 @@ def startTime = System.currentTimeMillis() ...@@ -1593,12 +1593,12 @@ def startTime = System.currentTimeMillis()
1593 if (lastSlash > 0) { 1593 if (lastSlash > 0) {
1594 def basePath = currentScreenPath.substring(0, lastSlash + 1) 1594 def basePath = currentScreenPath.substring(0, lastSlash + 1)
1595 actualSubScreenPath = basePath + subscreenName + ".xml" 1595 actualSubScreenPath = basePath + subscreenName + ".xml"
1596 ec.logger.info("list#Tools: Constructed fallback path for ${subScreenEntry.key}: ${actualSubScreenPath}") 1596 ec.logger.debug("list#Tools: Constructed fallback path for ${subScreenEntry.key}: ${actualSubScreenPath}")
1597 } 1597 }
1598 } 1598 }
1599 1599
1600 if (actualSubScreenPath) { 1600 if (actualSubScreenPath) {
1601 ec.logger.info("list#Tools: Adding subscreen ${actualSubScreenPath} ${screenPath} ${toolName} ${level+1}") 1601 ec.logger.debug("list#Tools: Adding subscreen ${actualSubScreenPath} ${screenPath} ${toolName} ${level+1}")
1602 processScreenWithSubscreens(actualSubScreenPath, screenPath, processedScreens, toolsAccumulator, toolName, level + 1) 1602 processScreenWithSubscreens(actualSubScreenPath, screenPath, processedScreens, toolsAccumulator, toolName, level + 1)
1603 } else if (!actualSubScreenPath) { 1603 } else if (!actualSubScreenPath) {
1604 // For screens without explicit location, try automatic discovery 1604 // For screens without explicit location, try automatic discovery
...@@ -1606,7 +1606,7 @@ def startTime = System.currentTimeMillis() ...@@ -1606,7 +1606,7 @@ def startTime = System.currentTimeMillis()
1606 if (lastSlash > 0) { 1606 if (lastSlash > 0) {
1607 def basePath = screenPath.substring(0, lastSlash + 1) 1607 def basePath = screenPath.substring(0, lastSlash + 1)
1608 def autoSubScreenPath = basePath + subScreenEntry.key + ".xml" 1608 def autoSubScreenPath = basePath + subScreenEntry.key + ".xml"
1609 ec.logger.info("list#Tools: Constructed fallback path for ${subScreenEntry.key}: ${actualSubScreenPath}") 1609 ec.logger.debug("list#Tools: Constructed fallback path for ${subScreenEntry.key}: ${actualSubScreenPath}")
1610 processScreenWithSubscreens(autoSubScreenPath, screenPath, processedScreens, toolsAccumulator, toolName, level + 1) 1610 processScreenWithSubscreens(autoSubScreenPath, screenPath, processedScreens, toolsAccumulator, toolName, level + 1)
1611 } 1611 }
1612 } 1612 }
...@@ -1626,7 +1626,7 @@ def startTime = System.currentTimeMillis() ...@@ -1626,7 +1626,7 @@ def startTime = System.currentTimeMillis()
1626 ec.logger.info("list#Tools: Starting recursive processing from ${allScreens.size()} base screens") 1626 ec.logger.info("list#Tools: Starting recursive processing from ${allScreens.size()} base screens")
1627 for (screenPath in allScreens) { 1627 for (screenPath in allScreens) {
1628 def parentToolPath = 'screen_' + screenPath.split('/')[-3..-3].join('_').replace('.xml', '') + '_' 1628 def parentToolPath = 'screen_' + screenPath.split('/')[-3..-3].join('_').replace('.xml', '') + '_'
1629 ec.logger.info("TOPSCREEN: ${parentToolPath}") 1629 ec.logger.debug("TOPSCREEN: ${parentToolPath}")
1630 processScreenWithSubscreens(screenPath, null, processedScreens, tools, parentToolPath, 0) 1630 processScreenWithSubscreens(screenPath, null, processedScreens, tools, parentToolPath, 0)
1631 } 1631 }
1632 ec.logger.info("list#Tools: Recursive processing found ${tools.size()} total tools") 1632 ec.logger.info("list#Tools: Recursive processing found ${tools.size()} total tools")
...@@ -1710,7 +1710,7 @@ def startTime = System.currentTimeMillis() ...@@ -1710,7 +1710,7 @@ def startTime = System.currentTimeMillis()
1710 ] 1710 ]
1711 1711
1712 tools.addAll(0, standardMcpMethods) // Add at beginning so they appear on first page 1712 tools.addAll(0, standardMcpMethods) // Add at beginning so they appear on first page
1713 ec.logger.info("list#Tools: Added ${standardMcpMethods.size()} standard MCP protocol methods") 1713 ec.logger.debug("list#Tools: Added ${standardMcpMethods.size()} standard MCP protocol methods")
1714 1714
1715 } finally { 1715 } finally {
1716 if (adminUserInfo != null) { 1716 if (adminUserInfo != null) {
......