debug-logs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYou are helping a user debug test failures and view logs in this SnapLogic Robot Framework project. Provide guidance based on these conventions.
你正在协助用户在SnapLogic Robot Framework项目中调试测试失败问题并查看日志,请按照以下规范提供指导。
Quick Debugging Checklist
快速调试检查清单
When a test fails, check in this order:
- Test Results -
test/robot_output/log-*.html - Container Status -
make status - Service Logs -
make <service>-logs - Environment -
make check-env - Network -
make docker-networks
当测试失败时,请按以下顺序检查:
- 测试结果 -
test/robot_output/log-*.html - 容器状态 -
make status - 服务日志 -
make <service>-logs - 环境配置 -
make check-env - 网络情况 -
make docker-networks
Viewing Test Results
查看测试结果
Robot Framework Logs
Robot Framework日志
bash
undefinedbash
undefinedFind the latest log file
查找最新的日志文件
ls -lt test/robot_output/log-*.html | head -1
ls -lt test/robot_output/log-*.html | head -1
Open in browser (macOS)
在浏览器中打开(macOS系统)
open test/robot_output/log-*.html
open test/robot_output/log-*.html
Open specific timestamped log
打开特定时间戳的日志
open test/robot_output/log-20240115-143022.html
undefinedopen test/robot_output/log-20240115-143022.html
undefinedLog File Types
日志文件类型
| File | Content |
|---|---|
| Detailed execution log with all keyword steps |
| Summary report with pass/fail statistics |
| Raw XML results (for CI/CD integration) |
| 文件 | 内容 |
|---|---|
| 包含所有关键字步骤的详细执行日志 |
| 包含通过/失败统计信息的汇总报告 |
| 原始XML结果(用于CI/CD集成) |
What to Look For in Logs
日志中需要关注的内容
- Red highlighted rows - Failed keywords
- Timestamps - Identify slow operations
- Screenshots - If captured on failure
- Variable values - Expand to see actual values used
- Stack traces - Python errors in library calls
- 红色高亮行 - 执行失败的关键字
- 时间戳 - 识别运行缓慢的操作
- 截图 - 如果在失败时已捕获
- 变量值 - 展开查看实际使用的值
- 堆栈跟踪 - 库调用中的Python错误
Container Logs
容器日志
View All Container Logs
查看所有容器日志
bash
undefinedbash
undefinedAll logs (can be overwhelming)
所有日志(内容可能较多)
docker compose logs
docker compose logs
Follow logs in real-time
实时跟踪日志
docker compose logs -f
docker compose logs -f
Last 100 lines
查看最后100行日志
docker compose logs --tail=100
undefineddocker compose logs --tail=100
undefinedService-Specific Logs
特定服务的日志
bash
undefinedbash
undefinedTest execution container
测试执行容器日志
docker compose logs tools
docker compose logs -f tools # Follow
docker compose logs tools
docker compose logs -f tools # 实时跟踪
Database logs
数据库日志
make oracle-logs # Oracle
make postgres-logs # PostgreSQL
make mysql-logs # MySQL
make snowflake-logs # Snowflake mock
make oracle-logs # Oracle数据库
make postgres-logs # PostgreSQL数据库
make mysql-logs # MySQL数据库
make snowflake-logs # Snowflake模拟服务
Messaging logs
消息服务日志
make kafka-logs # Kafka
make activemq-logs # ActiveMQ
make kafka-logs # Kafka
make activemq-logs # ActiveMQ
Mock service logs
模拟服务日志
make minio-logs # MinIO (S3)
make salesforce-logs # Salesforce mock
make maildev-logs # Email mock
make minio-logs # MinIO(S3兼容存储)
make salesforce-logs # Salesforce模拟服务
make maildev-logs # 邮件模拟服务
Groundplex logs
Groundplex日志
docker compose logs groundplex
undefineddocker compose logs groundplex
undefinedFilter Logs
过滤日志
bash
undefinedbash
undefinedSearch for errors
搜索错误信息
docker compose logs tools 2>&1 | grep -i error
docker compose logs tools 2>&1 | grep -i error
Search for specific test
搜索特定测试相关日志
docker compose logs tools 2>&1 | grep "Test Pipeline"
docker compose logs tools 2>&1 | grep "Test Pipeline"
Logs from specific time
查看特定时间段的日志
docker compose logs --since 10m tools # Last 10 minutes
undefineddocker compose logs --since 10m tools # 最近10分钟
undefinedCommon Failure Scenarios
常见失败场景
1. Connection Refused
1. 连接被拒绝
Symptoms:
ConnectionRefusedError: [Errno 111] Connection refused
Failed to connect to databaseDebug Steps:
bash
undefined症状:
ConnectionRefusedError: [Errno 111] Connection refused
Failed to connect to database调试步骤:
bash
undefinedCheck if container is running
检查容器是否在运行
make status
make status
Check specific service
检查特定服务状态
make oracle-status # Replace with your service
make oracle-status # 替换为你要检查的服务
View service logs
查看服务日志
make oracle-logs
make oracle-logs
Verify ports
验证端口配置
docker compose ps
docker compose ps
Check network
检查网络情况
make docker-networks
**Common Causes:**
- Container not started
- Container still initializing (especially Oracle)
- Wrong port configuration
- Network isolation issuesmake docker-networks
**常见原因:**
- 容器未启动
- 容器仍在初始化中(尤其是Oracle数据库)
- 端口配置错误
- 网络隔离问题2. Environment Variable Missing
2. 环境变量缺失
Symptoms:
Missing required environment variables: URL, ORG_ADMIN_USER
KeyError: 'ORACLE_PASSWORD'Debug Steps:
bash
undefined症状:
Missing required environment variables: URL, ORG_ADMIN_USER
KeyError: 'ORACLE_PASSWORD'调试步骤:
bash
undefinedCheck environment
检查环境变量配置
make check-env
make check-env
Verify .env file
验证.env文件
cat .env | grep -v "^#" | grep -v "^$"
cat .env | grep -v "^#" | grep -v "^$"
Check specific variable
检查特定变量
grep "ORACLE_PASSWORD" .env
grep "ORACLE_PASSWORD" .env
Verify it's being loaded
验证变量是否已加载
docker compose exec tools env | grep ORACLE
**Common Causes:**
- Missing `.env` file (copy from `.env.example`)
- Variable not defined
- Typo in variable name
- Environment file not in `env_files/`docker compose exec tools env | grep ORACLE
**常见原因:**
- 缺少`.env`文件(从`.env.example`复制生成)
- 变量未定义
- 变量名称拼写错误
- 环境文件不在`env_files/`目录下3. Pipeline Execution Failed
3. 流水线执行失败
Symptoms:
Pipeline status: Failed
Execution error: Connection timeoutDebug Steps:
bash
undefined症状:
Pipeline status: Failed
Execution error: Connection timeout调试步骤:
bash
undefinedCheck Groundplex status
检查Groundplex状态
docker compose ps groundplex
docker compose ps groundplex
View Groundplex logs
查看Groundplex日志
docker compose logs groundplex
docker compose logs groundplex
Check SnapLogic connection
检查SnapLogic连接情况
(Look for authentication or network errors)
(查找认证或网络相关错误)
make status
make status
Verify credentials
验证凭据信息
grep -E "^(URL|ORG_)" .env
**Common Causes:**
- Groundplex not running or not registered
- SnapLogic credentials expired
- Network connectivity to SnapLogic cloud
- Pipeline has errorsgrep -E "^(URL|ORG_)" .env
**常见原因:**
- Groundplex未运行或未注册
- SnapLogic凭据已过期
- 与SnapLogic云服务的网络连接问题
- 流水线本身存在错误4. Timeout Errors
4. 超时错误
Symptoms:
TimeoutError: Operation timed out
Test case timeout exceededDebug Steps:
bash
undefined症状:
TimeoutError: Operation timed out
Test case timeout exceeded调试步骤:
bash
undefinedCheck service responsiveness
检查服务响应状态
make status
make status
Look for slow operations in logs
在日志中查找运行缓慢的操作
docker compose logs tools 2>&1 | grep -i "time|slow|wait"
docker compose logs tools 2>&1 | grep -i "time|slow|wait"
Check system resources
检查系统资源使用情况
docker stats
**Common Causes:**
- Service overloaded
- Insufficient resources
- Long-running database operations
- Network latencydocker stats
**常见原因:**
- 服务过载
- 资源不足
- 数据库操作耗时过长
- 网络延迟5. Data/Assertion Failures
5. 数据/断言失败
Symptoms:
AssertionError: Expected 100 rows, got 0
Data mismatch: expected 'SUCCESS', got 'PENDING'Debug Steps:
bash
undefined症状:
AssertionError: Expected 100 rows, got 0
Data mismatch: expected 'SUCCESS', got 'PENDING'调试步骤:
bash
undefinedCheck test data was loaded
检查测试数据是否已加载
make oracle-status # Check DB
make oracle-load-data # Reload if needed
make oracle-status # 检查数据库状态
make oracle-load-data # 如有需要重新加载数据
Verify pipeline output
验证流水线输出
Check the log-*.html for actual values
在log-*.html中查看实际值
Check for race conditions
检查是否存在竞态条件
(Test ran before data was ready)
(测试在数据准备完成前就已执行)
**Common Causes:**
- Test data not loaded
- Previous test didn't clean up
- Race condition in async operations
- Pipeline logic error
**常见原因:**
- 测试数据未加载
- 上一个测试未清理数据
- 异步操作中的竞态条件
- 流水线逻辑错误Advanced Debugging
高级调试
Interactive Container Access
交互式容器访问
bash
undefinedbash
undefinedShell into tools container
进入tools容器的Shell环境
docker compose exec tools bash
docker compose exec tools bash
Then run commands inside:
然后在容器内执行命令:
cd /app/test
python -c "import os; print(os.environ.get('URL'))"
robot --dryrun suite/
undefinedcd /app/test
python -c "import os; print(os.environ.get('URL'))"
robot --dryrun suite/
undefinedDatabase Query
数据库查询
bash
undefinedbash
undefinedOracle
Oracle数据库
docker compose exec oracle-db sqlplus testuser/testpass@//localhost:1521/FREEPDB1
docker compose exec oracle-db sqlplus testuser/testpass@//localhost:1521/FREEPDB1
PostgreSQL
PostgreSQL数据库
docker compose exec postgres-db psql -U testuser -d testdb
docker compose exec postgres-db psql -U testuser -d testdb
MySQL
MySQL数据库
docker compose exec mysql-db mysql -u testuser -ptestpass testdb
undefineddocker compose exec mysql-db mysql -u testuser -ptestpass testdb
undefinedNetwork Debugging
网络调试
bash
undefinedbash
undefinedCheck container networks
检查容器网络
make docker-networks
make docker-networks
Test connectivity from tools container
从tools容器测试连通性
docker compose exec tools ping -c 3 oracle-db
docker compose exec tools nc -zv oracle-db 1521
undefineddocker compose exec tools ping -c 3 oracle-db
docker compose exec tools nc -zv oracle-db 1521
undefinedInspect Container
检查容器详情
bash
undefinedbash
undefinedDetailed container info
查看容器详细信息
docker inspect <container_name>
docker inspect <container_name>
Environment variables
查看容器环境变量
docker inspect <container_name> | jq '.[0].Config.Env'
docker inspect <container_name> | jq '.[0].Config.Env'
Network settings
查看容器网络设置
docker inspect <container_name> | jq '.[0].NetworkSettings'
undefineddocker inspect <container_name> | jq '.[0].NetworkSettings'
undefinedLogging Best Practices
日志记录最佳实践
Add Logging to Tests
在测试中添加日志
robotframework
*** Test Cases ***
Test With Debug Logging
Log To Console Starting test execution...
Log Variable value: ${MY_VAR} level=DEBUG
${result}= Execute Pipeline
Log Pipeline result: ${result} level=INFO
Capture Page Screenshot # If using Browser libraryrobotframework
*** Test Cases ***
Test With Debug Logging
Log To Console 开始测试执行...
Log 变量值: ${MY_VAR} level=DEBUG
${result}= Execute Pipeline
Log 流水线结果: ${result} level=INFO
Capture Page Screenshot # 如果使用Browser库Enable Debug Mode
启用调试模式
bash
undefinedbash
undefinedRun with debug logging
开启调试日志运行测试
docker compose exec -w /app/test tools robot
--loglevel DEBUG
--include oracle
--outputdir robot_output
suite/
--loglevel DEBUG
--include oracle
--outputdir robot_output
suite/
undefineddocker compose exec -w /app/test tools robot
--loglevel DEBUG
--include oracle
--outputdir robot_output
suite/
--loglevel DEBUG
--include oracle
--outputdir robot_output
suite/
undefinedGetting Help
获取帮助
If you're stuck:
- Search logs for the exact error message
- Check if the issue is environment-specific (works locally but not in CI?)
- Try a clean restart: Stop all services, flush data, start fresh
- Isolate the problem: Run the smallest test that reproduces the issue
bash
undefined如果你遇到问题:
- 在日志中搜索确切的错误消息
- 检查问题是否特定于环境(本地运行正常但CI环境异常?)
- 尝试干净重启:停止所有服务,清空数据,重新启动
- 隔离问题:运行能复现问题的最小测试用例
bash
undefinedClean restart
干净重启
make oracle-stop # Replace with your service
docker compose down
make oracle-start
make robot-run-tests TAGS="smoke" # Run minimal test first
undefinedmake oracle-stop # 替换为你的服务
docker compose down
make oracle-start
make robot-run-tests TAGS="smoke" # 先运行最小测试用例
undefined