Using the ShipperHQ Logger in Magento 2

The ShipperHQ Magento 2 extension comes with the comprehensive ShipperHQ Logger. This enables you to inspect the workings of the extension, and if necessary, provide ShipperHQ logs when raising support calls. We have created a screencast which walks through how to use the ShipperHQ Logger. .

Manual Configuration of the Logger

Key Features

The logger gives you the following capabilities:

  1. Dedicated log panel within admin, no need to open log files
  2. Ability to set logging level to show more/less logs
  3. Log to admin, file system and/or via email

Additionally we have added the following functionality:

  1. Runs asynchronously, reducing impact on performance to a minimum
  2. Ability to switch off when in production, will not affect performance at all
  3. Periodic Cron job which clears out WebShopApps extension related logs from the database

Configuration

The Logger is configured under Stores->Configuration->Advanced->ShipperHQ Logger. You'll want to flip Enabled to 'Yes'.

Screen Shot 2016-05-17 at 5.03.46 PM

Before you configure logging please consider how you wish to use it.  Answer the following:

  1. Do I want to log to the admin panel, the system log, or send each log via email?
  2. What level of logging do I need?

The sections below will help you answer each of these questions. Once you have changed your configuration then you will need to re-exercise the ShipperHQ extension code on the frontend in order to get logs to appear. For shipping extensions this means by getting a shipping quote in cart or checkout.

Where Should I Log To?

In the configuration you can select where to output logs to, and at

A. via Admin Panel

For most customers logging to the admin panel will suffice. Logs will by shown under System->ShipperHQ View Log

An example output will be a grid of logs. Depending on the log level set you will see more/less logs. If you do not see logs please firstly refresh the page, then check you have exercised the relevant extension, have set Debug to Yes on the shipping method configuration page and have configuration setup correctly for the Logger.

Screen Shot 2016-05-17 at 5.47.00 PM

You have the ability to filter, sort, and display extra information on each row in the log. We highly recommend if you are testing that before you run a test you select all logs and then click 'Destroy all logs' to remove them. This will ensure the logs make most sense, as they will then only relate to last test.

B. via File System

We also support output direct to the file system under /var/log/system.log.  You will need to have developer logging enabled to use this facility. This is recommended only for advanced users.

What level of logging do I need?

There are 4 levels of logging you can choose, choosing one will include all levels above it, i.e. if you choose debug then info, warning, critical will also be captured.

Level Description Recommended for
Critical Displays critical issues such as unable to process data  Useful in testing, set to log to email and receive notifications of any issues found. Don't see this as a replacement for actual manual testing though!
Warning Displays warning messages, e.g. a rate cannot be found for this zipcode Useful to highlight any issues in testing
Info Gives high level informational messages in a format that can be understood When you want useful information on the working of the extension
Debug In depth technical information on an extension Expert users only, much of information will not make sense, this is primarily used by WebShopApps to see debugging. You may be asked to create debug logs to send to WebShopApps so we can see your configuration setup
When running in production we recommend that all logging is switched off for performance reasons.