PART 1.2.1.2 – Magento 2 Modes

Please note that the standard mode for a freshly imported project is developer mode. There is usually no reason to change this on a local environment.

 

developer

 

 

production

 

 

 

default

 

Mode

Static files caching

Exceptions displayed

Exceptions logged

Performance impacted

For most developers it is enough to know that the different modes exist, in case they are needed for troubleshooting.

Only developer mode should be used by developers. It has many benefits although it renders Magento instance noticeably slow.

Technical explanation from the BE training

Developer Mode

Intended for development only – slowest performance

In developer mode:

• Static view files are not cached; they are written to the Magento pub/static directory every time they’re called.

• Uncaught exceptions are displayed in the browser.

• System logging in var/report is verbose.

• An exception is thrown in the error handler, rather than being logged.

• An exception is thrown when an event subscriber cannot be invoked.

Production Mode

Intended for deployment on a production system.

In production mode:

• Static view files are deployed once and are served from cache only. New or updated files are not written to the file system. Every time a file is requested it is retrieved from the cache.

• The Magento installation directory can have read-only permissions.

• Errors are logged to the file system and are never displayed to the user.

Details:

• The static view files deployment command enables you to write static files to the Magento file system when the Magento software is set for production mode.

• Static view files are located in the <your Magento install dir>/pub/static directory, and some are cached in the <your Magento install dir>/var/view_preprocessed directory.

Default Mode

Magento operates in this mode if no mode is explicitly set.

• Errors are logged to the file reports at the server and are never shown to a user.

• Static view files can be created by request; for example, if they are not in the cache.

• Default mode allows you to deploy the Magento application on a single server without changing any settings.