At https://www.drupal.org/node/2560435#comment-10282161, webchick expressed concern about the fact that the per-migration message tables do not use the PSR-3 compatible logging interface the rest of core does. Let's look at how they were used in D7 migrate. When messages were logged for specific items being migrated, they were stored in the migrate_message table corresponding to that migration, keyed by the source ID for each item (note that each migration has its own table, because the source key schemas vary for each migration). From the migrate dashboard, you could click the # messages column to arrive at a view of the messages:
We want to be able to display the messages for a given migration, and we want to be able to sort/query on the specific source IDs. Also, outside of the migration tools themselves, it was very common to query the message table directly for QA purposes - e.g., "SELECT CONCAT('http://example.com/node/', sourceid1),level,message FROM migrate_message_blog WHERE message LIKE '%missing related article ID%'" to generate a spreadsheet for manual review linking straight to source pages.
Another aspect of migration message handling that doesn't map well to simply using dblog is that we don't want to accumulate messages. That is, if we run the user migration, get a notice, fix the problem and rerun it, we should now see no messages. So, as the migration process fetches each source item to process, it deletes existing messages for that item.
That all being said, could we reimplement the message table handling as an implementation of LoggerInterface? Looking at the dblog implementation as an example:
- We can pass the migration and source ID to log() in $context.
- From the passed migration, we can derive the migration-specific table to use (because one migration might have an integer source ID, another might have a string, still another might have a multi-column key).
- Add a delete() method to remove the messages for a given source ID.
- Add a retrieval API (which we just did for the existing implementation: #2560435: Need an API for retrieving migration messages.
So, at this point I'm not seeing a big upside to this approach, but opening the issue for discussion...
Comment | File | Size | Author |
---|---|---|---|
migrate_messages_example.jpg | 31.16 KB | mikeryan |
Comments
Comment #3
mikeryanComment #4
mikeryanIt doesn't seem like there's a lot of interest in this - we're trying to get the migration APIs locked down for 8.2.x, and it's not looking like this one is going to happen. Postponing for 9.x.
Comment #5
catchThis could be done in a minor release, it doesn't have to be done of course, but I don't see anything that couldn't be done with a bc layer.
Comment #6
heddnPer #5, removing BC breaking tag.
Comment #8
mikeryanThis could be pursued if it comes with a BC layer.
Comment #9
claudiu.cristeaMy 2 cents from recent projects. The content managers/admins are not tech guys. Sometimes, it's even hard for them to understand how we split the whole migration in small migrations. When it comes to main objects like node articles or events it's clear for everybody, but when discussing about migrating text formats or other more technical migrations (field instances?) they are lost. What they desperately need from us is a good list of data inconsistencies. Our migration log should be able to produce such a list on a per-migration basis but the migration should be just a specific filter. More important is to be able to output and export the entire unified log, regardless of migration. We should think on how to store all the entries in a single storage, so we can query in multiple ways. I think a content entity is needed and let Views to the rest.
Comment #14
heddnThis won't be happening any time soon. Ideally we'll incubate this in contrib first as well. So going to close this issue down. If this does get fixed, it will be brought in via contrib and not this issue.
Comment #15
claudiu.cristeaI don’t think this is a good reason to close this issue. I had several migrations with similar requests. Let’s keep it open, at least, to track and evaluate possible candidates from contrib.
Comment #17
Wim LeersRelated: #3095456: [Plan] Discuss strategy for long-term use of entity validation in the migration system.
Related: #3063856: Add ability to view migrate_message table data.