It is always a risk for any president to initiate military operations against another country. The certainty that American lives will be lost, that the costs of military activities are very high and may require increased tax rates to pay for those activities, and the risk that the military operation may fail are all factors to be considered by presidents.
A fundamental flaw in the question, however, is the suggestion that President Madison "declared" war on Britain. Under the United States Constitution, only Congress can declare war on another country. That said, American history is full of examples of presidents commiting military forces to action without a formal congressional declaration of war. That Congress did, in fact, make such a declaration on June 18, 1812, however, validates the action, at least in legal respects. How much Madison supported the notion of going to war with Britain is uncertain, as he did not request such a declaration. By communicating with Congress the grievances that the United States held with regard to Britain, and Madison possessing a very good understanding how the U.S. Government operated, it can be surmised that he did not oppose the declaration of war.
As stated in the opening paragraph, there are always serious risks associated with a decision to go to war, no matter how meritorious the reasons. For Madison, the risks were extremely serious; in fact, the risks of going to war with Britain were existential. The United States was struggling to survive as an independent nation. Britain, while mired in a major conflict with France, still possessed formidable military strength relative to the Americans. America was politically divided, and the British provocations -- for example, restricting the United States' ability to trade with France, supporting native tribes in their efforts at protecting Indian territories from further American encroachment, and Britain's practice of forcing American sailors to serve aboard British vessels -- created an environment in which many politicians were supportive of war.
The burning of Washington and economically-devastating blockade of U.S. merchant shipping that resulted from the declaration of war illuminated the scale of risk that Madison faced. That the United States survived the war was not a foregone conclusion.