This article shows some of the configuration settings and CLI commands that are useful for developers in their development environment.
For example, enabling logging, enabling template path hints, disabling forced admin password change, etc.
Disable password change
From Magento admin
Stores > Configuration > Advanced > Admin > Password Lifetime(days) = 0
Stores > Configuration > Advanced > Admin > Password Change = Recommended
From command line
bin/magento config:set admin/security/password_lifetime 0
bin/magento config:set admin/security/password_is_forced 0
Read more: Disable password change
Increase admin session lifetime
From Magento admin
Magento admin > STORES > Settings > Configuration > ADVANCED > Admin > Security > Admin Session Lifetime (seconds)
You can set the value in seconds.
3600 = 1 hour 86400 = 1 day (24 hours) 31536000 = 1 year
From command line
bin/magento config:set admin/security/session_lifetime 86400
Read more: Increase admin session lifetime
Enable developer mode
Check the current deploy mode
bin/magento deploy:mode:show
Set the deploy mode to “developer”
bin/magento deploy:mode:set developer
Disable Two FA
bin/magento module:disable Magento_TwoFactorAuth
bin/magento cache:flush
Or,
bin/magento config:set twofactorauth/general/enable 0
bin/magento cache:flush
Enable database log
Enable database query log
bin/magento dev:query-log:enable
Disable database query log
bin/magento dev:query-log:disable
Database query log saved in var/debug/db.log
.
Note: this
db.log
file will quickly increase in size based on the site visits and activity. It’s a good practice to disable the database query log after we have done DB query debugging.
Read more: Enable database log
Enable Template Path & Block Class Hints
From Magento admin
Enable template path hints for storefront
STORES > Configuration > ADVANCED > Developer > Enable Template Path Hints for Storefront = Yes
Enable template path hints for backend/admin
STORES > Configuration > ADVANCED > Developer > Enable Template Path Hints for Admin = Yes
Enable block class type hints for storefront
STORES > Configuration > ADVANCED > Developer > Add Block Class Type to Hints = Yes
From command line
Enable template path hints for storefront
bin/magento dev:template-hints:enable
bin/magento cache:flush
Disable template path hints for storefront
bin/magento dev:template-hints:disable
bin/magento cache:flush
Enable block class type hints
Using n98-magerun2 CLI tool:
n98-magerun2.phar dev:template-hints:enable
n98-magerun2.phar dev:template-hints-blocks --on
bin/magento cache:flush
Disable block class type hints
n98-magerun2.phar dev:template-hints:disable
n98-magerun2.phar dev:template-hints-blocks --off
bin/magento cache:flush
Read more: Enable Template Path & Block Class Hints
Hope this helps. Thanks.