It's hard to fix it when you don't know what is wrong! That's where logs come in handy. Pagoda Box gives you SSH access to your php error logs and any custom logs in your writable storage so you can view and manage them as you like. After reading this guide, you should be familiar with:
- Viewing and managing your PHP error logs
- Viewing and managing your custom logs
Before You Get Started
Enable SSH Access
Before you can manage any of your logs, you need to enable SSH access. To learn how to do this, check out the Enabling SSH Access Guide.
PHP Error Log Management
Every single app has a centralized php-error log inside a “logs” directory. This error log is an aggregate of all of your app instances’ php-error logs. Once SSH access is enabled, it's simple to view and manage your these logs.
Viewing Your PHP Error Log
To view your php error logs from your base SSH directory, use the “cat” command along with the file path to the php_error.log file as shown below:
TerminalViewing Your PHP-Error Logs from Base SSH Directory
Or you can cd into your logs directory and use the following command:
TerminalViewing Your PHP Error Log from Inside Logs Directory
Streaming Your PHP Error Log
To stream your php error logs from your base SSH directory, use the “tail” command, append the “-f” parameter and identify the file path to the php_errors.log file as show below:
TerminalStreaming Your PHP Error Log from Base SSH Directory
Or you can cd into your logs directory and use the following command:
TerminalStreaming Your PHP Error Log From Inside Logs Directory
Downloading Your PHP Error Log
To download your logs, use your SCP or SFTP client of choice and connect through your SSH portal using "pagodabox.com" as the URL, your app name as the username and your specified SSH password. Navigate to your logs directory and download whatever log files you would like.
Custom Log Management
If your app has custom loggers, it's important that the logs are stored in a shared writable directory. Otherwise the logger will not be able to write to the log file and you will not have any custom logs to manage. If you want to know more about shared writable directories, check out this blog post.
Each app has a "shared" directory inside its base SSH directory. This is where all shared writable storage is stored and where any custom logs should be. Simply cd into the directory where your logs are stored and you're ready to manage your custom logs.
Viewing Your Custom Logs
Inside the the directory where your logs are stored, use the “cat” command with the name of the log file you would like to view.
TerminalViewing Your Custom Logs
Streaming Your Custom Logs
Inside the the directory where your logs are stored, use the “tail” command and append the “-f” parameter. This will stream, or follow, the end of your log file. Also identify the log file you would like to tail:
TerminalStreaming Your Custom Logs
Downloading Your Custom Logs
This is the same as downloading your PHP error log. Use your SCP or SFTP client of choice and connect through your SSH portal using "pagodabox.com" as the URL, your app name as the username and your specified SSH password. Navigate to the directory where your logs are stored and download whatever log files you would like.
Table of Contents
Before You Get Started
PHP-Error Log Management
- Viewing Your PHP Error Log
- Viewing Your PHP Error Logs from Base SSH Directory
- Viewing Your PHP Error Logs from Inside Logs Directory
- Streaming Your PHP Error Log
- Streaming Your PHP Error Log from Base SSH Directory
- Streaming Your PHP Error Log from Inside Logs Directory
- Downloading Your PHP Error Log
Custom Log Management
- Viewing Your Custom Logs
- Viewing Your Custom Logs
- Streaming Your Custom Logs
- Streaming Your Custom Logs
- Downloading Your Custom Logs