Simpel way of Adding Appenders and Formaters

2009-10-13
2013-04-26
  • Boris Prochazka

    Boris Prochazka - 2009-10-13

    Suggestion

    Add to the PropertyConfigurator two methods

    addAppenderClass(Class)

    And the equivalent  for formaters
    addFormaterClass(Class)

    What they do is simply extend your APPENDER_ALIASES and APPENDER_CLASS_NAMES with the new class. Thereafter this new class name can be used inside the microlog.properties file. (Maybe it's the classname that shuld be passed) I came to this idea from writing my own appender and adding it to the configuration. It still don't work and making the new appender part of the microlog is definitely not intuitive. Maybe the easeast way is to extend the two list and recompile the microlog package :-(

    I have not considered all aspects yet, but I see a possibility and from what I have seen in the code you have been there with you mind.

    Consider this code code beauty:

    static {
       PropertyConfigurator.addAppender(MyAppender.class());
       PropertyConfigurator.configure();
    }

     
  • Johan Karlsson

    Johan Karlsson - 2009-10-13

    Good idea! I will take a look at it.

     
  • Johan Karlsson

    Johan Karlsson - 2009-10-19

    Hi,

    I have added two methods:

    addAppenderAlias(Appender appender)
    addFormatterAlias(Formatter formatter)

    They are available in the latest snapshot release. Please try it out!

    Regards
    Johan

     
  • Johan Karlsson

    Johan Karlsson - 2009-10-31

    I have released V2.1.0 today. These new methods are part of this delivery. Please try it out and provide feedback.

    Regards
    Johan

     

Log in to post a comment.