You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Burak Taysi <bm...@bjc.org> on 2007/09/18 18:18:18 UTC

Log Service Implementation

Hi,

I was looking at the LogService implementation in the Felix Source code.  It keeps all the messages in memory and we can 
add a LogListener to retrieve the messages for the LogService.

Was there a reason for this approach?

Currently, we are not fully using a LogService to log our debug/info messages, but are using log4j instead.  I have noticed
that when I use a local OBR to download bundles into our running Felix and run them - I get warning messages from log4j
that someone is attempting to append data to a closed appender [CONSOLE].

I thought this might be caused by the fact that ALL the bundles we have written use the same exact log4j.xml file to write
formatted messages to the console.  I am guessing that somehow one of the bundles is closing the default output stream (console),
so the other bundles then generate errors (and I lose the messages).

So my first thought was to write an implementation of the LogService myself using log4j to write to the console.
Then after looking at the existing implementation - the other thought was to write a LogListener (using LogReaderService) to the 
existing LogService implementation and have that write to the console using log4j.  

With EITHER approach, I will use log4j.  This way any changes in the future - console vs logfile or local vs server, can be done
with modifications to a single log4j.xml file in a single bundle.

Do you have a recommendation on which approach to take?


Burak Taysi
Tech Specialist - Patient Touch (E.S.)
BJC Health Care - IS Department
343 S. Kirkwood Rd., Suite 202
St. Louis, MO   63122

(PH) 314-362-9864
(FX) 314-747-3450
(Num PG) 314-360-4345 
(Text PG) 3143604345@myairmail.com 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Log Service Implementation

Posted by Kit Plummer <ki...@blackholelogic.com>.
+1 

As an OSGi newbie I was a little miffed that logging was such an issue.
Took the recommendation to use Pax-Logging - works as advertised.  My POJOs
that were already using Log4J now spit out the stuff I was expecting...

It really is as simple as loading up the pax-logging-api and
pax-logging-service bundles.

Kit


> From: Stuart McCulloch <st...@jayway.net>
> Reply-To: <us...@felix.apache.org>
> Date: Thu, 27 Sep 2007 12:28:38 +0800
> To: <us...@felix.apache.org>
> Subject: Re: Log Service Implementation
> 
> On 27/09/2007, Richard S. Hall <he...@ungoverned.org> wrote:
>> 
>> Burak Taysi wrote:
>>> Hi,
>>> 
>>> I was looking at the LogService implementation in the Felix Source
>> code.  It keeps all the messages in memory and we can
>>> add a LogListener to retrieve the messages for the LogService.
>>> 
>>> Was there a reason for this approach?
>>> 
>> 
>> The current log service implementation was just intended to be very
>> simple.
>> 
>> I, personally, am not a logging expert, but I am pretty sure others on
>> the list know more. You might even find that there are log service
>> implementations already available to do what you want.
>> 
>> Any suggestions, people?
> 
> 
> Hi Burak,
> 
> bit of a plug, but you might want to try pax-logging:
> 
>   http://wiki.ops4j.org/confluence/display/ops4j/Pax+Logging
> 
> 
> http://repository.ops4j.org/maven2/org/ops4j/pax/logging/pax-logging-api/0.9.6
> 
> http://repository.ops4j.org/maven2/org/ops4j/pax/logging/pax-logging-service/0
> .9.6
> 
> it supports various 'classic' logging APIs and provides a LogService
> implementation
> - it uses log4j underneath and supports configuration using the
> configuration admin
> service (such as via pax-confman).
> 
> if you have any questions or find problems using it, just ping
> general@lists.ops4j.org
> and you should get a quick response - pax-logging is getting close to
> a 1.0release so
> feedback is very welcome :)
> 
> -> richard
>> 
>>> Currently, we are not fully using a LogService to log our debug/info
>> messages, but are using log4j instead.  I have noticed
>>> that when I use a local OBR to download bundles into our running Felix
>> and run them - I get warning messages from log4j
>>> that someone is attempting to append data to a closed appender
>> [CONSOLE].
>>> 
>>> I thought this might be caused by the fact that ALL the bundles we have
>> written use the same exact log4j.xml file to write
>>> formatted messages to the console.  I am guessing that somehow one of
>> the bundles is closing the default output stream (console),
>>> so the other bundles then generate errors (and I lose the messages).
>>> 
>>> So my first thought was to write an implementation of the LogService
>> myself using log4j to write to the console.
>>> Then after looking at the existing implementation - the other thought
>> was to write a LogListener (using LogReaderService) to the
>>> existing LogService implementation and have that write to the console
>> using log4j.
>>> 
>>> With EITHER approach, I will use log4j.  This way any changes in the
>> future - console vs logfile or local vs server, can be done
>>> with modifications to a single log4j.xml file in a single bundle.
>>> 
>>> Do you have a recommendation on which approach to take?
>>> 
>>> 
>>> Burak Taysi
>>> Tech Specialist - Patient Touch (E.S.)
>>> BJC Health Care - IS Department
>>> 343 S. Kirkwood Rd., Suite 202
>>> St. Louis, MO   63122
>>> 
>>> (PH) 314-362-9864
>>> (FX) 314-747-3450
>>> (Num PG) 314-360-4345
>>> (Text PG) 3143604345@myairmail.com
>>> 
>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
>> --
> Cheers, Stuart



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Log Service Implementation

