| name | guidewire-debug-bundle |
| description | Debug Guidewire InsuranceSuite issues including Gosu code, Cloud API integrations,
and system performance problems.
Use when troubleshooting errors, analyzing logs, or diagnosing integration failures.
Trigger with phrases like "debug guidewire", "troubleshoot policycenter",
"gosu debugging", "guidewire logs", "trace api call".
|
| allowed-tools | Read, Write, Edit, Bash(curl:*), Bash(grep:*), Grep |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
Guidewire Debug Bundle
Overview
Comprehensive debugging techniques for Guidewire InsuranceSuite including Gosu debugging, Cloud API tracing, log analysis, and performance profiling.
Prerequisites
- Access to Guidewire Cloud Console
- IntelliJ IDEA with Gosu plugin
- Basic understanding of Java debugging
- Access to application logs
Instructions
Step 1: Enable Debug Logging
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<RollingFile name="DebugFile" fileName="logs/debug.log"
filePattern="logs/debug-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="%d{ISO8601} [%t] %-5level %logger{36} - %msg%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="gw.custom" level="DEBUG"/>
<Logger name="gw.plugin" level="DEBUG"/>
Step 2: Gosu Debugging in IDE
// Add debug breakpoints and logging
package gw.custom.debug
uses gw.api.util.Logger
class DebugHelper {
private static final var LOG = Logger.forCategory("DebugHelper")
// Debug method entry/exit
static function trace<T>(methodName : String, block() : T) : T {
LOG.debug(">>> Entering ${methodName}")
var startTime = System.currentTimeMillis()
try {
var result = block()
LOG.debug("<<< Exiting ${methodName} (${System.currentTimeMillis() - startTime}ms)")
return result
} catch (e : Exception) {
LOG.error("!!! Exception in ${methodName}: ${e.Message}", e)
throw e
}
}
// Dump entity state
static function dumpEntity(entity : KeyableBean) {
LOG.debug("=== Entity Dump: ${entity.IntrinsicType.Name} ===")
LOG.debug(" ID: ${entity.ID}")
LOG.debug(" PublicID: ${entity.PublicID}")
entity.IntrinsicType.TypeInfo.Properties
.where(\p -> !p.Name.startsWith("_"))
.each(\prop -> {
try {
var value = prop.Accessor.getValue(entity)
LOG.debug(" ${prop.Name}: ${value}")
} catch (e : Exception) {
LOG.debug(" ${prop.Name}: <error reading>")
}
})
}
// Debug query execution
static function debugQuery<T>(query : Query<T>) : List<T> {
LOG.debug("Query: ${query.toString()}")
var startTime = System.currentTimeMillis()
var results = query.select().toList()
var elapsed = System.currentTimeMillis() - startTime
LOG.debug("Query returned ${results.Count} rows in ${elapsed}ms")
return results
}
}
Step 3: Remote Debugging Setup
export JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
./gradlew runServer
Step 4: API Request Tracing
import axios, { AxiosInstance, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
function createDebugClient(): AxiosInstance {
const client = axios.create({
baseURL: process.env.POLICYCENTER_URL,
timeout: 30000
});
client.interceptors.request.use((config: InternalAxiosRequestConfig) => {
const requestId = crypto.randomUUID();
config.headers['X-Request-ID'] = requestId;
console.log(`[${requestId}] >>> ${config.method?.toUpperCase()} ${config.url}`);
if (config.data) {
console.log(`[${requestId}] Request body:`, JSON.stringify(config.data, null, 2));
}
(config as any).metadata = { : .(), requestId };
config;
});
client...(
{
metadata = (response. ).;
elapsed = .() - metadata.;
traceId = response.[];
.();
.(, .(response., , ));
response;
},
{
metadata = (error. )?.;
.(, error.?. || error.);
error;
}
);
client;
}
Step 5: Cloud Console Log Analysis
claimNumber:"CLM-001234" AND level:ERROR
message:"API call completed" AND duration:[5000 TO *]
category:"Authentication" AND level:WARN
category:"gw.integration*" AND level:ERROR
curl -X GET "https://your-tenant.cloud.guidewire.com/api/v1/logs" \
-H "Authorization: Bearer ${TOKEN}" \
-d "from=2024-01-15T00:00:00Z" \
-d "to=2024-01-15T23:59:59Z" \
-d "filter=level:ERROR" \
-o error-logs.json
Step 6: Database Query Analysis
// Analyze slow queries
uses gw.api.database.Query
uses gw.api.database.QueryPlanExplainer
class QueryDebugger {
static function explainQuery<T>(query : Query<T>) : String {
var explainer = new QueryPlanExplainer(query)
var plan = explainer.explain()
LOG.debug("=== Query Execution Plan ===")
LOG.debug("SQL: ${plan.SQL}")
LOG.debug("Estimated Rows: ${plan.EstimatedRows}")
LOG.debug("Index Used: ${plan.IndexUsed}")
LOG.debug("Scan Type: ${plan.ScanType}")
if (plan.ScanType == "FULL_TABLE_SCAN" && plan.EstimatedRows > 10000) {
LOG.warn("WARNING: Full table scan on large table!")
}
return plan.toString()
}
// Profile query execution
static function profileQuery<T>(name : String, query : Query<T>) : List<T> {
var startTime = System.nanoTime()
var results = query.select().toList()
var elapsed = (System.nanoTime() - startTime) / 1_000_000.0
LOG.info("Query '${name}': ${results.Count} rows in ${elapsed}ms")
if (elapsed > 1000) {
LOG.warn("Slow query detected: ${name}")
explainQuery(query)
}
return results
}
}
Step 7: Memory and Thread Analysis
// Monitor memory usage
class MemoryDebugger {
static function logMemoryUsage() {
var runtime = Runtime.getRuntime()
var totalMB = runtime.totalMemory() / 1024 / 1024
var freeMB = runtime.freeMemory() / 1024 / 1024
var usedMB = totalMB - freeMB
var maxMB = runtime.maxMemory() / 1024 / 1024
LOG.info("Memory: used=${usedMB}MB, free=${freeMB}MB, total=${totalMB}MB, max=${maxMB}MB")
if (usedMB > maxMB * 0.9) {
LOG.warn("HIGH MEMORY USAGE: ${(usedMB * 100.0 / maxMB) as int}%")
}
}
// Dump thread state
static function dumpThreads() {
LOG.info("=== Thread Dump ===")
Thread.getAllStackTraces().each(\thread, stack -> {
LOG.info("Thread: ${thread.Name} [${thread.State}]")
stack.each(\frame -> {
LOG.info(" at ${frame}")
})
})
}
}
Debug Support Bundle
interface DebugBundle {
timestamp: string;
environment: string;
version: string;
systemInfo: any;
recentErrors: any[];
configSnapshot: any;
performanceMetrics: any;
}
async function collectDebugBundle(): Promise<DebugBundle> {
const bundle: DebugBundle = {
timestamp: new Date().toISOString(),
environment: process.env.NODE_ENV || 'unknown',
version: process.env.APP_VERSION || 'unknown',
systemInfo: await getSystemInfo(),
recentErrors: await getRecentErrors(100),
configSnapshot: getConfigSnapshot(),
performanceMetrics: await getPerformanceMetrics()
};
const filename = ;
fs.(filename, .(bundle, , ));
.();
bundle;
}
() {
{
: process.,
: process.,
: process.(),
: process.(),
: process..
};
}
() {
[];
}
Common Debug Scenarios
Debugging Workflow Failures
// Add workflow debug hooks
class WorkflowDebugger {
static function debugWorkflowStep(workflow : Workflow, step : WorkflowStep) {
LOG.debug("=== Workflow Step Debug ===")
LOG.debug("Workflow: ${workflow.Name}")
LOG.debug("Step: ${step.Name}")
LOG.debug("Status: ${step.Status}")
// Check preconditions
step.Preconditions.each(\precond -> {
var result = precond.evaluate(workflow.Context)
LOG.debug("Precondition '${precond.Name}': ${result}")
})
// Check available actions
step.AvailableActions.each(\action -> {
LOG.debug("Available action: ${action.Name}")
})
}
}
Debugging Integration Failures
// Integration debug helper
class IntegrationDebugger {
static function debugRequest(request : RestRequest) {
LOG.debug("=== Outbound Request ===")
LOG.debug("URL: ${request.URL}")
LOG.debug("Method: ${request.Method}")
LOG.debug("Headers:")
request.Headers.each(\name, value -> {
// Mask sensitive headers
var displayValue = name.toLowerCase().contains("auth") ? "***" : value
LOG.debug(" ${name}: ${displayValue}")
})
LOG.debug("Body: ${request.Body}")
}
static function debugResponse(response : RestResponse) {
LOG.debug("=== Inbound Response ===")
LOG.debug("Status: ${response.StatusCode}")
LOG.debug("Headers:")
response.Headers.each(\name, value -> {
LOG.debug(" ${name}: ${value}")
})
LOG.debug("Body: ${response.Body}")
}
}
Output
- Debug logs with trace information
- Query execution plans
- Memory and thread dumps
- Complete debug bundle for support
Resources
Next Steps
For rate limiting information, see guidewire-rate-limits.