You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Bender Heri <hb...@ergonomics.ch> on 2009/09/29 13:54:17 UTC

Appender-ref within appender tag

Hi all

The appender tag of xml configuration allows formally to be like that:

    <appender name="STANDARD_APPENDERS" class="">
        <appender-ref ref="CONSOLE.ERR"/>
        <appender-ref ref="CONSOLE.OUT"/>
        <appender-ref ref="FILE"/>
    </appender>

According to DTD:

<!ELEMENT appender (errorHandler?, param*, layout?, filter*, appender-ref*)>
<!ATTLIST appender
  name          ID      #REQUIRED
  class         CDATA   #REQUIRED
>

But: how to use this feature?

I would like to use one ref to this STANDARD_APPENDERS in my logger definitions, since I have a lot of finetuned logger definitions. But my development environment (eclipse) likes the Console-Appender, whereas the server does not like it. If I can use such a sampler appender I would have to change the included appenders only at one location.

Problem is: the class-Attribute of appender element is mandatory. But what to write therein? Left blank (like shown above) leads to a ClassNotFountException. Omitting the attribute says 
log4j:WARN Attribute "class" is required and must be specified for element type "appender".
Followed by a ClassNotFountException again.

The log4j manual has no hints about this feature.

Any ideas?

Heri
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org