Troubleshooting

From DreamFactory
Jump to: navigation, search
DreamFactoryTroubleshooting

If you experience issues with some of the services, like SQL database connection or server-side scripting, please make sure you have all of the necessary drivers installed with your DreamFactory instance. Depending on the way your instance was installed and the hosting platform, some additional libraries, drivers, or packages may be required for certain services to work properly.

The following services must be licensed from DreamFactory, and are therefore are not enabled by default: Oracle, SQL Server, IBM DB2, SAP SQL Anywhere, Salesforce, Active Directory, LDAP, and SOAP. Information about purchasing a commercial DreamFactory license to enable these services is here.

If you are unable to install or enable the necessary drivers, please contact DreamFactory Support for assistance.

Note: When the "install directory" is mentioned, it is the DreamFactory code base install that is being referred to. In a Bitnami install, the DreamFactory code base starts at <bitnami install path>/apps/dreamfactory/htdocs/.


Logging

Most logging done by the DreamFactory instance will be located in a file called dreamfactory.log.

 {install directory}/storage/logs/dreamfactory.log

Other errors may be reported by the web server (i.e. Apache writes to error.log, location based on its configuration), or system log.

DreamFactory Logging Configuration

DreamFactory supports hierarchical Log Level and goes in following order.

Log Level Description
EMERGENCY Urgent alert.
ALERT Action must be taken immediately. Example: Entire system is down, database unavailable, etc.
CRITICAL Critical conditions. Example: System component unavailable, unexpected exception.
ERROR Runtime errors.
WARNING Exceptional occurrences that are not errors.
NOTICE Uncommon events.
INFO Interesting events. Example: API Request and Responses.
DEBUG Detailed debug information

Setting your DreamFactory log level to any of these will log that level and the levels above it. So, if you set your log level to ERROR then the system will log all ERROR, CRITICAL, ALERT, and EMERGENCY messages in your log file. By default, log level is set to WARNING. To change it, set DF_LOG_LEVEL to any of the above in your .env file located in your install directory. Here are some additional logging environment settings that you may edit in .env

Parameter Default value Notes
APP_DEBUG false Shows/hides error messages on the web.
APP_LOG single Controls the format of the log file, options are 'single', 'daily', 'syslog', or 'errorlog'
DF_FREETDS_DUMP Enabling and location of FreeTDS dump file, defaults to disabled or default freetds.conf setting
DF_FREETDS_DUMPCONFIG Location of FreeTDS connection dump file, defaults to disabled

Here are some additional logging configuration settings that you may edit in `config/df.php`

Parameter Default value Notes
log_cors_info false Enables/disables detailed CORS logging
log_events true Determines if all events dispatched to a handler are logged
scripting.log_memory_usage false Enables/disables logging memory usage after a script is executed

Apache Logging Configuration

Finally, when configuring your Apache virtual host, you may configure the Apache logs for your DreamFactory instance to be co-located with your DreamFactory logs. These logs are useful for debugging and troubleshooting both PHP and Apache behavior. For example, in /etc/apache2/sites-enabled/dreamfactory.conf

ErrorLog {install directory}/storage/logs/error.log
CustomLog {install directory}/storage/logs/access.log combined

Clearing Config

When editing the .env file it is always recommended to run the configuration clear artisan command to clear any cached configuration parameters and read the new changes in to DreamFactory.

php artisan config:clear

Clearing Cache

When all else fails, clear the cache. Cache can be cleared via the Admin application by clicking the Config tab, then Cache menu option, and click 'Flush System-wide Cache'. This can also be accomplished with the following command in the install directory.

 php artisan cache:clear

Errors

PHP Out of Memory

If you are seeing for example in your log files:

 Fatal error: Allowed memory size of 268435465 bytes exhausted 

This error is mainly caused by PHP loading more in to memory than what PHP currently has allocated for one process. This error has been seen with uploading large files and logging in using Active Directory with a large number of users in the domain but may present itself elsewhere if a process is resource intensive.

Edit your php.ini file on the lines shown below. Note: Depending on your installation the php.ini directives may be listed differently or in different order. For a full list of php.ini directives click here. Set the values in bytes according to your needs. Example: 256M, 512M, 64M. PHP supports M,K, and G when setting byte values.

[PHP]
memory_limit = 128M
post_max_size = 32M
upload_max_filesize = 32M

Warning: To have no memory limit, set this directive to -1. We strongly advise against doing this.

If you are running Linux and unsure of how much RAM your machine has, the following commands can assist you in finding this information as well as understand how the resources are being allocated. These commands may vary depending on what flavor Linux you are running, below recommendations assume Ubuntu Linux.

Command:

free -m


Output:

 total       used       free     shared    buffers     cached
Mem:          5891       5470        420        440         54       1914
-/+ buffers/cache:       3501       2389


Command:

grep MemTotal /proc/meminfo


Output:

MemTotal:       6032664 kB


Command:

cat /proc/meminfo


Output:

MemTotal:        6032664 kB
MemFree:          482788 kB
MemAvailable:    2220456 kB
Buffers:           55804 kB
Cached:          1987344 kB
SwapCached:          160 kB
Active:          3870728 kB
Inactive:        1289664 kB
Active(anon):    2727688 kB
Inactive(anon):   866484 kB
Active(file):    1143040 kB
Inactive(file):   423180 kB
Unevictable:         320 kB
Mlocked:             320 kB
SwapTotal:       6212604 kB
SwapFree:        6211652 kB
Dirty:               284 kB
Writeback:             0 kB
AnonPages:       3117500 kB
Mapped:           644724 kB
Shmem:            476896 kB
Slab:             253056 kB
SReclaimable:     207940 kB
SUnreclaim:        45116 kB
KernelStack:       11920 kB
PageTables:        62564 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     9228936 kB
Committed_AS:   10936332 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      554624 kB
VmallocChunk:   34358423548 kB
HardwareCorrupted:     0 kB
AnonHugePages:   1230848 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      218880 kB
DirectMap2M:     5994496 kB
DirectMap1G:     1048576 kB


Command:

vmstat


Output:

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0    952 478736  55580 1987660    0    0    18    51  160   73  7  1 91  1  0