https://github.com/flancer32/mage2_ext_log_api
Magento 2 activities logger (API, JS errors)
https://github.com/flancer32/mage2_ext_log_api
developer-tools logging magento2-module
Last synced: 4 months ago
JSON representation
Magento 2 activities logger (API, JS errors)
- Host: GitHub
- URL: https://github.com/flancer32/mage2_ext_log_api
- Owner: flancer32
- License: gpl-3.0
- Created: 2018-09-05T13:43:09.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-04-09T04:47:32.000Z (about 6 years ago)
- Last Synced: 2025-08-15T16:39:51.059Z (10 months ago)
- Topics: developer-tools, logging, magento2-module
- Language: PHP
- Homepage:
- Size: 337 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mage2_ext_log_api
Add ability to log:
* REST API requests/responses to server side logs.
* client side JS errors to browser's local storage (with ability to display these errors on the special page).
Compatible Magento versions: **2.2.x, 2.3.x**.
### REST API Sample
See logs in `${MAGE_ROOT}/var/log/api.log`:
```log
2018-09-05 15:08:57-API.INFO - Route: '/rest/ru/V1/guest-carts/fe9cf0d8828fcb219484b39c12b8cdb7/estimate-shipping-methods' => '/V1/guest-carts/fe9cf0d8828fcb219484b39c12b8cdb7/estimate-shipping-methods'
2018-09-05 15:08:57-API.INFO - Request: {"address":{"region_id":null,"country_id":"US","postcode":null},"cartId":"fe9cf0d8828fcb219484b39c12b8cdb7"}
2018-09-05 15:08:57-API.INFO - Response 'Magento\Quote\Api\GuestShipmentEstimationInterface::estimateByExtendedAddress()': [{"carrier_code":"flatrate","method_code":"flatrate","carrier_title":"Flat Rate","method_title":"Fixed","amount":2000,"base_amount":2000,"available":true,"error_message":"","price_excl_tax":2000,"price_incl_tax":2000}]
```
### Frontend Sample

Go to `http://.../fl32log/js/view/`:

## Module Configuration
### Enable additional logging
See `Store / Configuration / Advanced / System / Advanced Logging Settings`:

### Disable "Log JS Errors to Session Storage"
You need to disable "Log JS Errors to Session Storage" that is used for Magento tests (disabled by default).
See `Store / Configuration / Advanced / Developer / JavaScript Settings / Log JS Errors to Session Storage`:

Attention: section `Store / Configuration / Advanced / Developer` is available in `developer` mode only:
```bash
$ ./bin/magento deploy:mode:set developer
```
## Installation
```bash
$ cd ${MAGE_ROOT}
$ composer require flancer32/mage2_ext_log_api
$ ./bin/magento module:enable Flancer32_LogApi
```
if Magento is in `development` mode:
```bash
$ ./bin/magento setup:upgrade
$ ./bin/magento setup:di:compile
```
if Magento is in `production` mode:
```bash
$ ./bin/magento deploy:mode:set developer
$ ./bin/magento deploy:mode:set production
```