log - Monitor Logs

Watch real-time logs from your local PrestaShop Enterprise development environment containers for debugging and monitoring.

Purpose

The log command provides real-time streaming of logs from selected Docker containers in your local development environment, helping you monitor application behavior, debug issues, and understand system activity during development.

When to Use

  • Development Debugging: Monitor application behavior during active development
  • Error Investigation: Watch for errors and warnings in real-time as they occur
  • Performance Monitoring: Observe application response times and resource usage patterns
  • Feature Testing: Monitor logs while testing new features or changes to catch issues immediately
  • System Understanding: Learn how PrestaShop application flows work by observing log patterns
  • Integration Testing: Monitor webhook responses and external service integrations

Prerequisites

Before running the log command:

  1. Authentication: Must be authenticated with ps-enterprise auth
  2. Clone: Shop files must be cloned to have containers configured
  3. Running Environment: Environment must be started with ps-enterprise start
  4. Active Containers: Target containers must be running and healthy

Usage

Interactive Container Selection

# Shows container selection menu
ps-enterprise log

Monitor All Available Containers

# Monitor all running containers (default behavior)
ps-enterprise log

Monitor Specific Containers

# Monitor specific containers by name
ps-enterprise log webserver database

# Monitor containers matching partial names
ps-enterprise log web data ngrok

Static Log Display

# Show static logs without real-time streaming
ps-enterprise log --static

Options

Flag Short Description Required
--static Display static logs instead of live streaming No
--help -h Show command help No

Process

The log command follows this workflow:

1. Container Selection

  • Available Containers: Lists all running Docker containers for the project
  • Interactive Selection: If no containers specified, shows selection menu
  • Name Matching: Filters containers based on provided names or partial matches
  • Validation: Ensures selected containers exist and are accessible

2. Log Display

  • Container Identification: Each log line prefixed with container name in bold
  • Real-time Updates: Logs stream continuously until user interruption (Ctrl+C)
  • Error Highlighting: Container errors displayed with error formatting
  • Synchronized Output: Multiple container logs merged in chronological order

Examples

Interactive Container Selection

# Run with interactive selection
cd my-prestashop-project
ps-enterprise log

# Interactive menu appears:
# ? Select container(s) to watch
#   ✓ webserver
#   ✓ database  
#   ○ ngrok
# [Use arrows and space to select, Enter to confirm]

# Selected containers start streaming:
# webserver 192.168.1.100 - - [03/Nov/2025:10:30:15 +0000] "GET /admin HTTP/1.1" 200 1234
# database 2025-11-03T10:30:15.123456Z Query: SELECT * FROM ps_configuration WHERE name='PS_SHOP_ENABLE'

Monitor Specific Containers

# Monitor only web server and database
ps-enterprise log webserver database

# Output shows only selected containers:
# webserver [03/Nov/2025 10:30:15] GET /index.php HTTP/1.1 200
# database [03/Nov/2025 10:30:15] Query executed: SELECT * FROM ps_product (0.003s)

Partial Name Matching

# Monitor containers with names containing 'web'
ps-enterprise log web

# Matches: webserver, web-php, etc.
# If multiple matches found:
# Multiple containers found matching 'web':
# 1. webserver
# 2. web-php
# ? Select containers: [1,2]

Static Log Display

# Show recent logs without streaming
ps-enterprise log --static

# Displays recent log entries and exits:
# webserver [Recent logs from webserver container]
# database [Recent logs from database container]
# [Command exits after displaying recent logs]

Development Debugging Workflow

# Terminal 1: Start environment
ps-enterprise start

# Terminal 2: Monitor logs
ps-enterprise log webserver database

# Terminal 3: Development work
# Navigate to http://localhost:8080 and watch logs in Terminal 2
# Edit files, test features, observe real-time logs

Troubleshooting

Environment Not Running

❌ Containers not found with names ["webserver"]

Solution: Start the environment first:

ps-enterprise start
ps-enterprise log

Invalid Container Names

❌ Containers not found with names ["nonexistent"]

Solution: Check available containers:

docker ps --format "table {{.Names}}\t{{.Status}}"

Docker Permission Issues

 webserver Error: permission denied while trying to connect to Docker daemon

Solution:

  • Check Docker Desktop is running
  • Verify user permissions for Docker
  • Restart Docker service if needed

Container Disconnection

❌ webserver Container disconnected or stopped

Solution:

  • Check container status: docker ps
  • Restart environment: ps-enterprise stop && ps-enterprise start
  • Re-run log command

Container Detection Issues

If containers aren’t detected:

  1. Verify Environment Status:

    ps-enterprise start
    docker ps
    
  2. Check Container Names:

    docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Status}}"
    

Advanced Usage

Custom Container Filtering

# Monitor containers with complex name patterns
ps-enterprise log $(docker ps --format "{{.Names}}" | grep -E "(web|db)")

Log Analysis with External Tools

# Pipe logs to external analysis tools
ps-enterprise log --static | grep ERROR
ps-enterprise log webserver | awk '/404/ {print $0}'

Development Automation

#!/bin/bash
# automated-testing.sh - Monitor logs during automated testing
ps-enterprise log webserver database > test-logs.txt &
LOG_PID=$!

# Run automated tests
npm test

# Stop log monitoring
kill $LOG_PID

Integration with Development Workflow

Daily Development Pattern

# Morning routine
ps-enterprise start
ps-enterprise log webserver database &  # Background monitoring

# Development work with logs visible
# Edit code, test changes, observe logs

# End of day
kill %1  # Stop background logs
ps-enterprise stop

Debugging Specific Issues

# Reproduce issue while monitoring
ps-enterprise log webserver database

# In another terminal, reproduce the problem
# Navigate to problematic page or feature
# Observe real-time logs for error patterns

Performance Testing

# Monitor performance during load testing
ps-enterprise log database redis

# In another terminal, run performance tests
# Watch for slow queries and cache behavior
  • auth - Required for container access authentication
  • clone - Required for container configuration
  • start - Must be run first to have containers generating logs
  • stop - Stops containers and ends log generation
  • exec - Access containers directly for detailed inspection

Pro Tip: Keep logs running in a separate terminal window during development to catch issues as they happen in real-time. Use container name filtering to focus on relevant services.
Container Selection: If no containers are specified, the command will show an interactive selection menu. You can also specify partial container names for flexible matching.
Sensitive Data: Log files may contain sensitive information like database queries with data, user information, or configuration details. Handle logs appropriately and avoid sharing raw log data.