Skip to main content
Version: Latest

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

Implementation Guides

Migration

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:

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:

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 execution
  • withSuccessLog() - Log on successful completion
  • withFailureLog() - Log on failure
  • withAfterActionLog() - Log after action (regardless of result)
  • withLogging() - Full control over logging configuration
  • withNoLogging() - 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 events
  • ERROR - Error conditions
  • DEBUG - Detailed debugging information
  • INFO - General information
  • WARN - 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

  1. Use Descriptive Messages - Include context about what's being attempted and why
  2. Add Failure Context - Help users understand why something failed and what to check
  3. Leverage Placeholders - Use {location}, {count}, {text} for dynamic values
  4. Configure Globally - Set default verbosity in application.properties
  5. Override Locally - Use Options builders for specific action logging needs

Getting Help

If you need assistance with logging:

  1. Check the Logging Quick Reference
  2. Review the Options Logging Guide for embedded logging patterns
  3. Consult the Logging Migration Guide if updating legacy code
  4. See the Unified Logging System for configuration details