• Post Reply Bookmark Topic Watch Topic
  • New Topic

Log4J custom appender  RSS feed

 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing a custom JMS appender for log4j that publishes to a queue (I know there is one by default, but that one uses a topic).

Now, in my configuration file I have this:

log4j.appender.jms=JMSQueueAppender
log4j.appender.jms.ProviderURL=iiop://localhost:2809
log4j.appender.jms.QueueFactoryName=jms/LoggingCF
log4j.appender.jms.QueueName=jms/LoggingQueue
log4j.appender.jms.layout=org.apache.log4j.PatternLayout
log4j.appender.jms.layout.ConversionPattern=[%C{1}]%-4r [%t] %-5p %c %x - %m%n
log4j.rootLogger=DEBUG, jms

My appender class extends the Skeleton thing and I have get/setters for the
properties:

ProviderURL
QueueFactoryName
QueueName

but, when I run this, the values appear to be NULL. Do I need to do more then just create get/setters for these properties in my appender class ? ...
[ November 26, 2004: Message edited by: Koen Serneels ]
 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I solved this.
I placed my code in the constructor that used some of the options. But its kind of logic that the options cannot be set until an instance of the class is created. :roll:

So I moved it to -> public void activateOptions() (is a method of the OptionHandler interface implemented by Skeleton) which is called after all the options are set. Thats it !
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!