Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Logging #9

Open
mkovatsc opened this issue Jun 17, 2014 · 1 comment
Open

Logging #9

mkovatsc opened this issue Jun 17, 2014 · 1 comment

Comments

@mkovatsc
Copy link

How to do logging and how to improve it? There are two types of logging for Californium:

  1. Internal logging to get the Californium implementation right. This is usually only of interest for the Californium team and when developing extensions. For now, we just use java.utils.logging here, which is not great, but there is also no alternative that stands out.
  2. Operational logging to see what is going on. This is what users of Californium want to have in their logs. For this, it is best to disable the internal logging completely and use MessageInterceptors (see MessageTracer as example implementation). Just implement your preferred logger in a custom Interceptor and add it to the Endpoint. It will receive then log every message that enters and leaves the system. Additional custom logging could be done in your CoapResource implementations.

To improve this concept, it would be great to know if there are other things that are interesting during operation.

In the long-run, we might also want to change the internal logger. Maybe we can align the logger implementation over multiple IoT Eclipse projects or at least find something that is good for all Californium committers.

@sophokles73
Copy link
Contributor

The first thing to do would be to migrate to SLF4J API. We can then better integrate into existing environments by means of letting the user decide which logging framework to use (there are bindings for almost all existing frameworks available).
Furthermore, SLF4J's API supports the use of Markers that can be used to label log messages and use these labels for filtering (given that the underlying logging framework supports Markers). This way operational logging could be achieved by means of adding a particular Marker, e.g. operational when logging a message. In the logging configuration the user can then decide what to log and at what level.

sbernard31 pushed a commit to sbernard31/californium that referenced this issue Dec 23, 2016
sbernard31 added a commit to sbernard31/californium that referenced this issue Dec 23, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants