[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.riena] Re: How to do logging in Riena?

Hi Sjoerd,

Yes, you are right there should be more documentation.
I will sketch shortly how we do logging:
1. Riena uses the ´extended´ logging of OSGi which just has graduated (https://bugs.eclipse.org/bugs/show_bug.cgi?id=260672). This means that Riena uses the log levels defined in org.osgi.service.log.LogService.
2. Riena offers support to ease the usage of logging:
- getting a logger for class:
private static final Logger LOGGER = Log4r.getLogger(Activator.getDefault(), YourClass.class);
- using this logger:
LOGGER.log(LogService.LOG_WARNING, "Your warning");
With that logging will be send to the logging service and if no listeners are defined nothing will logged.
3. Log listners. There is an extension point for defining log listeners "org.eclipse.riena.core.logging.listeners" where you can define log listeners and log filters. Log filters decide whether to log or not. Riena has a few predefined log listeners and log filters, e.g. Log4jLogListener and SystemPropertyLogFilter. In plugin.xml (riena.core) there is a examplary definition (in comments) for this extension point.
4. Log Catchers. Log catchers offer the possibility to attach to certain ´log´ event sources and route them to the OSGi logging. E.g. it possible to attach to the standard java logging with the JavaLogCatcher which ´listens´ to Java logging events and delegates that to the OSGi logging. The extension point is "org.eclipse.riena.core.logging.catchers" and exemplary definitions are in plugin.xml (riena.core).


However, you can use Riena´s logging support or use any other logging flavor that suit your needs. If you use something else and you also want to get the logging events that Riena produces you have to listen to ´extended´ logging service of OSGi and delegate that to your logging.

HTH

Tschüß,
Stefan



Sjoerd Kessels wrote:
Hi,

I am new to Riena. I have read bits and pieces on Riena and logging, and I see there is stuff in the framework for it, but I don't get it yet. Could someone give, or point me to, a description on how logging in Riena works?

F.e. In my RienaPlugin (on the server) I can call getLogger. Where do I find the loglevels to provide as parameters? Where does it log to and how can I configure this?
I see extension points for Log catchers and listeners but there is no documentation on what they do and how to use.


Thanks,

Sjoerd Kessels