Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
To solve #2842222: D7 Plain text fields incorrectly migrated to D8 as Text (formatted), we'd like to log a message to the migration message table.
Proposed resolution
Create a process plugin that logs a value. It should have a fluid interface and return the same value passed into it. It should have a single config parameter to configure the log level.
Remaining tasks
Source values of the plugin is the log or error message.
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#24 | log_plugin_output.png | 83.38 KB | mikeryan |
#8 | 2872812-9.patch | 2.24 KB | rakesh.gectcr |
#7 | 2872812-7.patch | 2.24 KB | rakesh.gectcr |
#7 | interdiff-2872812-4-7.txt | 2.35 KB | rakesh.gectcr |
#4 | 2872812_4.patch | 1.85 KB | cosmicdreams |
Comments
Comment #2
heddnComment #3
vasi CreditAttribution: vasi at Evolving Web commentedHere's a first stab at this, which someone else can try to finish. It even supports substituting text!
TODO:
* Better docs
* Figure out whether we want to log unconditionally (and use skip_on_empty to not log), or have an implicit condition (eg: if source is some value).
* Figure out how we want substitution to work. I chose to make the entire Row source available for substitution, as well as other things in a 'context' section. But that's pretty complex!
* Figure out where we should log to. Choices include:
* The dblog
* The IdMap message. This allows us to associate the message with a particular row, which is nice! But I think we can have only one message per row.
* The MigrateMessageInterface. I think this is what's shown in the UI. But there's no easy way to get it from a process plugin, so we'll need to build a way. Maybe with a new interface that MigrateExecutable can implement?
* Write tests
Comment #4
cosmicdreams CreditAttribution: cosmicdreams commentedThat's really great work @vasi. I had an opportunity to talk to Lucas about this issue and it sounded like instead of using the system's logger to log these we want to use the MigrateExecutable's saveMessage() method. So like the patch I just attached. What do you think?
Comment #5
rakesh.gectcrComment #6
rakesh.gectcrHowever, we needed add tests.
Comment #7
rakesh.gectcrHad a light discussion with Mike,
Removed the constructor and create function. Because we are not using either of it. Looks like a simple straight forward one.
Tried rolling the test as well.
Comment #8
rakesh.gectcrOops new line is missing.
Comment #9
rakesh.gectcrComment #10
ohthehugemanatee CreditAttribution: ohthehugemanatee as a volunteer commentedLooks good to me. Also, lol at "buffalo" as the destination. :)
Comment #11
heddnI think we need to be migrating 8 buffaloes. But that is just a small bikeshed, so +1 on RTBC.
Comment #12
vasi CreditAttribution: vasi at Evolving Web commentedIf we log messages this way, will the messages be seen in the Migrate UI? That's the imagined use-case, so we should verify that.
Comment #13
ohthehugemanatee CreditAttribution: ohthehugemanatee as a volunteer commentedIf migrate UI doesn't read messages from the migrate log, that's migrate UI's problem. This patch correctly tests that the message makes it to the migrate log, which is the scope of this issue.
Comment #14
heddn@vasi, I think both ways of logging go to the same location. I'm not sure though if anything get's surfaced to the UI or not. Adding a tag for some manual testing. Part of the point of using this process plugin was in hopes we could throw errors at the user that would surface to the client in the web UI. If that isn't possible with the approach we are using, then we might need to log the errors differently?
Comment #15
heddnMarking this critical since it is a pre-task for #2842222: D7 Plain text fields incorrectly migrated to D8 as Text (formatted), which is also critical.
Comment #16
catchDoes the logging actually block that issue, or is this something that could be worked on in parallel?
Comment #17
heddnNo, it actually blocks the other issue. We need to log an error when a couple things occur. This would let us do that.
Comment #18
cilefen CreditAttribution: cilefen commentedCould you expound on how the need for logging blocks? I read the comments on the blocked issue but it isn't clear to me.
Comment #19
rakesh.gectcr@heddn,
After applying the patch#8
I am trying to do the manual testing, Trying to migrate users from a csv file , which is following (migrate_source_csv)
Here is yml file
which is migrating all the rows. and gives the following status
I am trying to find the log, not able to find in the migration table. Am I missing something on the
?
I know its a stupidity to ask, still Where can I find the logs? :(
Comment #20
heddnre #16/#18, I've updated the IS of the parent. One of the things we are doing is loudly logging an error to the migrating user if the fallback text filter doesn't exist.
re #19: to see log messages, run
drush mmsg <migration_name>
But based on the fact that you didn't see anything spit out to the console when running the migration, this didn't run as we were hoping/expecting. It should throw something more visible to the screen.
Comment #21
catchI understand that logging could/will block the ability to show a message to the user in the case of an error condition, but does it block anything else in that issue?
Comment #22
rakesh.gectcr@heddn
Cool, its working,
It was my bad, I was not aware of how to check the log, When i am checking
I am getting the following log message.
I uploaded a testing video in youtube, Please check the following link
Migration log process plugin manual testing
Comment #23
mikeryanComment #24
mikeryanI modified d6_user.yml to log a message:
When running the upgrade process through the UI, the messages displayed as expected:
Code looks good, let's unblock the text format issue...
Comment #25
catchThe impression I got from #2842222: D7 Plain text fields incorrectly migrated to D8 as Text (formatted) was more of a validation step/drupal_set_message() warning before the migration happens, this looks like it will just be logged after the migration runs?
Comment #26
heddnWe were never planning to do a pre-audit in the parent issue. The logging here is only tell the end user that the fall back text formatter doesn't exist.
Comment #31
catchHmm I guess if we skip the table that's also going to end up as a warning, but that feels like something that we can resolve in the main issue, so committed/pushed to 8.4.x and cherry-picked to 8.3.x
Made the following fixes on commit:
Comment #32
cosmicdreams CreditAttribution: cosmicdreams commentedawesome!