From the days of ancient Greece the relationship between mathematics and logic has been close.
Aristotle's syllogistic logic, together with the Axiomatic Method exemplified by Euclid's Elements
provided logical and methodological underpinnings for mathematics which were regarded as definitive for over 2000 years.
In the 19th century major advances were made in the foundations of analysis, leading ultimately to a virtually complete formalisation of mathematics. Frege exposed deficiencies in Aristotle's Logic and offered instead his Begriffschrift (formula language). He then showed in Grudgesetze der Arithmetik (the logical foundations of arithmetic) how arithmetic could be formalised in his new logic.
Frege's logic was soon shown to be inconsistent, by Russell's Paradox, but within a few years alternative logics were devised which incorporated the essential advances made by Frege while avoiding inconsistency (so far as we can tell).
Further developments in Logic have continued throughout the 20th Century, and there are now many alternative logical and/or philosophical foundations for mathematics. The relative merits of these remains a matter for debate.