You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by Alexander Broekhuis <a....@gmail.com> on 2013/10/02 07:22:54 UTC

Re: [jira] [Created] (CELIX-87) Log writer to syslog

Hi Gerrit,

While I like the idea of logging to the system log, I think there are
several points which I'd like to mention.

First one is logging in the framework itself. Currently there is some
output to standard out, but probably also some missing parts. To be able to
do something with these entries the framework needs to be updated to use
the LogService (if present). This is a bug/improvement of the Celix could
and should be done (imo).

Second one: The LogService is based on the Compendium spec, and already
supports the Log Writer construction. More specifically, it is possible to
register a LogListener to the LogReaderService. See chapter 101 of the
compendium spec, and the LogWriter of Celix.
So making a component which takes log entries and adds them to the system
log can already be written.

Third one: you ask for easy filtering between Celix and Application
logging. The OSGi API for the log service does not have any explicit
support for this, eg there is no log category or similar which can be used.
However, log entries can have a reference to the bundle that made the log.
But maybe it is easier to handle such filtering in your own specific syslog
output component..

Regarding the properties:
The log service itself doesn't have any properties defined in the spec. But
looking at Felix it probably makes sense to have some to specify the
maximum number of messages to keep in memory and to specify wether debug
messages should be stored.
These properties only influence the storage of entries, and has nothing to
do with subscribed listeners, so even if debug messages are not stored they
are still send to the listeners.
All other properties can be handled in the specific listener
implementation. In other words, the LogService is only meant for creating
log entries. With the ReaderService and Listeners it is possible to process
those logs in a specific way best suited for the actual user.

So while I do think it is interesting for Celix to have a syslog writer, I
am not sure if the specific request for filtering will fit in a generic
solution. It might be better to implement this writer for your specific use
case. A good example of a listener is the LogWriter bundle which writes to
standard out.




2013/10/1 Gerrit Binnenmars (JIRA) <ji...@apache.org>

> Gerrit Binnenmars created CELIX-87:
> --------------------------------------
>
>              Summary: Log writer to syslog
>                  Key: CELIX-87
>                  URL: https://issues.apache.org/jira/browse/CELIX-87
>              Project: Celix
>           Issue Type: New Feature
>     Affects Versions: 0.0.2-incubating
>          Environment: Linux system
>             Reporter: Gerrit Binnenmars
>
>
> We would like to have the internal Celix logging in the Linux syslog
> output mechanism.
> Also bundles need to be able to register their own logWriter (in the
> syslog output it shall be easy to filter between Celix logging and
> application logging)
> Configurable shall be: output file name (default: /var/log/messages)
> Level (to enable/disable logging at different levels)
> Special text that can be used for filtering
>
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.1#6144)
>



-- 
Met vriendelijke groet,

Alexander Broekhuis

Re: [jira] [Created] (CELIX-87) Log writer to syslog

Posted by Alexander Broekhuis <a....@gmail.com>.
Hi,

2013/10/2 Gerrit Binnenmars <ge...@gmail.com>
>
>
>> Regarding the properties:
>> The log service itself doesn't have any properties defined in the spec.
>> But
>> looking at Felix it probably makes sense to have some to specify the
>> maximum number of messages to keep in memory and to specify wether debug
>> messages should be stored.
>> These properties only influence the storage of entries, and has nothing to
>> do with subscribed listeners, so even if debug messages are not stored
>> they
>> are still send to the listeners.
>> All other properties can be handled in the specific listener
>> implementation. In other words, the LogService is only meant for creating
>> log entries. With the ReaderService and Listeners it is possible to
>> process
>> those logs in a specific way best suited for the actual user.
>>
> So, the LogWriter needs a log_level property to do some filtering.


Seeing as there is already a LogWriter in Celix I think the name is a bit
misleading. But you are correct, the component using the LogReaderService
(or implementing the LogListener) is responsible for these kind of things.


>
>
>> So while I do think it is interesting for Celix to have a syslog writer, I
>> am not sure if the specific request for filtering will fit in a generic
>> solution. It might be better to implement this writer for your specific
>> use
>> case. A good example of a listener is the LogWriter bundle which writes to
>> standard out.
>>
> Agree with you, we can work on the LogWriter as a new bundle. I think it
> is still useful to add this to Celix for other users.


Sounds good to me. Could you update the Jira entry so that it concerns the
(lack of) logging of the framework and usage of the LogService?

Thanks,



-- 
Met vriendelijke groet,

Alexander Broekhuis

Re: [jira] [Created] (CELIX-87) Log writer to syslog

Posted by Gerrit Binnenmars <ge...@gmail.com>.
Hello Alexander,

See my comments below.
> Hi Gerrit,
>
> While I like the idea of logging to the system log, I think there are
> several points which I'd like to mention.
>
> First one is logging in the framework itself. Currently there is some
> output to standard out, but probably also some missing parts. To be able to
> do something with these entries the framework needs to be updated to use
> the LogService (if present). This is a bug/improvement of the Celix could
> and should be done (imo).
Agree
>
> Second one: The LogService is based on the Compendium spec, and already
> supports the Log Writer construction. More specifically, it is possible to
> register a LogListener to the LogReaderService. See chapter 101 of the
> compendium spec, and the LogWriter of Celix.
> So making a component which takes log entries and adds them to the system
> log can already be written.
Thanks, this was the information I was looking for.
>
> Third one: you ask for easy filtering between Celix and Application
> logging. The OSGi API for the log service does not have any explicit
> support for this, eg there is no log category or similar which can be used.
> However, log entries can have a reference to the bundle that made the log.
> But maybe it is easier to handle such filtering in your own specific syslog
> output component..
>
> Regarding the properties:
> The log service itself doesn't have any properties defined in the spec. But
> looking at Felix it probably makes sense to have some to specify the
> maximum number of messages to keep in memory and to specify wether debug
> messages should be stored.
> These properties only influence the storage of entries, and has nothing to
> do with subscribed listeners, so even if debug messages are not stored they
> are still send to the listeners.
> All other properties can be handled in the specific listener
> implementation. In other words, the LogService is only meant for creating
> log entries. With the ReaderService and Listeners it is possible to process
> those logs in a specific way best suited for the actual user.
So, the LogWriter needs a log_level property to do some filtering.
>
> So while I do think it is interesting for Celix to have a syslog writer, I
> am not sure if the specific request for filtering will fit in a generic
> solution. It might be better to implement this writer for your specific use
> case. A good example of a listener is the LogWriter bundle which writes to
> standard out.
Agree with you, we can work on the LogWriter as a new bundle. I think it 
is still useful to add this to Celix for other users.
>
>
>
>
> 2013/10/1 Gerrit Binnenmars (JIRA) <ji...@apache.org>
>
>> Gerrit Binnenmars created CELIX-87:
>> --------------------------------------
>>
>>               Summary: Log writer to syslog
>>                   Key: CELIX-87
>>                   URL: https://issues.apache.org/jira/browse/CELIX-87
>>               Project: Celix
>>            Issue Type: New Feature
>>      Affects Versions: 0.0.2-incubating
>>           Environment: Linux system
>>              Reporter: Gerrit Binnenmars
>>
>>
>> We would like to have the internal Celix logging in the Linux syslog
>> output mechanism.
>> Also bundles need to be able to register their own logWriter (in the
>> syslog output it shall be easy to filter between Celix logging and
>> application logging)
>> Configurable shall be: output file name (default: /var/log/messages)
>> Level (to enable/disable logging at different levels)
>> Special text that can be used for filtering
>>
>>
>>
>>
>> --
>> This message was sent by Atlassian JIRA
>> (v6.1#6144)
>>
>
>