Overview
Features
Download
Documentation
Community
Add-Ons & Services

Automatic logging on Poco exceptions?

A general discussion forum.

Automatic logging on Poco exceptions?

Postby thready » 16 Apr 2010, 22:28

Hi Poco Experts,

Just wondering - when there's a Poco exception, is there some way to automatically wire them all up to some sort of log file or to the event viewer?

Thank you,
Mike
thready
 
Posts: 39
Joined: 20 Jan 2010, 17:20

Re: Automatic logging on Poco exceptions?

Postby alex » 17 Apr 2010, 13:50

There is a way but it is not a good idea. First, logging itself can throw. Second, logging library will eventually be separated from Poco - having Foundation depend on it would mean cyclic dependency.
alex
 
Posts: 1102
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Automatic logging on Poco exceptions?

Postby thready » 17 Apr 2010, 16:11

Thanks for the reply alex!
thready
 
Posts: 39
Joined: 20 Jan 2010, 17:20

Re: Automatic logging on Poco exceptions?

Postby aderouineau » 17 Apr 2010, 17:27

In main(), you can put this:

// Load Poco logger (if there is a problem the program will exit)

try
{
// Your code
}
catch(Poco::Exception& e)
{
// Log using Poco logger
}
catch(std::exception& e)
{
// Log using Poco logger (will not be as detailed)
}
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron