Flogging of kids by African parents, and Nigerian parents in particular, has been used to manually reset erring children since millennia.
Now, in this age, especially coming on the heels of western practice, this habit is considered to be a form of child abuse.
What works in different societies and cultures are naturally different. We have to understand that with each generation, kids get smarter and more knowledgeable than the previous and adopting the law of seeing cane use as a form of child abuse would only lead to having a generation of kids too unruly to handle.
The holy books also said we should not spare the rod and spoil the child.
So the use of cane by parents shows the kids who is in charge and instils a sense of fear in them, knowing there are consequences to bad actions done, unlike a situation where the use of the cane is prohibited. Like the western culture, they encourage having conversations with kids about wrongdoings.
When a child knows you are all talk and no action, they take everything for granted and only endure your rants for the time being and go ahead to do worse things.