Hello,
The intended behavior is explained in the docs for Appender.requiresLayout()
/** * Configurators call this method to determine if the appender requires a * layout. If this method returns <code>true</code>, meaning that layout is * required, then the configurator will configure an layout using the * configuration information at its disposal. If this method returns * <code>false</code>, meaning that a layout is not required, then layout * configuration will be skipped even if there is available layout * configuration information at the disposal of the configurator.. * * <p> * In the rather exceptional case, where the appender implementation admits * a layout but can also work without it, then the appender should return * <code>true</code>. * </p> * * @since 0.8.4 */ public boolean requiresLayout();
The current implementations of DOMConfigurator (marked for /dev/null) and JoranConfigurator do not call this method at all. Layout are generically configured as just as any other sub-component of a log4j component.
PropertyConfigurator makes use of an appender's requiresLayout method as described in the javadocs quoted above.
Does the above address your concern? (My impression is that the current behavior is quite correct although I may have missed your point almost entirely.)
At 12:30 AM 5/13/2004, Mark R Durman/CA/US/MQSolutions wrote:
All, log4j 1.2 had (what I think) was incorrect support for optional layouts. If the layout was marked as optional it wasn't called even if it was supplied. That's not optional, it's either layout or no layout. My view is that if the layout is marked as optional, the appender should check if it was set. If yes, go ahead and call it, if no, skip the call and don't issue messages saying it's not there.
If everyone else is OK with that approach, which I don't see as breaking the operation of existing log4j implementations, I'd like to submit a patch to the 1.3 code.
Mark Durman MQ Solutions
-- Ceki G�lc�
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
