You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Aswin Asokan <as...@gmail.com> on 2005/03/11 07:37:02 UTC

Can renderers be configured using log4j.xml when using JoranConfigurator ?

Hi,

I tried to configure renderers using xml config file, but looks like
JoranConfigurator is not handling the <renderer> tag.

Programatically adding renderers works. 

If this is not supported now, is this planned for future releases? 

I tried on release 1.3

Thanks- 
Aswin Asokan

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


Re: Can renderers be configured using log4j.xml when using JoranConfigurator ?

Posted by Mark van der Voort <ma...@gmail.com>.
Aswin,

AFAIK it cannot (yet) be done. Check the file
org.apache.log4j.joran.JoranConfigurator for the current
configuration, i.e. the current configuration language.

  protected void selfInitialize(LoggerRepository repository) {
    RuleStore rs = new SimpleRuleStore(repository);
    rs.addRule(new Pattern("configuration"), new ConfigurationAction());
    rs.addRule(
      new Pattern("configuration/substitutionProperty"),
      new SubstitutionPropertyAction());
    rs.addRule(
      new Pattern("configuration/repositoryProperty"),
      new RepositoryPropertyAction());
    rs.addRule(
        new Pattern("configuration/conversionRule"),
        new ConversionRuleAction());
    rs.addRule(new Pattern("configuration/plugin"), new PluginAction());
    rs.addRule(new Pattern("configuration/logger"), new LoggerAction());
    rs.addRule(
      new Pattern("configuration/logger/level"), new LevelAction());
    rs.addRule(
      new Pattern("configuration/logger/priority"), new PriorityAction());
    rs.addRule(
      new Pattern("configuration/root"), new RootLoggerAction());
    rs.addRule(
      new Pattern("configuration/root/level"), new LevelAction());
    rs.addRule(
      new Pattern("configuration/root/priority"), new PriorityAction());
    rs.addRule(
      new Pattern("configuration/logger/appender-ref"),
      new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/root/appender-ref"),
      new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/appender"), new AppenderAction());
    rs.addRule(new Pattern("configuration/appender/appender-ref"), 
        new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/appender/layout"), new LayoutAction());
    rs.addRule( 
         new Pattern("configuration/jndiSubstitutionProperty"), 
         new JndiSubstitutionPropertyAction());
    rs.addRule(
      new Pattern("configuration/newRule"), new NewRuleAction());
    rs.addRule(new Pattern("*/param"), new ParamAction());

Someone correct me if I am wrong but I think that in order to support
the renderer one would have to write an appropriate action, and
introduce it to the language.

IMO, currently the JoranConfigurator lacks a lot of options that are
available to the propertyConfigurator.


cheers,

Mark van der Voort
On Fri, 11 Mar 2005 15:37:02 +0900, Aswin Asokan <as...@gmail.com> wrote:
> Hi,
> 
> I tried to configure renderers using xml config file, but looks like
> JoranConfigurator is not handling the <renderer> tag.
> 
> Programatically adding renderers works.
> 
> If this is not supported now, is this planned for future releases?
> 
> I tried on release 1.3
> 
> Thanks-
> Aswin Asokan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
>

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