If it is not poisoning it could be Atopy, or food allergy dermatitis, which should also be addressed by a veterinarian.
Allergies are something that a dog will have for life. There is no cure, but there are many treatments. Treatments include antihistamines, steroids, drugs like Atopica, hypoallergenic foods, desensitization therapy, and more.
Occasionally, constant licking of the legs can be a behavioral abnormality due to boredom or a compulsive behavior.