logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barr, Jud" <Barr....@principal.com>
Subject RE: Writing new appenders
Date Wed, 27 Feb 2002 14:33:24 GMT
If the class name of your appender is:
  com.mycompany.myapp.NewAppender

Then the configuration file for it looks like this:
  log4j.appender.MyAppender=com.mycompany.myapp.NewAppender

As I understand it, Log4J uses JavaBeans Introspection to set properties on the appenders.
 I read through the Introspection section of the JavaBean API.
http://java.sun.com/products/javabeans/docs/spec.html

Basically, if your appender has a property called someProperty of type String, then you need
two methods:
  public String getSomeProperty() 
  public void setSomeProperty(String newProperty)

In the configuration file if you have an appender called MyAppender then the values for someProperty
are set like this:
  log4j.appender.MyAppender.SomePropery=someValue

That's how I did it anyway.  Hope it helps.

Jud Barr
Principal Financial Group
Des Moines, Iowa

barr.jud@principal.com



-----Original Message-----
From: Charlie Cano [mailto:Charlie.Cano@bangnetworks.com]
Sent: Tuesday, February 26, 2002 5:48 PM
To: log4j-user@jakarta.apache.org
Subject: Writing new appenders



I'm trying to write my own Appender, and I'm wondering if anyone that has done this can give
me the short description of how log4j goes about using the configuration file to create and
configure appenders... where's a good place to look for an example?  I'm extending the AppenderSkeleton
to take advantage of the filter stuff it gives me, I'm more interested in trying to figure
out the steps involved in an appender's lifecycle (configuration, invocation).

Any pointers are appreciated,
Charlie

--
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