[IMP] add migration log file
to store all the migration logs. File reset at each migration.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
final_404_addons
|
final_404_addons
|
||||||
|
migration.log
|
||||||
|
|||||||
24
README.md
24
README.md
@@ -413,10 +413,30 @@ The script works on a **copy** of the original database. You can restart as many
|
|||||||
|
|
||||||
### Viewing Detailed Logs
|
### Viewing Detailed Logs
|
||||||
|
|
||||||
Odoo/OpenUpgrade logs are displayed in real-time. For a problematic migration:
|
All output (scripts, Docker containers, OpenUpgrade logs) is automatically saved to `migration.log` at the project root. The file is overwritten at the start of each run (full migration or resume).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Follow live output while also saving to file (already done automatically)
|
||||||
|
tail -f migration.log
|
||||||
|
|
||||||
|
# Search for errors after the fact
|
||||||
|
grep -i error migration.log
|
||||||
|
|
||||||
|
# View with ANSI colors preserved (less handles CRLF line endings natively)
|
||||||
|
less -R migration.log
|
||||||
|
|
||||||
|
# Plain text output without CRLF artifacts
|
||||||
|
cat migration.log | col -b
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:** `migration.log` is recorded via a pseudo-TTY (`script`), which preserves
|
||||||
|
> color output in the terminal. As a side effect, the file uses `\r\n` line endings.
|
||||||
|
> Use `less -R` or `col -b` for clean viewing.
|
||||||
|
|
||||||
|
For a problematic migration:
|
||||||
|
|
||||||
1. Note the version where the error occurs
|
1. Note the version where the error occurs
|
||||||
2. Check the logs to identify the problematic module/table
|
2. Check `migration.log` to identify the problematic module/table
|
||||||
3. Add a fix in the `pre_upgrade.sh` for that version
|
3. Add a fix in the `pre_upgrade.sh` for that version
|
||||||
4. Restart the migration
|
4. Restart the migration
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,13 @@ set -euo pipefail
|
|||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
source "${SCRIPT_DIR}/lib/common.sh"
|
source "${SCRIPT_DIR}/lib/common.sh"
|
||||||
|
|
||||||
|
readonly LOG_FILE="${SCRIPT_DIR}/migration.log"
|
||||||
|
if [[ -z "${_MIGRATION_LOGGING:-}" ]]; then
|
||||||
|
rm -f "$LOG_FILE"
|
||||||
|
export _MIGRATION_LOGGING=1
|
||||||
|
exec script -q -c "$(printf '%q ' "$0" "$@")" "$LOG_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# USAGE & ARGUMENTS
|
# USAGE & ARGUMENTS
|
||||||
####################
|
####################
|
||||||
@@ -225,3 +232,4 @@ log_step "POST-UPGRADE PROCESSES"
|
|||||||
"${SCRIPT_DIR}/scripts/finalize_db.sh" "$FINALE_DB_NAME" "$FINALE_SERVICE_NAME"
|
"${SCRIPT_DIR}/scripts/finalize_db.sh" "$FINALE_DB_NAME" "$FINALE_SERVICE_NAME"
|
||||||
|
|
||||||
log_step "UPGRADE PROCESS ENDED WITH SUCCESS"
|
log_step "UPGRADE PROCESS ENDED WITH SUCCESS"
|
||||||
|
log_info "Full logs available at: ${LOG_FILE}"
|
||||||
|
|||||||
Reference in New Issue
Block a user