cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: cvs commit: xml-cocoon2/src/java/org/apache/cocoon Cocoon.java
Date Wed, 11 Sep 2002 14:52:35 GMT
Nicola Ken Barozzi wrote:

>
> Sylvain Wallez wrote:
>
>> cziegeler@apache.org wrote:
>>
>>> cziegeler    2002/09/11 03:08:36
>>>  
>>>
>> <snip/>
>>
>>>  Index: ActionSetNodeBuilder.java
>>>  ===================================================================
>>>  RCS file: 
>>> /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActionSetNodeBuilder.java,v

>>>
>>>  retrieving revision 1.3
>>>  retrieving revision 1.4
>>>  diff -u -r1.3 -r1.4
>>>  --- ActionSetNodeBuilder.java    24 Jun 2002 20:32:19 -0000    1.3
>>>  +++ ActionSetNodeBuilder.java    11 Sep 2002 10:08:33 -0000    1.4
>>>  @@ -101,7 +101,6 @@
>>>               } else {
>>>                   // Unknown element
>>>                   String msg = "Unknown element " + name + " in 
>>> action-set at " + childConfig.getLocation();
>>>  -                getLogger().error(msg);
>>>                   throw new ConfigurationException(msg);
>>>               }
>>>           }
>>>  
>>>
>>
>> <snip/>
>>
>> I'm a little bit disappointed by this update. Because of lack of 
>> time, I didn't participate to the "Make errors caught only by 
>> Cocoon.java" discussion, and I agree that _exceptions_ should be 
>> logged only once.
>>
>> Now the above change removes the log of a _message_ and not that of 
>> an _exception_. I explained in
>> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=100884840411961&w=2 
>> why I think logging a message when an exception is _thrown_ (and not 
>> catched) is good :
>> - the message is logged into the component's category,
>> - the context may contain additional information placed there by the 
>> callers.
>>
>> Also, I don't consider this as over-logging :
>> - a _message_ is logged when the error condition is encountered (and 
>> the exception thrown)
>> - the _exception_ is logged when some high-level class (here Cocoon) 
>> catches the exception and cannot take a corrective action when 
>> receiving that exception.
>>
>> Thoughts ?
>
>
> I strongly think that errors should not be caught where originating, 
> even if only for logging.


Ahem... does the above have sense ? How can you catch an exception where 
you originate it ? ;-)

> Exceptions must be caught *only* when handled.


That's exactly what I say in the mentioned post.

> Logging it is *not* handling it.
> This is how exceptions must be done in Java throughout, not only a 
> Cocoon thing.
>
> BUT
>
> In the above case, it is starting to throw something, so it's ok, and 
> even good, that something is logged.
> It's not the exception being logged, but the event that will cause the 
> exception to be thrown. 


That's exactly what I mean.

Carsten, what do you think ?

Sylvain

-- 
Sylvain Wallez
  Anyware Technologies                  Apache Cocoon
  http://www.anyware-tech.com           mailto:sylvain@apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message