[mdr-users] RE : [mdr-users] Using log4j instead of ErrorManager with standalone MDR
"Olivier RICHAUD" <[email protected]> Wed, 3 Aug 2005 18:36:00 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <009b01c59849$6eb7c8e0$6564a8c0@lauris> |
OK thanks for your reply. I went down to the META-INF/services directory and found a file called org.netbeans.api.mdr.MDRManager which contains a class name. If my error manager is named x.y.ErrorManager, how should I put in that services repository? Olivier. -----Message d'origine----- De : Martin Matula [mailto:[email protected]] Envoyé : mercredi 3 août 2005 17:35 À : [email protected] Objet : Re: [mdr-users] Using log4j instead of ErrorManager with standalone MDR Hi Olivier, Olivier RICHAUD wrote: >Hi all, > >I'm looking for a way to replace MDR's own logging system by log4j. I'm >using the standalone version of MDR. > >I have gone through various articles, but none of them gave me an >answer. As far as I understand, I may need to provide my custom >implementation of ErrorManager and replace the default one with mine. > Yes, this is the right way to go. >My >questions, if this is the way to integrate log4j : >1. Do I need to implement all ErrorManager's methods? I wonder whether >it's worh implementing annotations related methods. > > Yes. MDR uses annotations - most of the time you will get some runtime exception from MDR, which is annotated by the original exceptions that caused the runtime exception. >2. How do I register my customer ErrorManager with the internal lookup? >Remember I'm using the standalone version of MDR and worse, it is >emebedded in a Jboss App Server! > > You can do it via META-INF/services directory in your jar - that's how MDR registers its ErrorManager. You can register your implementation as an additional ErrorManager (the logging infrastructure calls all registered ErrorMangers). Additionally, you may want to remove the MDR's default error manager from the lookup in the services folder in a way similar to how MDR module removes standalone MDRManager from the lookup - see the META-INF/services directory under mdr/module. Regards, Martin