mygramps/run_gramps_with_logging.sh
Daniel Viegas 7119aedd3d Add portrait display to timeline and tooltips, add portrait generation to demo family
- Add small portraits (24px) next to timeline events for person events
- Add larger portraits (120px) in tooltips when hovering over events
- Implement portrait loading from Gramps media_list using media_path_full
- Add portrait drawing using Cairo with circular clipping and border
- Update demo family generator to create portraits using DiceBear Avatars API
- Generate portraits considering age and gender for appropriate appearance
- Add media objects to XML with proper IDs and gallery references
- Use relative paths for media files in demo family XML
- Add helper scripts for debugging Gramps log files
- Fix deprecation warnings for XML element truth value checks
2025-11-30 11:31:25 +01:00

85 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Script to run Gramps with debug logging enabled and monitor log file
set -e
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
LOG_DIR="$HOME/snap/gramps/11/.config/gramps/gramps60/logs"
LOG_FILE="$LOG_DIR/Gramps60.log"
echo "=== Running Gramps with Debug Logging ==="
echo ""
echo "Log file will be created at: $LOG_FILE"
echo ""
# Create logs directory if it doesn't exist
mkdir -p "$LOG_DIR"
# Clear any existing log file to start fresh
if [ -f "$LOG_FILE" ]; then
echo -e "${YELLOW}Backing up existing log file...${NC}"
mv "$LOG_FILE" "${LOG_FILE}.backup.$(date +%Y%m%d_%H%M%S)"
fi
echo -e "${GREEN}Starting Gramps with debug logging enabled...${NC}"
echo ""
echo "Debug loggers enabled:"
echo " - gramps.gen.lib.media (media objects)"
echo " - gramps.plugins.import.importxml (XML import)"
echo " - gramps.gen.db (database operations)"
echo ""
echo "After you import the demo_family.gramps file, close Gramps and"
echo "run './check_gramps_logs.sh' to analyze the log file."
echo ""
echo "Press Ctrl+C to stop monitoring (Gramps will continue running)"
echo ""
# Create a log file in the current directory (snap confinement may prevent writing to ~/.gramps)
LOCAL_LOG="gramps_debug.log"
echo "Debug output will also be saved to: $PWD/$LOCAL_LOG"
echo ""
# Run Gramps with debug logging and redirect output
gramps --debug=gramps.gen.lib.media \
--debug=gramps.plugins.import.importxml \
--debug=gramps.gen.db \
--debug=gramps.gen.lib \
"$@" > "$LOCAL_LOG" 2>&1 &
GRAMPS_PID=$!
echo "Gramps started with PID: $GRAMPS_PID"
echo ""
# Monitor log file creation
echo "Waiting for log file to be created..."
while [ ! -f "$LOG_FILE" ] && kill -0 "$GRAMPS_PID" 2>/dev/null; do
sleep 1
done
if [ -f "$LOG_FILE" ]; then
echo -e "${GREEN}Log file created!${NC}"
echo ""
echo "Monitoring log file. Press Ctrl+C to stop monitoring."
echo "(Gramps will continue running)"
echo ""
# Monitor log file for new entries
tail -f "$LOG_FILE" 2>/dev/null || {
echo "Waiting for log entries..."
sleep 2
if [ -f "$LOG_FILE" ]; then
echo ""
echo "Current log contents:"
cat "$LOG_FILE"
fi
}
else
echo "Log file not created yet. Gramps may not have started logging."
echo "Check if Gramps is running: ps aux | grep gramps"
fi