Skip to main content
Version: Latest

Brobot Logging System

Transparent, Configuration-Driven Loggingโ€‹

The Brobot framework provides built-in logging capabilities. For find() operations, logging happens automatically. For other actions (click(), type(), move(), etc.), you can add custom log messages via ActionConfig methods to provide context about what your automation is doing.

Key Principle: Logging is a cross-cutting concern that should be transparent to your automation code. You write normal automation logic, and Brobot handles the logging based on your configuration.

Current Status: Automatic logging without custom messages is fully implemented for Find operations. Other actions require custom log messages via withBeforeActionLog(), withSuccessLog(), and withFailureLog() methods.

Core Conceptsโ€‹

Log Levelsโ€‹

Brobot uses industry-standard SLF4J with Logback log levels:

  • OFF - No logging
  • ERROR - Error conditions requiring attention
  • WARN - Warning conditions and potential issues
  • INFO - Key business events and action results
  • DEBUG - Detailed debugging information
  • TRACE - Most detailed information including method entry/exit

Log Categoriesโ€‹

Different aspects of automation are organized into categories:

  • ACTIONS - User actions (click, type, find)
  • TRANSITIONS - State transitions and navigation
  • MATCHING - Pattern matching details
  • PERFORMANCE - Timing and performance metrics
  • STATE - State management events
  • LIFECYCLE - Application lifecycle events
  • VALIDATION - Input validation and checks
  • SYSTEM - System-level events
  • EXECUTION - Execution control events (pause, resume, stop)

Custom Log Messagesโ€‹

Add custom log messages directly to your action configurations:

import io.github.jspinak.brobot.action.Action;
import io.github.jspinak.brobot.action.basic.find.PatternFindOptions;
import io.github.jspinak.brobot.model.state.StateImage;
import io.github.jspinak.brobot.action.report.ActionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class LoginFlow {

@Autowired
private Action action;

public boolean findLoginButton(StateImage loginButton) {
// PatternFindOptions with custom logging
PatternFindOptions options = new PatternFindOptions.Builder()
.withBeforeActionLog("Searching for login button...")
.withSuccessLog("Login button found!")
.withFailureLog("Login button not found - check page state")
.setMaxSearchTime(5.0)
.setSimilarity(0.85)
.build();

// Perform find with custom logging
ActionResult result = action.perform(options, loginButton);
return result.isSuccess();
}
}

Note: The loginButton parameter is a StateImage object typically obtained from a @State class. See the Usage Guide for complete examples including State definitions.

Sample Outputโ€‹

With transparent logging enabled, you'll see:

Standard actions (automatic logging only):

โ†’ CLICK usernameField
โœ“ CLICK usernameField | loc:(245,180) | sim:0.91 | 32ms
โ†’ TYPE "user123"
โœ“ TYPE "user123" | 125ms
โ†’ CLICK loginButton
โœ“ CLICK loginButton | loc:(520,380) | sim:0.92 | 45ms

With custom messages:

Searching for login button...
โ†’ FIND loginButton
โœ“ FIND loginButton | loc:(520,380) | sim:0.92 | 45ms
Login button found!

Failed action:

โ†’ CLICK submitButton
โœ— CLICK submitButton | NOT FOUND | 5003ms

Documentation Structureโ€‹

Logging System Guidesโ€‹

Key Featuresโ€‹

  1. Transparent Logging - No code changes needed, just configuration
  2. Configuration-Driven - Control everything via application.properties
  3. Hierarchical Configuration - Global settings cascade to specific categories
  4. Custom Messages - Add context with ActionConfig logging methods
  5. Session Management - Track workflows with ActionSessionManager
  6. Visual Indicators - Clear symbols (โ†’ โœ“ โœ—) for action status
  7. Concise Format - One-line summaries with essential information
  8. Multiple Output Formats - SIMPLE, STRUCTURED, and JSON
  9. Performance Optimized - Minimal overhead with early filtering
  10. No Special Services - Just use the standard Action class

Configuration & Setupโ€‹

Testing & Debuggingโ€‹

Core Library & Actionsโ€‹