Describe how to use Magento modes. What are pros and cons of using developer mode/production mode? When do you use default mode? How do you enable/disable maintenance mode?

    There are three Modes in Magento 2

    Default mode

    By default, When there is no mode it will be default mode.This mode is set by default during the initial Magento installation.

    Error are not displayed in this mode but they are logged in files var/log. Files in pub/static are generated on the fly, and then cached

    Unlike the developer mode, the file changes are not displayed until the generated static view files (var/view_preprocessed) are cleared

    Developer mode

    In developer mode, static files are generated in each request. In pub/static symlinks are installed on real files from modules and libraries.


    The advantage of this mechanism is that it immediately displays all the changes that you make. The disadvantage — decrease in performance due to the lack of static content caching.

    Uncaught exceptions are displayed. Additionally, you need to configure app/bootstrap.php.

    12error_reporting(E_ALL);ini_set(‘display_errors’, 1);

    Error logging in var/log/exception.log.

    It is recommended for development and customization of modules or themes only. Its main advantage is the display of errors in the browser.Cache is not used in developer mode.

    In Developer mode, static view files are generated each time they are requested. They are written to the pub/static directory. Any changes a developer mode will be visible immediately.

    Uncaught exceptions can be displayed in browser, hence of being logged. An exception is thrown.

    Production mode

    As shown by its name its for production mode only. When switching to this mode errors will not be displayed and only logged in file. In this mode static files will not be generated on fly but will be deployed to the pub/static directory once using command.  This mechanism allows you to significantly increase the performance, but it is required to redeploy static content after each change.

    About Author

    You may also like

    No Comment

    You can post first response comment.

    Leave A Comment

    Please enter your name. Please enter an valid email address. Please enter a message.