How to debug and log Magento 2 import and export process and errors

Magento 2 import export debug log

Unfortunately, Magento 2 doesn’t have any import and export logs so that debugging becomes way more difficult than most users expect. How to solve the problem, you will ask? How to debug and log Magento 2 import and export process and errors? We share the answer below, so let’s figure out the most user-friendly approach.

Magento 2 import and export logs

The Magento 2 ecosystem is so huge that many questions have been already discussed on various forums. For instance, Tim asks on StackExchange where Magento 2 import logs are situated. When he tries to import additional_attributes for products, nothing happens: import is completed fine, but his custom attributes are not updated. Therefore, he wonders where logs available for Magento 2 imports are situated. Tim also points to the article called “Are there any csv import logs kept?” which describes a Magento 1 case.

As we’ve just mentioned above, Magento 2 doesn’t have import or export logs, but you can always get the missing functionality with the help of third-party extensions. Let’s see the most user-friendly way of adding Magento 2 import and export logs.

How to add Magento 2 import and export logs automatically

Meet the Improved Import & Export Magento 2 extension – your number one time-saver when it comes to import/export processes. In addition to the dramatically extended data transfer opportunities, our module also enables Magento 2 import and export logs. This feature significantly simplifies debugging since you can find any issue in real time.

Furthermore, the Improved Import & Export Magento 2 extension points you towards errors during a file validation. The module not only shows issues but provides information on how to fix them.

Another important feature is the ability to write logs and send them to your email. Thus, you always get the most in-depth insights into Magento 2 import and export.

All logs are available in the ‘History’ grid:

Magento 2 import export debug log

You can filter out the necessary result by ID or start/end time. Then, each log can be downloaded and explored.

Below, you can see a Magento 2 import log for an individual run:

Magento 2 import export debug log

All data is displayed in real time.

Of course, a CLI run has its import log:

Magento 2 import export debug log

Note that the same logs are available for Magento 2 export processes.

Now, when you know how to enable import and export logs, Magento 2 debugging becomes more clear. Depending on each specific issue, this problem differs a lot. Before going any further, let’s see how to enable Magento 2 logging in another way.

Get Improved Import & Export Magento 2 Extension

How to add Magento 2 import and export logs manually

If you got used to skipping the shortcuts, let’s say a few words about how to add Magento 2 import and export logs manually. The procedure is described in an article on Magento2 Blog. The tutorial about Magento 2 logging explains how to create log messages. The first thing mentioned there is that you can’t log messages by a singleton class – an approach utilized in the case of Magento 1. Now, it is necessary to inject your module with a logger class using a pre-built one or creating your own.

Inject an already existing logger to add logging features to your module and classes. Use the following code:

Add it to your own model class to enable a call of runImport() to lead to the following log message:

There are eight predefined logging levels to choose from. These are a few possible options:

It is also possible to use the PSR-3 Logger module which is implemented in Magento 2 by default. Being based on RFC 5424 standard, it is reusable and offers eight log levels:

  1. Debug
  2. Info
  3. Notice
  4. Warning
  5. Error
  6. Critical
  7. Alert
  8. Emergency

But using a pre-implemented logger is not mandatory since you can always develop your own solution:

  • define log levels;
  • create a logging module;
  • make it reusable.

That’s it! The procedure is quite easy but at the same time way more complicated than adding Magento 2 import and export logs automatically. Therefore, let’s return to the Improved Import & Export Magento 2 extension to explore its features and find out how the module helps to debug Magento 2 import and export process and errors.

How to debug Magento 2 import and export process and errors

Magento 2 import export debug log

The Improved Import & Export extension has already saved hundreds of merchants worldwide. People who face integrations, data transfers, and synchronizations with external systems also encounter multiple bugs and errors. But you can easily solve them with the help of Improved Import & Export. Below, we shed light on its core features that dramatically improve your daily routine helping to debug Magento 2 import and export process and errors or avoid them. Let’s take a look at the automation of data transfers first.

Automated Import & Export Processes

The Improved Import & Export extension provides two different ways of automating data transfers. The module allows creating update schedules or specifying event-based triggers that launch import and export processes.

Schedules

The magic behind schedules is based on cron. This technology allows you to create any custom update schedule. Apply the default cron syntax to do that. If you are looking for a more convenient option, select one of the predefined intervals. Note that they can be customized if necessary. Magento 2 import and export logs are not only run automatically but logged by our extension so that you can check each individual run.

You can also create profiles that have no schedules. They are especially useful if there is no need to run frequent updates, a single data transfer is required, or updates are provided asynchronously. At the same time, every profile can be launched manually despite any automation. Import and export logs are available for any schedule.

Configuring a schedule is a very straightforward procedure:

Events

As for events, they represent an alternative way of automating import and export processes. Magento 2 import and export logs are created automatically for each event-based run!

The Improved Import & Export extension offers several handy improvements enabling real-time updates. Imaging that a customer places an order. This event can be used as a trigger that export order data to an external system and, consequently, launches Magento 2 export logging.

Note that you can not only select system events but specify custom ones (logs are written in any case). After a trigger is defined, create conditions to make its work more efficient. For further information about this feature, follow this link: How to Run Magento 2 Import or Export After Specific System Event or Process.

Advanced Mapping Features

