logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Steppe <kste...@pacbell.net>
Subject Re: Custom Appenders and Options
Date Wed, 23 Jan 2002 02:20:13 GMT
It's best to stay away from the option strings.  They are deprecated in 1.2 and
going away.

Just use the JavaBean getXXX set XXX methodology and it should work perfectly
through the miracle of introspection/reflection.

For example:

public class JDBCAppender extends org.apache.log4j.AppenderSkeleton
    implements org.apache.log4j.Appender {


  public void setUser(String user) {
    databaseUser = user;
  }


  public void setURL(String url) {
    databaseURL = url;
  }

  public String getUser() {
    return databaseUser;
  }


  public String getURL() {
    return databaseURL;
  }

// And so on with the rest of the options and the actual appender code.
//.....

}

Kevin





Qaz Zaq wrote:

> Actually quite confusing...:-)  In which class do I
> put the below code snippet and which "myoption" is
> as-is and which should be replaced by the actual
> option name?
>
> Thanks...
>
> --- "Madan, Kapil" <Kapil.Madan@COGNOS.com> wrote:
> > define the property in your customized class
> >
> > static final public String MY_OPTION = "MyOption";
> > //1.
> > protected String myOption = "value" ; //2.
> > public void setMyOption(String val){ //3.
> >         myOption = val;
> >     }
> >
> > does it help ...
> >
> >
> > -----Original Message-----
> > From: Qaz Zaq [mailto:consultant_lol@yahoo.com]
> > Sent: 21 January 2002 23:42
> > To: Log4J Users List
> > Subject: Custom Appenders and Options
> >
> >
> > Hi,
> >
> > How can my custom appender pick up custom properties
> > from log4j.properties?  Could not quite figure out
> > the
> > API.  Thanks.
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE video emails in Yahoo! Mail!
> > http://promo.yahoo.com/videomail/
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:log4j-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:log4j-user-help@jakarta.apache.org>
> >
> > This message may contain privileged and/or
> > confidential information.  If you
> > have received this e-mail in error or are not the
> > intended recipient, you
> > may not use, copy, disseminate or distribute it; do
> > not open any
> > attachments, delete it immediately from your system
> > and notify the sender
> > promptly by e-mail that you have done so.  Thank
> > you.
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:log4j-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:log4j-user-help@jakarta.apache.org>
> >
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
>
> --
> To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message