Back to Knowledege base

Using the System Log File for Diagnostics

Understanding spshed_reps and how to access it

Understanding the System Log

Xi-Text maintains a system log file that records:

  • Scheduler startup and shutdown
  • Printer state changes
  • Error conditions
  • Configuration issues
  • Network events

Location:

/var/spool/spd/spshed_reps

Or in custom spool directory:

<spool_directory>/spshed_reps

What Gets Logged

Scheduler events:

Scheduler started
Network connections established
Scheduler stopping

Printer events:

Printer ptr1 started
Printer ptr1: Cannot open device /dev/lp0: Permission denied
Printer ptr2 went offline
Printer ptr3 completed job 15033

Error conditions:

Parse error in /usr/spool/printers/ptr1/a4.ps line 12
Cannot connect to remote host server2
Filter command exited with code 1

Job events (if verbose logging enabled):

Job 15033 started on ptr1
Job 15033 completed successfully

Accessing the Log File

Method 1: Direct File Access

bash

# View entire log
cat /var/spool/spd/spshed_reps

# View recent entries
tail -50 /var/spool/spd/spshed_reps

# Follow log in real-time
tail -f /var/spool/spd/spshed_reps

# Search for specific printer
grep "ptr1" /var/spool/spd/spshed_reps

# Search for errors
grep -i "error" /var/spool/spd/spshed_reps

Method 2: From spq (X Command)

In spq:

  1. Switch to printer view (press o if in jobs view)
  2. Press X
  3. System log displays in viewer
  4. Use arrow keys or Page Up/Down to navigate
  5. Press q to exit viewer

Advantages:

  • Quick access without command line
  • Formatted display
  • Works from any terminal running spq

Log Entry Format

Typical log entry:

[date time] component: message

Examples:

[Feb  6 10:15:22] spshed: Scheduler started
[Feb  6 10:15:23] printer ptr1: Started successfully
[Feb  6 10:20:15] printer ptr1: Cannot open device /dev/lp0
[Feb  6 11:30:45] network: Connection from server2 established

Common Log Messages

Startup Messages

Scheduler started
Reading configuration from /etc/Xitext-config
Initializing shared memory
Network interface started on port 9999

Meaning: Normal scheduler startup sequence.

Printer Messages

Printer ptr1 started

Meaning: Printer successfully transitioned to Startup state.

Printer ptr1: Cannot open device /dev/lp0: Permission denied

Meaning: Device permissions problem. Fix with:

bash

chmod 660 /dev/lp0
chgrp spooler /dev/lp0
Printer ptr1: Parse error in setup file at line 12

Meaning: Syntax error in setup file. Edit and fix:

bash

vi /usr/spool/printers/ptr1/default
# Check line 12
Printer ptr1 went offline

Meaning: Hardware detected as offline. Check printer physically.

Printer ptr1: Network connection to server:9100 failed

Meaning: Network printer unreachable. Check connectivity:

bash

ping server
telnet server 9100

Job Messages

Job 15033 started on printer ptr1
Job 15033 completed successfully

Meaning: Normal job lifecycle.

Job 15033 aborted by operator

Meaning: Operator halted printer or aborted job.

Error Messages

Cannot allocate shared memory: Out of memory

Meaning: System resource exhaustion. Restart Xi-Text:

bash

sstop -y
spstart
Configuration file /etc/Xitext-config not found

Meaning: Configuration missing or permissions issue.

Using the Log for Troubleshooting

Printer Won't Start

Check log for:

bash

tail -20 /var/spool/spd/spshed_reps | grep "ptr1"

Look for:

  • Permission errors
  • Parse errors
  • Device not found
  • Network connection failures

Jobs Not Printing

Check log for:

bash

tail -50 /var/spool/spd/spshed_reps | grep "Job"

Look for:

  • Job selection messages
  • Job started messages
  • Job completed/failed messages

Network Issues

Check log for:

bash

grep -i "network\|connection" /var/spool/spd/spshed_reps

Look for:

  • Connection established/failed
  • Remote host messages
  • Timeout messages

Log Rotation

The spshed_reps file grows continuously. Implement rotation to manage size:

Using logrotate (Linux)

bash

# Create /etc/logrotate.d/xitext
cat > /etc/logrotate.d/xitext << 'EOF'
/var/spool/spd/spshed_reps {
    weekly
    rotate 12
    compress
    delaycompress
    missingok
    notifempty
    create 0640 spooler spooler
}
EOF

Manual Rotation Script

bash

#!/bin/bash
# rotate-xitext-log.sh

LOG="/var/spool/spd/spshed_reps"
DATE=$(date +%Y%m%d)

if [ -f "$LOG" ]; then
    # Copy log with date stamp
    cp "$LOG" "${LOG}.${DATE}"
    
    # Truncate original
    > "$LOG"
    
    # Compress old log
    gzip "${LOG}.${DATE}"
    
    # Delete logs older than 90 days
    find "$(dirname $LOG)" -name "spshed_reps.*.gz" -mtime +90 -delete
fi

Schedule monthly:

bash

# Add to crontab
0 2 1 * * /usr/local/sbin/rotate-xitext-log.sh

Monitoring the Log

Watch for Errors

bash

#!/bin/bash
# monitor-xitext-log.sh

LOG="/var/spool/spd/spshed_reps"

tail -f "$LOG" | while read line; do
    if echo "$line" | grep -qi "error\|failed\|cannot"; then
        echo "$line" | mail -s "Xi-Text Alert" admin@example.com
    fi
done

Daily Error Summary

bash

#!/bin/bash
# daily-error-summary.sh

LOG="/var/spool/spd/spshed_reps"
TODAY=$(date +"%b %d")

echo "Xi-Text Errors for $TODAY"
echo "=========================="
grep "$TODAY" "$LOG" | grep -i "error\|failed" | sort | uniq -c

Best Practices

Check log regularly:

Review spshed_reps weekly for patterns or recurring issues.

Rotate logs:

Prevent unlimited growth with rotation policy.

Monitor for errors:

Set up automated monitoring for critical errors.

Keep historical logs:

Compress and archive old logs for trend analysis.

Correlate with events:

When issues occur, check log for timestamp correlation.

Document resolutions:

Note solutions for recurring log messages.

Understanding Printer States and State Transitions
How to monitor and control printer states in Xi-Text