Re: [mdr-users] Using log4j instead of ErrorManager with standalone MDR
Martin Matula <[email protected]> Wed, 03 Aug 2005 17:35:23 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
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