Reproduce a Production Issue Locally
This is one of the main reasons to use ldev.
When production is failing, do not guess from screenshots or copy stack traces into chat. Recreate the state locally, inspect it, fix it there, and verify the result before production changes.
Problem
Production shows a page failure or content issue that you cannot reproduce with clean local data.
1. Pull the production database locally
ldev db sync --environment production --project my-lcp-project --force--force replaces the current local PostgreSQL data so the environment matches the selected backup.
If you already have a local .sql, .gz, or .dump file, you can skip the cloud download and import it directly:
ldev db import --file /path/to/backup.sql.gz --force2. Pull the production Document Library
ldev db files-download \
--environment production \
--project my-lcp-project \
--doclib-dest docker/doclib/production
ldev db files-mount --path docker/doclib/productionDo this when the issue involves documents, images, or content linked from the Document Library.
If the file store is outside Liferay Cloud, move it manually and mount it yourself:
ldev db files-mount --path /path/to/manual/doclib3. Start the local environment
ldev start
ldev doctorYou now have a local environment close enough to production state to debug without touching production users.
4. Discover the affected portal area
ldev portal inventory sites --json
ldev portal inventory pages --site /global --json
ldev portal inventory page --url /home --jsonThis is often faster than clicking through the UI, especially when the UI is already failing.
5. Diagnose the issue
ldev logs diagnose --since 15m --json
ldev osgi diag com.acme.foo.webUse whichever command matches the failure signal you found.
6. Apply the fix locally
ldev deploy module foo-webOr update the portal/resource/config state in the repo, then restart:
ldev env restart7. Verify locally before any production action
ldev portal check
ldev portal inventory page --url /home --json
ldev logs diagnose --since 5m --jsonThis is the safety loop:
- reproduce production locally
- diagnose with local access
- apply the fix safely
- verify with the same commands