What's the relation between logic and algebra?
Can one be thought of as a special case of the other?
Logic and algebra are related, but one is not a special case of the other. While some aspects of each field may be fruitfully captured using the language of the other one, there is no global theory of one field in terms of the other field.
For example, model theory, which is part of logic, has, as far as I know, no direct analogue in algebra, whereas Galois theory, which is part of (abstract) algebra, has no counterpart in logic.
If you are referring to Boolean Logic, it is a type of algebra.
That would be statements of the type:
$\lnot (P\land Q) \equiv \lnot P \lor \lnot Q$ (Demorgan)
$P\land (Q \lor R) \equiv (P\land Q) \lor (P\land R)$ (Some sort of distribution)
I read that back in the day, they were obsessed with solving polynomials in closed form. But once the unsolvability of the Quintic (degree-5) polynomial was demonstrated, the focus of Algebra began to be on general rules for Algebra, and things like:
became important, and the operations became more general than the +, -, ×, and ÷ of elementary algebra.
Thus you have things like the above, where you have operators like $\lor$ and $\land$.
The study of general algebraic systems and their properties is known today as Abstract or Modern Algebra.
Furthermore, Boolean Logic underlies, and is near identical to, set theory, which is very important in Mathematics. I was told by someone once that the two were developed in conjunction.
Consider the algebra of the natural numbers. The algebra of the natural numbers is really just the arithmetic of the natural numbers. The axioms for natural number arithmetic (e.g. the Peano axioms for natural numbers) can be expressed in the language (notation) of logic and set theory. The axioms of set theory, in turn, can be expressed in the language of logic. To derive the theorems of natural number arithmetic (algebra), we apply the axioms of logic and set theory to the axioms of natural number arithmetic.
Other forms of algebra start with a different set of axioms (also expressed in the language of logic and set theory). To derive the theorems of that algebra, we also apply the axioms of logic and set theory to the axioms for that algebra.
Axioms for an algebra (or arithmetic) are generally characterized by a single underlying set (e.g. the natural numbers) and axioms describing 1 or more binary operators on that set, or, as is the case with the natural numbers, these binary operators can be constructed using the axioms of logic and set theory starting with an underlying unary operator on that set (e.g. a successor function).
Most mathematicians will understand the term logic as in mathematical logic. There are textbooks on mathematical logic, which deal with predicate logic, first order logic, modal logic and other topics. However logic is a much wider term. Logic would cover all sound reasoning and therefore include algebra. A related question could be: is all sound reasoning a subset of formal reasoning? Is all formal reasoning mathematics? These are very difficult questions, which are usually outside the realm of mathematics and part of philosophy, which is why mathematicians have dubbed their subset as mathematical logic. A lot of 20th century philosophy, analytical philosophy, deals with these questions. Frege, Russell, Wittgenstein, Quine, Putnam and others have a lot to say about the relationship between logic and mathematics (algebra).