The word 'logic' is used in different senses depending on context, and arguably it has shifted in meaning over time. Historically, logic is concerned with rational belief and inference. It is the study of what distinguishes a good argument from a bad argument. As such, it is closely related to how people think and how people ought to think. Hence it was considered to have a normative element to it: you ought to reason correctly and you ought to avoid fallacies.
Sometimes the sense is even broader and 'logical' becomes almost a synonym for 'rational'. We may have Mr Spock to blame for this. According to him it is illogical to cause the death of a species of whale. What exactly that has to do with correct reasoning and argument is not clear, but it is a common usage.
As our understanding of logic and reasoning progressed, it was natural to express it using formal rules. Aristotle, the stoic philosophers, the medieval logicians, Leibniz, Boole and many others made advances in this direction. As late as the mid-19th century, logic was still viewed as being mainly about how people reason. Fundamental principles of logic were called "laws of thought".
A significant break came with Frege at the end of the 19th century. Frege and his contemporaries advanced the idea that logic is not fundamentally about reasoning but about the relationships of logical consequence between propositions. Logic is the study of what follows from what. Logic describes and catalogs these relationships but it is not normative.
Frege's approach proved very fruitful. As the 20th century progressed, it resulted in powerful formal systems of logic. It allowed us to formulate axiom systems for arithmetic and other branches of mathematics. It led to the development of proof theory and model theory. It led to a formal understanding of computation. As a result, 'logic' is often used today in a much more narrow way to refer to the study of these formal systems.
That said, logic is not just the concern of mathematicians and computer scientists. Linguists, cognitive psychologists and AI researchers have a stake in contributing to our understanding of logic. Some philosophers pursue research in logic and continue to extend its boundaries.
The upshot is that there is no simple definition of logic. Logicians themselves disagree over exactly what counts as logic and where the boundaries are between logic and non-logic. Some regard formal logic as an attempt to create an ideal language. Others as a way to improve and regiment our existing natural languages. Others see logic as an abstract formal model of language.
There are many books on the philosophy of logic that cover this and other questions. Some are:
- Daniel Cohnitz and Luis Estrada-Gonzalez, An Introduction to the Philosophy of Logic.
- Susan Haack, Philosophy of Logics.
- Graham Priest. Doubt Truth to be a Liar.
- W.V. Quine, Philosophy of Logic.
- Ian Rumfitt, Boundary Stones of Thought.