Posted by Stuart McCulloch <st...@jayway.net>.
On 27/09/2007, Richard S. Hall <he...@ungoverned.org> wrote:
>
> Burak Taysi wrote:
> > Hi,
> >
> > I was looking at the LogService implementation in the Felix Source
> code.  It keeps all the messages in memory and we can
> > add a LogListener to retrieve the messages for the LogService.
> >
> > Was there a reason for this approach?
> >
>
> The current log service implementation was just intended to be very
> simple.
>
> I, personally, am not a logging expert, but I am pretty sure others on
> the list know more. You might even find that there are log service
> implementations already available to do what you want.
>
> Any suggestions, people?


Hi Burak,

bit of a plug, but you might want to try pax-logging:

  http://wiki.ops4j.org/confluence/display/ops4j/Pax+Logging


http://repository.ops4j.org/maven2/org/ops4j/pax/logging/pax-logging-api/0.9.6

http://repository.ops4j.org/maven2/org/ops4j/pax/logging/pax-logging-service/0.9.6

it supports various 'classic' logging APIs and provides a LogService
implementation
- it uses log4j underneath and supports configuration using the
configuration admin
service (such as via pax-confman).

if you have any questions or find problems using it, just ping
general@lists.ops4j.org
and you should get a quick response - pax-logging is getting close to
a 1.0release so
feedback is very welcome :)

-> richard
>
> > Currently, we are not fully using a LogService to log our debug/info
> messages, but are using log4j instead.  I have noticed
> > that when I use a local OBR to download bundles into our running Felix
> and run them - I get warning messages from log4j
> > that someone is attempting to append data to a closed appender
> [CONSOLE].
> >
> > I thought this might be caused by the fact that ALL the bundles we have
> written use the same exact log4j.xml file to write
> > formatted messages to the console.  I am guessing that somehow one of
> the bundles is closing the default output stream (console),
> > so the other bundles then generate errors (and I lose the messages).
> >
> > So my first thought was to write an implementation of the LogService
> myself using log4j to write to the console.
> > Then after looking at the existing implementation - the other thought
> was to write a LogListener (using LogReaderService) to the
> > existing LogService implementation and have that write to the console
> using log4j.
> >
> > With EITHER approach, I will use log4j.  This way any changes in the
> future - console vs logfile or local vs server, can be done
> > with modifications to a single log4j.xml file in a single bundle.
> >
> > Do you have a recommendation on which approach to take?
> >
> >
> > Burak Taysi
> > Tech Specialist - Patient Touch (E.S.)
> > BJC Health Care - IS Department
> > 343 S. Kirkwood Rd., Suite 202
> > St. Louis, MO   63122
> >
> > (PH) 314-362-9864
> > (FX) 314-747-3450
> > (Num PG) 314-360-4345
> > (Text PG) 3143604345@myairmail.com
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
> --
Cheers, Stuart

Re: Log Service Implementation

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Burak Taysi wrote:
> Hi,
>
> I was looking at the LogService implementation in the Felix Source code.  It keeps all the messages in memory and we can 
> add a LogListener to retrieve the messages for the LogService.
>
> Was there a reason for this approach?
>   

The current log service implementation was just intended to be very simple.

I, personally, am not a logging expert, but I am pretty sure others on 
the list know more. You might even find that there are log service 
implementations already available to do what you want.

Any suggestions, people?

-> richard

> Currently, we are not fully using a LogService to log our debug/info messages, but are using log4j instead.  I have noticed
> that when I use a local OBR to download bundles into our running Felix and run them - I get warning messages from log4j
> that someone is attempting to append data to a closed appender [CONSOLE].
>
> I thought this might be caused by the fact that ALL the bundles we have written use the same exact log4j.xml file to write
> formatted messages to the console.  I am guessing that somehow one of the bundles is closing the default output stream (console),
> so the other bundles then generate errors (and I lose the messages).
>
> So my first thought was to write an implementation of the LogService myself using log4j to write to the console.
> Then after looking at the existing implementation - the other thought was to write a LogListener (using LogReaderService) to the 
> existing LogService implementation and have that write to the console using log4j.  
>
> With EITHER approach, I will use log4j.  This way any changes in the future - console vs logfile or local vs server, can be done
> with modifications to a single log4j.xml file in a single bundle.
>
> Do you have a recommendation on which approach to take?
>
>
> Burak Taysi
> Tech Specialist - Patient Touch (E.S.)
> BJC Health Care - IS Department
> 343 S. Kirkwood Rd., Suite 202
> St. Louis, MO   63122
>
> (PH) 314-362-9864
> (FX) 314-747-3450
> (Num PG) 314-360-4345 
> (Text PG) 3143604345@myairmail.com 
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org