When I first played DA:O and witnessed what Loghain had done, I was furious, I though Cailan, while somewhat goofy, and a bit of a glory hound (I more thought he was trying to grow out of his fathers shadow) he was a good king. My first playthrough I executed Loghain, no qualms about it. Then I read the books, and found some things out about Cailan, such as his alleged affair, and willingness to hand over all of Ferelden to Orlais...again. (Ostagar DLC, and information from the wiki)
In the book's without revealing to much, Loghain is not an honorable man, his father was more honorable then he was (imho), but he does love Ferelden, and hates Orlesian's (rightfully so after what they did). What the books did, is given him a personality, and make him seem human, rather then a crazy power hungry usuper. On my next playthrough I saved him, while I feel bad for Alistair, on not getting his so called "justice" (seriously that man needs to get over it..I like Alistair for the record) I felt like Loghain saved Ferelden's independence, by preventing Cailan from marrying Celene.
Do I think he went about it the right way? Absolutely not, he could have just as easily presented evidence that Cailan was in bed with Celene, and gathered the nobles to vote/usurp him off the throne, however this is more of a what if and i have digressed from my main point. Which is like Faewalker stated, the overall judgment is up to the player, do you hate him? Do you think he did what was right? Did he withdraw? Did he just want power? etc.
I hated Loghain for what he did, and executed him once. Then I found out more about his past, and Cailan, and decided while he is not the most honorable man, he did save Ferelden's independence, and that there are far far, worse punishments then death.
Lastly, on Cailan not knowing he had an heir, it is easy to infer that Cailan knew Alistair was his brother. Why is this easy? Books, that's all I am going to say.