Most import bugs are caused by the problem of different attribute standards that prevents you from direct transfers into your e-commerce store. And while Magento relies on its common data model definition, various external systems are not compatible with it; as a result, your import files need debugging. Even Magento 1.x is not an exception. Thus, a seamless connection with tools beyond the 2.x is often hard to achieve. But the Improved Import & Export Magento 2 extension dramatically simplifies the Magento 2 import and export processes and errors debugging with the help of the following features:

Mapping Presets

Our extension lets you solve the problem of different attribute standards within a few clicks. The Improved Import & Export module offers a list of presets that match external designations to the corresponding internal ones automatically. Your duties are reduced to selecting and applying a preset related to your integration. That’s how you debug import errors caused by different attribute standards. The process is automated since our extension analyzes the input data and matches all third-party attributes to the corresponding ones used within your Magento 2 database.

In the case of the default attribute editing, it is necessary to transfer data via files and edit their content manually. The more attributes they include – the more work should be done. But the Improved Import & Export Magento 2 module lets you forget about that. Check the following image that illustrates the simplicity of the process:

Matching Interface

At the same time, you can debug Magento 2 import and export process and errors manually. Our module enables you to map attributes in a user-friendly interface situated right in your admin. Select a third-party designation and specify the corresponding internal one in front of it. Do that for every external attribute. The process has the following look:

And there is an opportunity to set hardcoded attribute values. The grid above includes the third column called “Default Value.” Set an attribute value here which will be provided to all items related to the attribute.

Attribute Values Mapping

Some import errors are caused by unsupported attribute values, but you can easily debug them with the Improved Import & Export Magento 2 extension. The module allows you to map attribute values in the same way we’ve just matched attributes.

The Improved Import & Export Magento 2 module provides the easiest solution, which is based on the same logic as the attributes matching described above. Of course, it is not as fast as selecting and applying a preset, but much quicker than doing everything in other ways.

So, you only need to select a third-party designation and specify the internal one in front of it. Note that the process should be applied to all external attributes. That’s how you debug a part of Magento 2 import errors. For further information, follow this link: Attribute Values Mapping.

Attribute Values Editing

To improve your interaction with attribute values, we’ve also introduced the ability to edit them in bulk. The Improved Import & Export Magento 2 extension offers the following rules:

  • Add a prefix to attribute values in bulk;
  • Add a suffix to attribute values in bulk;
  • Split multiple attribute values;
  • Merge multiple attribute values.

Feel free to combine them and create conditions to increase the efficiency of their use. For further information, read this article: How to Modify Attribute Values During Import and Export in Magento 2.

Category Mapping

When it comes to moving product data from a third-party system to your Magento 2 store, you may face lots of inconveniences caused external catalogs. Although external product categories never lead to bugs, they may be a reason for unnecessary time expenditures. Since the update may contain categories unrelated to yours, you add them to your frontend after the import is complete. Next, it is necessary to edit the occasionally modified catalog.

Instead, the Improved Import & Export Magento 2 extension lets you match the external categories to the ones used internally right during the import process. The following image illustrates the procedure:

If necessary, you can even create new categories on the fly: select a parent category and specifying the name of a new one. That’s it! Both features are described here: Category Mapping.

Attributes On The Fly

The lack of attributes also causes Magento 2 import errors. To debug them, our module lets you create missing attributes on the fly. With the Improved Import & Export Magento 2 extension, you can specify all the necessary parameters using the following general form:

Attribute|attribute_property_name:attribute_property_value|…

The full process is quite complex, so we described in more details here: Product attributes import.

Extended Connectivity Options

The standard data synchronization between Magento 2 and other platforms is based on CSV files. If an update file is provided in another format, it causes import errors. How does Improved Import & Export solves the problem? Actually, it’s not a debugging but the ability to leverage multiple file formats and various connectivity options.

Multiple File Standards

The Improved Import & Export Magento 2 extension essentially increases the number of supported standards. While Magento is bound to CSV, our tool adds support for XML, JSON, ODS, and Excel. You can freely import and export data using these formats with all the extension’s features. It means that all transfers can be fully automated. At the same time, you can efficiently match attributes and their values despite the format of the imported file.

Multiple File Sources

To make file transfers more flexible, the Improved Import & Export Magento 2 extension also offers several connection points:

  • FTP/SFTP connection allows leveraging a local or remote server as a place of transfers.
  • The same functionality is possible with a Dropbox account. Alternatively, you can rely on Box, OneDrive, Google Drive, iCloud, and Amazon Drive.
  • When you want to transfer data to your website, a direct URL is enough.

It is also worth mentioning that our module lets you prevent errors caused by compressed files. It extracts compressed data automatically, so you no longer need to do that manually.

Alternative Ways of Import & Export

And don’t forget that our extension lets you establish a direct API connection between your website and other external systems. The Improved Import & Export Magento 2 module leverages REST, SOAP, and GraphQL APIs to synchronize your e-commerce store with any third-party platforms.

At the same time, the module allows using different online sheets for various data exchange purposes. Create a bridge between your Magento 2 website and external platforms using Google Sheets, Office 365 Excel, or Zoho Sheet. Integrations on the basis of the first service look as follows:

Magento 2 import export debug log

Watch the following video to see the extension in action:

Conclusion

As you can see, the easiest way to debug and log Magento 2 import and export process and errors is related to the Improved Import & Export extension. Of course, you can add logging opportunities manually, but the procedure is a little bit more complicated than the automated one and doesn’t let you debug or prevent errors. Thus, our module is the best solution for achieving your goal especially because Magento 2 doesn’t provide any logs by default. For further information, follow the link below and contact our support:

Get Improved Import & Export Magento 2 Extension