Common Errors
Learn how to access and use error logs effectively to diagnose and resolve issues in PteroCA.
Accessing Error Logs
PteroCA (being a Symfony application) logs errors and important events to log files located in the var/log/ directory. These logs are extremely useful for debugging because they often contain detailed error messages and stack traces that are not visible in the browser.
Here are some tips for working with log files:
Viewing Recent Logs
To see the latest errors or messages, you can view the end of the log file. Using a terminal on the server, run a command like the following to show the last 100 lines of the production log:
tail -n 100 var/log/prod.logIf your application is in development mode or you want to check development logs, use the dev.log file instead:
tail -n 100 var/log/dev.logThis will output the most recent entries in the log, which may include error stack traces, warnings, or other relevant information. Scanning this output can give you immediate clues about what is going wrong.
Monitoring Logs in Real Time
If you are actively troubleshooting an issue, it can be useful to watch the logs as the application runs. You can "follow" the log file so that new entries are displayed live. For example:
tail -f var/log/prod.logThis will continuously print new log lines to your terminal as they are written. If you trigger an action in the app (like loading a page or performing an operation) that causes an error, you will see the corresponding log entry appear in real time. For development mode logs, do the same with dev.log:
Press Ctrl+C to stop the live log monitoring. Real-time log monitoring is very helpful when you need to reproduce an issue and see the error immediately as it happens.
Resetting Logs
Sometimes, especially during debugging, the log files can become long and cluttered with previous errors, which makes it hard to find new entries. You might want to clear the log file before reproducing an issue, so you can focus only on the fresh log output.
To empty (truncate) the production log, you can use:
This will wipe the contents of prod.log (note the single > which redirects nothing into the file, effectively clearing it). Do the same for dev.log if needed. After clearing the log, perform the steps to reproduce your issue and then check the logs again (via tail or by opening the file) – you will now see only the new log entries, which makes it easier to pinpoint the problem.
Debugging Tips
Enable Debug Mode
For detailed error information during development:
Open
.envfile in your PteroCA root directoryChange
APP_ENV=prodtoAPP_ENV=devRefresh the page causing the error
Important: Always switch back to APP_ENV=prod after debugging in production environments.
Clear Cache
Many issues can be resolved by clearing the application cache:
For development environment:
Check PHP Error Logs
In addition to Symfony logs, check your PHP error logs:
Verify File Permissions
Ensure the web server can write to necessary directories:
Common Error Patterns
"Class not found" Errors
Cause: Missing or outdated Composer dependencies
Solution:
"Access denied" Database Errors
Cause: Incorrect database credentials in .env
Solution: Verify DATABASE_URL in .env file matches your database configuration
"Undefined variable" in Twig Templates
Cause: Template expects a variable that wasn't passed from the controller
Solution: Check the controller action and ensure all required variables are passed to the template
"File not found" Errors
Cause: Missing asset files or incorrect file paths
Solution:
Getting Help
If you cannot resolve an issue after checking logs and trying the solutions above:
Gather Information:
Copy relevant error messages from logs
Note the steps to reproduce the issue
Check your PteroCA version (
composer show | grep pteroca)
Seek Support:
Open an issue on GitHub with error details
Ask in the Discord community
Check the FAQ for similar issues
Provide Context:
Your PteroCA version
PHP version (
php -v)Operating system
Relevant log excerpts
Steps to reproduce
Related Documentation
Installation Issues - Problems during setup
Runtime Issues - Problems during operation
Updating PteroCA - Update troubleshooting
FAQ - Frequently asked questions
Last updated