Brobot Logging Documentation
Welcome to the Brobot logging documentation. This folder contains comprehensive guides for understanding and using Brobot's logging capabilities.
Quick Start Guides
1. Options Logging Guide ⭐ NEW
Learn how to use embedded logging methods in Options builders for clean, contextual logging without cluttering your code.
2. Logging Quick Reference
A concise reference for all logging methods, configuration properties, and common patterns.
Core Documentation
System Design
- Logging Architecture - Deep dive into the logging system's design patterns, components, and extension points
- Modular Logging System - Architecture of the modular logging components and formatters
- Unified Logging System - Overview of the unified logging facade that consolidates all logging
Implementation Guides
- Automatic Action Logging - How actions are automatically logged throughout their lifecycle
- Action Logging Console Visual - Console output formatting and visual feedback configuration
- Modular Logging Guide - Step-by-step guide to using the modular logging system
Migration
- Logging Migration Guide - Comprehensive guide for migrating from legacy logging to the unified system
Topics by Use Case
For Developers Writing Automation Code
Start Here: Options Logging Guide
The most common way to add logging is through Options builders:
PatternFindOptions options = new PatternFindOptions.Builder()
.withBeforeActionLog("Searching for submit button...")
.withSuccessLog("Submit button found at {location}")
.withFailureLog("Submit button not found - check if page loaded")
.build();
For Framework Configuration
Key Files:
- Unified Logging System - Configuration via application.properties
- Logging Quick Reference - All configuration properties
Common Settings:
# Enable verbose logging
brobot.logging.verbosity=VERBOSE
# Enable console action output
brobot.console.actions.enabled=true
brobot.console.actions.level=VERBOSE
For Custom Extensions
Architecture Guides:
- Logging Architecture - Extension points and custom handlers
- Modular Logging System - Creating custom formatters
For Debugging and Diagnostics
Diagnostic Features:
- Pattern matching diagnostics
- Failed match analysis
- Performance tracking
- Visual feedback during development
See Action Logging Console Visual for console output configuration.
Key Concepts
1. Embedded Logging in Options
All Options builders that extend ActionConfig
provide logging methods:
withBeforeActionLog()
- Log before action executionwithSuccessLog()
- Log on successful completionwithFailureLog()
- Log on failurewithAfterActionLog()
- Log after action (regardless of result)withLogging()
- Full control over logging configurationwithNoLogging()
- Disable logging for this action
2. Logging Levels
- QUIET - Minimal output, errors only
- NORMAL - Standard logging with key events
- VERBOSE - Detailed logging with diagnostics
3. Log Event Types
ACTION
- Action execution eventsERROR
- Error conditionsDEBUG
- Detailed debugging informationINFO
- General informationWARN
- Warning conditions
4. Unified Facade
The BrobotLogger
provides a unified interface that:
- Consolidates multiple logging systems (SLF4J, Console, Action logging)
- Maintains thread-local context
- Supports structured metadata
- Enables session-scoped logging
Common Patterns
Pattern 1: Transition Logging
@OutgoingTransition(to = NextState.class)
public boolean toNextState() {
ClickOptions options = new ClickOptions.Builder()
.withBeforeActionLog("Navigating to NextState...")
.withSuccessLog("Successfully navigated to NextState")
.withFailureLog("Failed to navigate - button not found")
.build();
return action.click(button, options).isSuccess();
}
Pattern 2: Verification Logging
@IncomingTransition
public boolean verifyArrival() {
PatternFindOptions options = new PatternFindOptions.Builder()
.withBeforeActionLog("Verifying arrival at {stateName}...")
.withSuccessLog("Confirmed arrival at {stateName}")
.withFailureLog("Not at expected state - markers not found")
.setWaitTime(5.0)
.build();
return action.find(stateMarker, options).isSuccess();
}
Pattern 3: Process Execution Logging
public void executeProcess() {
TypeOptions typeOptions = new TypeOptions.Builder()
.withBeforeActionLog("Entering search term...")
.withSuccessLog("Search term entered successfully")
.withFailureLog("Failed to enter search term")
.build();
action.type("search term", typeOptions);
}
Best Practices
- Use Descriptive Messages - Include context about what's being attempted and why
- Add Failure Context - Help users understand why something failed and what to check
- Leverage Placeholders - Use
{location}
,{count}
,{text}
for dynamic values - Configure Globally - Set default verbosity in application.properties
- Override Locally - Use Options builders for specific action logging needs
Related Documentation
- Brobot Testing Guide - Testing with mock mode and logging
- AI Brobot Project Creation - Complete Brobot patterns including logging
- Special Keys Guide - How to use special keyboard keys in Brobot
Getting Help
If you need assistance with logging:
- Check the Logging Quick Reference
- Review the Options Logging Guide for embedded logging patterns
- Consult the Logging Migration Guide if updating legacy code
- See the Unified Logging System for configuration details