Overview
Features
Download
Documentation
Community
Add-Ons & Services

Logging to FileChannel

Please post support and help requests here.

Logging to FileChannel

Postby WITTROCK » 18 Dec 2007, 21:06

I have been playing around with the logging facility of Poco. I notice something which is not a problem, but wonder if there is an easy way around it that I have not noticed.

If I am using a SplitterChannel to route log messages to a ConsoleChannel and a FileChannel. Just for the fun of it I externally "locked" the log file so the FileChannel would not be able to open the file for writing. As expected, an exception was thrown and my application died.

Is there an easy way (without modifying the existing library) to change this behavior without wrapping the the calls to log() in a try-catch. In other words, a way to configure the FileChannel to not throw an exception on failure. The "locked" file is just an example. There are a number of things which could cause an exception while logging I suppose.

I can imagine the logging channel classes supporting some type of "NoException" (sorry for the name, just an example (:smile:) ) property. That way if someone is using the LoggingConfigurator, they could keep a particular channel from killing the application if it were to fail.

Thanks,
WITTROCK
WITTROCK
 
Posts: 10
Joined: 06 Dec 2007, 22:29
Location: United_States

Re: Logging to FileChannel

Postby alex » 21 Dec 2007, 16:27

> I can imagine the logging channel classes supporting some type of "NoException" (sorry for the name, just an example (:smile:) ) property. That way if someone is using the LoggingConfigurator, they could keep a particular channel from killing the application if it were to fail.

There is also a downside to it - if file can not be opened and it's the only log destination, then you are running without logging. But it may be a legitimately desired feature in some scenarios, so why don't you make a concrete proposal (such as a property or a strategy), we'll look into it and if we agree on it, you can go ahead implement and contribute it.

Alex
alex
 
Posts: 1145
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Re: Logging to FileChannel

Postby WITTROCK » 29 Dec 2007, 02:30

> There is also a downside to it - if file can not be opened and it's the only log destination, then you are running without logging.

You are right of course. Once I am back to work, I will put together a proposal as best I can, and you can all let me know what you think. I would be happy to implement the feature I propose.

Thanks,
WITTROCK
WITTROCK
 
Posts: 10
Joined: 06 Dec 2007, 22:29
Location: United_States

Re: Re: Re: Logging to FileChannel

Postby alex » 05 Feb 2008, 16:00

> You are right of course. Once I am back to work, I will put together a proposal as best I can, and you can all let me know what you think. I would be happy to implement the feature I propose.

You may want to look into recently introduced SMTPChannel for an example of optional throw.

Alex
alex
 
Posts: 1145
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron