You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Pierre Henry Perret <ph...@gmail.com> on 2010/12/20 12:50:44 UTC

iPOJO log service

Hello,

I have this code to inject  an instance of LogService in a bundle:
_______________________________
    @Requires
    private LogReaderService lrs;
    @Requires
    private LogService log;
________________________________

But when I use log service - write and read in it - after adding a
LogListeneer, I get nothing on felix console .

Have I missed something ?


Pierre

Re: iPOJO log service

Posted by Pierre Henry Perret <ph...@gmail.com>.
Yes, @Instantiate solves the issue.


I have an instance that cant 'start' because of an unresolved api...must dig
into that.

Thanks,

Pierre



2010/12/21 Clement Escoffier <cl...@gmail.com>

>
>
> On 21.12.10 12:58, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >Yes, it seems the point.
> >
> >An instance is invalid because of an interface not found.
>
> Which service is not found ?
>
> >
> >What is strange is that hen I suppress the metadata.xmf file from the
> >hello.impl.annotation sample, the instance is no more created.
> >
> >Is the instance name compulsory ?
>
>
> If you use the @Instantiate annotation (requiring the latest manipulator),
> then the XML file is no more required.
> The tutorial does not use the @Instantiate annotation so still require the
> XML file to declare the instances.
>
>
> Regards,
>
> Clement
>
>
> >
> >
> >
> >
> >
> >2010/12/21 Clement Escoffier <cl...@gmail.com>
> >
> >>
> >>
> >> On 21.12.10 11:33, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >>
> >> >This is precisely what I want to know !
> >> >
> >> >I receive this event log from felix:
> >> >__________________________
> >> >2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent STARTED
> >> >___________________
> >> >
> >> >I see the bundle 'Active' in the framework.
> >> >But it is like if that @Ativate , in which I put the log directive, is
> >>not
> >> >executed, because if it were, I'll see the log ?
> >>
> >> Try first with a simple System.out.
> >>
> >> Bundles and components have two different lifecycles. The bundle can be
> >> resolved and activated (imports were resolved), and components can still
> >> be invalid because of some missing services.
> >>
> >> Moreover, try to deploy and check the validity of your component with
> >>the
> >> arch / instance command
> >> (http://felix.apache.org/site/ipojo-arch-command.html)
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >> >
> >> >
> >> >Pierre
> >> >
> >> >
> >> >
> >> >2010/12/21 Clement Escoffier <cl...@gmail.com>
> >> >
> >> >>
> >> >>
> >> >> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >> >>
> >> >> >Yes, I do that.
> >> >> >But even so, there is no log entry when I lauch the log command in
> >> >>felix
> >> >> >shell...
> >> >>
> >> >> Are you sure that your code is executed ?
> >> >>
> >> >> Clement
> >> >>
> >> >> >
> >> >> >Pierre
> >> >> >
> >> >> >
> >> >> >
> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >
> >> >> >>
> >> >> >>
> >> >> >> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com>
> >>wrote:
> >> >> >>
> >> >> >> >Do you mean I should only use the log service in a declared
> >> >>component ?
> >> >> >> >
> >> >> >> >The fact is that when I use annotations to inject the LogService
> >> >>which
> >> >> >>is
> >> >> >> >an
> >> >> >> >'org.apache.felix.log' instance from the same bundle name which I
> >> >>put
> >> >> >>in
> >> >> >> >the
> >> >> >> >'bundle' directory, the log service instiated because there is no
> >> >>log
> >> >> >> >errors
> >> >> >> >....
> >> >> >>
> >> >> >> I don't really understand but you cannot use @Requires in a
> >> >> >>non-component
> >> >> >> class. Only components are injected.
> >> >> >>
> >> >> >> So you should have something like:
> >> >> >>
> >> >> >> @Component
> >> >> >> @Instantiate
> >> >> >> public class MyClass {
> >> >> >>     @Requires
> >> >> >>    private LogReaderService lrs;
> >> >> >>    @Requires
> >> >> >>    private LogService log;
> >> >> >>
> >> >> >>
> >> >> >>     @Validate
> >> >> >>    public void start(){
> >> >> >>         ...
> >> >> >>        log.log(LogService.LOG_DEBUG, "my bundle is starting...!"
> >>);
> >> >> >>        ...
> >> >> >>    }
> >> >> >>
> >> >> >> }
> >> >> >>
> >> >> >>
> >> >> >> Note that the 'start' method (@Validate) do not have a bundle
> >>context
> >> >> >> parameter. If you want the bundle contex,t you can get it from the
> >> >> >> constructor (it's the only place we inject the bundle context so
> >> >>far):
> >> >> >>
> >> >> >> public MyClass(BundleContext bc) {
> >> >> >>  ...
> >> >> >> }
> >> >> >>
> >> >> >> Regards,
> >> >> >>
> >> >> >> Clement
> >> >> >>
> >> >> >> >
> >> >> >> >THe log level is INFO yes, but command log has a parameter to set
> >> >>the
> >> >> >> >level.
> >> >> >> >
> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >> >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com>
> >> >>wrote:
> >> >> >> >>
> >> >> >> >> >Thanks Clement,
> >> >> >> >> >
> >> >> >> >> >If I use log command in my felix shell , I effectively got the
> >> >> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
> >> >> >> >> >my bundle: no logs:
> >> >> >> >> >____________________
> >> >> >> >> >@Requires
> >> >> >> >> >LogService felixLogImpl; // This is the only impl I have in my
> >> >>shell
> >> >> >> >> >....
> >> >> >> >> >public void start(BundleContext ctxt){
> >> >> >> >> >...
> >> >> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
> >> >> >> >> >...
> >> >> >> >> >}
> >> >> >> >> >_________________________
> >> >> >> >> >
> >> >> >> >> >This logs nothing: when I do a 'log' command in shell no log
> >> >>DEBUG
> >> >> >> >>appears
> >> >> >> >> >!?
> >> >> >> >>
> >> >> >> >> First, I don't know which level is displayed by the log command
> >> >>(info
> >> >> >> >> maybe).
> >> >> >> >> Then, do you have an instance of your component:
> >> >> >> >>
> >> >> >> >> @Component
> >> >> >> >> @Instantiate
> >> >> >> >> Public class MyClass {
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> Regards,
> >> >> >> >>
> >> >> >> >> Clement
> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >Pierre
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >> >> >
> >> >> >> >> >> Hi,
> >> >> >> >> >>
> >> >> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret"
> >><ph...@gmail.com>
> >> >> >>wrote:
> >> >> >> >> >>
> >> >> >> >> >> >Hello,
> >> >> >> >> >> >
> >> >> >> >> >> >I have this code to inject  an instance of LogService in a
> >> >> >>bundle:
> >> >> >> >> >> >_______________________________
> >> >> >> >> >> >    @Requires
> >> >> >> >> >> >    private LogReaderService lrs;
> >> >> >> >> >> >    @Requires
> >> >> >> >> >> >    private LogService log;
> >> >> >> >> >> >________________________________
> >> >> >> >> >> >
> >> >> >> >> >> >But when I use log service - write and read in it - after
> >> >>adding
> >> >> >>a
> >> >> >> >> >> >LogListeneer, I get nothing on felix console .
> >> >> >> >> >>
> >> >> >> >> >> The LogService Implementation from Felix does not print the
> >>log
> >> >> >> >>message
> >> >> >> >> >>on
> >> >> >> >> >> the console.
> >> >> >> >> >> If you're using Gogo (provided in the latest Felix
> >> >>distribution),
> >> >> >>you
> >> >> >> >> >>have
> >> >> >> >> >> the 'log' command
> >> >> >> >> >> Giving the last logged entries.
> >> >> >> >> >>
> >> >> >> >> >> Regards,
> >> >> >> >> >>
> >> >> >> >> >> Clement
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> >
> >> >> >> >> >> >Have I missed something ?
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >Pierre
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >>
> >>>>---------------------------------------------------------------------
> >> >> >> >> >> 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
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >>---------------------------------------------------------------------
> >> >> >> 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
> >> >>
> >> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>

Re: iPOJO log service

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

I found some time to check your code, and it works:
Here is the code:
http://ipojo.pastebin.com/dn4Qesmb

I've deployed this:
g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (3.0.3)
    1|Active     |    1|iPOJO Log Service Test (0.0.1.SNAPSHOT)
    2|Active     |    1|Apache Felix Bundle Repository (1.6.2)
    3|Active     |    1|Apache Felix Gogo Command (0.6.1)
    4|Active     |    1|Apache Felix Gogo Runtime (0.6.1)
    5|Active     |    1|Apache Felix Gogo Shell (0.6.1)
    6|Active     |    1|Apache Felix iPOJO (1.6.8)
    7|Active     |    1|Apache Felix Log Service (1.0.0)
    8|Active     |    1|Apache Felix iPOJO Gogo Command (1.1.0.SNAPSHOT)


And got the expected output:
g! install 
file:/Users/clement/Projects/felix-trunk/ipojo/arch-gogo/target/org.apache.
felix.ipojo.arch.gogo-1.1.0-SNAPSHOT.jar
Bundle ID: 8
log BundleEvent INSTALLED
g! start 8
log BundleEvent STARTED
log BundleEvent RESOLVED
log ServiceEvent REGISTERED
log ServiceEvent MODIFIED
log ServiceEvent REGISTERED
log ServiceEvent MODIFIED


So, something is wrong in your configuration. I've also uploaded my pom
file: http://ipojo.pastebin.com/Ns30cmKa

Regards,

Clement

On 22.12.10 11:49, "Pierre Henry Perret" <ph...@gmail.com> wrote:

>The instance is created and valid.
>I use the 1.6.4 versio of annotations and iPOJO 1.7.0
>
>
>
>2010/12/22 Clement Escoffier <cl...@gmail.com>
>
>>
>>
>> On 22.12.10 09:55, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>>
>> >Hello Clément,
>> >
>> >Here is the sample code I have to get the log service:
>> >___________________________
>> >    @Requires
>> >    private LogService log;
>> >    @Requires
>> >    private LogReaderService lrs;
>> >    @Validate
>> >    public void start(){
>> >        lrs.addLogListener(new LogListener() {
>> >
>> >            public void logged(LogEntry entry) {
>> >                System.out.println("log "+entry.getMessage());
>> >            }
>> >        });
>> >        log.log(LogService.LOG_DEBUG, "starting");
>> >    }
>> >____________________________
>> >
>> >I also have the org.apache.felix.log bundle as the log implementation.
>> >
>> >But still no logs on the console !
>> >Have I missed something ?
>>
>> Well, I can't really tell you what's wrong. Your code looks good. Check
>> with the arch command that your instance is created and valid.
>>
>> Clement
>>
>> >
>> >Pierre
>> >
>> >
>> >
>> >
>> >2010/12/21 Clement Escoffier <cl...@gmail.com>
>> >
>> >>
>> >>
>> >> On 21.12.10 12:58, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>> >>
>> >> >Yes, it seems the point.
>> >> >
>> >> >An instance is invalid because of an interface not found.
>> >>
>> >> Which service is not found ?
>> >>
>> >> >
>> >> >What is strange is that hen I suppress the metadata.xmf file from
>>the
>> >> >hello.impl.annotation sample, the instance is no more created.
>> >> >
>> >> >Is the instance name compulsory ?
>> >>
>> >>
>> >> If you use the @Instantiate annotation (requiring the latest
>> >>manipulator),
>> >> then the XML file is no more required.
>> >> The tutorial does not use the @Instantiate annotation so still
>>require
>> >>the
>> >> XML file to declare the instances.
>> >>
>> >>
>> >> Regards,
>> >>
>> >> Clement
>> >>
>> >>
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >2010/12/21 Clement Escoffier <cl...@gmail.com>
>> >> >
>> >> >>
>> >> >>
>> >> >> On 21.12.10 11:33, "Pierre Henry Perret" <ph...@gmail.com>
>>wrote:
>> >> >>
>> >> >> >This is precisely what I want to know !
>> >> >> >
>> >> >> >I receive this event log from felix:
>> >> >> >__________________________
>> >> >> >2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent
>> >>STARTED
>> >> >> >___________________
>> >> >> >
>> >> >> >I see the bundle 'Active' in the framework.
>> >> >> >But it is like if that @Ativate , in which I put the log
>>directive,
>> >>is
>> >> >>not
>> >> >> >executed, because if it were, I'll see the log ?
>> >> >>
>> >> >> Try first with a simple System.out.
>> >> >>
>> >> >> Bundles and components have two different lifecycles. The bundle
>>can
>> >>be
>> >> >> resolved and activated (imports were resolved), and components can
>> >>still
>> >> >> be invalid because of some missing services.
>> >> >>
>> >> >> Moreover, try to deploy and check the validity of your component
>>with
>> >> >>the
>> >> >> arch / instance command
>> >> >> (http://felix.apache.org/site/ipojo-arch-command.html)
>> >> >>
>> >> >> Regards,
>> >> >>
>> >> >> Clement
>> >> >>
>> >> >> >
>> >> >> >
>> >> >> >Pierre
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >2010/12/21 Clement Escoffier <cl...@gmail.com>
>> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com>
>> >>wrote:
>> >> >> >>
>> >> >> >> >Yes, I do that.
>> >> >> >> >But even so, there is no log entry when I lauch the log
>>command
>> >>in
>> >> >> >>felix
>> >> >> >> >shell...
>> >> >> >>
>> >> >> >> Are you sure that your code is executed ?
>> >> >> >>
>> >> >> >> Clement
>> >> >> >>
>> >> >> >> >
>> >> >> >> >Pierre
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> On 20.12.10 16:12, "Pierre Henry Perret"
>><ph...@gmail.com>
>> >> >>wrote:
>> >> >> >> >>
>> >> >> >> >> >Do you mean I should only use the log service in a declared
>> >> >> >>component ?
>> >> >> >> >> >
>> >> >> >> >> >The fact is that when I use annotations to inject the
>> >>LogService
>> >> >> >>which
>> >> >> >> >>is
>> >> >> >> >> >an
>> >> >> >> >> >'org.apache.felix.log' instance from the same bundle name
>> >>which I
>> >> >> >>put
>> >> >> >> >>in
>> >> >> >> >> >the
>> >> >> >> >> >'bundle' directory, the log service instiated because there
>> >>is no
>> >> >> >>log
>> >> >> >> >> >errors
>> >> >> >> >> >....
>> >> >> >> >>
>> >> >> >> >> I don't really understand but you cannot use @Requires in a
>> >> >> >> >>non-component
>> >> >> >> >> class. Only components are injected.
>> >> >> >> >>
>> >> >> >> >> So you should have something like:
>> >> >> >> >>
>> >> >> >> >> @Component
>> >> >> >> >> @Instantiate
>> >> >> >> >> public class MyClass {
>> >> >> >> >>     @Requires
>> >> >> >> >>    private LogReaderService lrs;
>> >> >> >> >>    @Requires
>> >> >> >> >>    private LogService log;
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>     @Validate
>> >> >> >> >>    public void start(){
>> >> >> >> >>         ...
>> >> >> >> >>        log.log(LogService.LOG_DEBUG, "my bundle is
>> >>starting...!"
>> >> >>);
>> >> >> >> >>        ...
>> >> >> >> >>    }
>> >> >> >> >>
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> Note that the 'start' method (@Validate) do not have a
>>bundle
>> >> >>context
>> >> >> >> >> parameter. If you want the bundle contex,t you can get it
>>from
>> >>the
>> >> >> >> >> constructor (it's the only place we inject the bundle
>>context
>> >>so
>> >> >> >>far):
>> >> >> >> >>
>> >> >> >> >> public MyClass(BundleContext bc) {
>> >> >> >> >>  ...
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >> Regards,
>> >> >> >> >>
>> >> >> >> >> Clement
>> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >THe log level is INFO yes, but command log has a parameter
>>to
>> >>set
>> >> >> >>the
>> >> >> >> >> >level.
>> >> >> >> >> >
>> >> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> On 20.12.10 14:21, "Pierre Henry Perret"
>> >><ph...@gmail.com>
>> >> >> >>wrote:
>> >> >> >> >> >>
>> >> >> >> >> >> >Thanks Clement,
>> >> >> >> >> >> >
>> >> >> >> >> >> >If I use log command in my felix shell , I effectively
>>got
>> >>the
>> >> >> >> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
>> >> >> >> >> >> >my bundle: no logs:
>> >> >> >> >> >> >____________________
>> >> >> >> >> >> >@Requires
>> >> >> >> >> >> >LogService felixLogImpl; // This is the only impl I have
>> >>in my
>> >> >> >>shell
>> >> >> >> >> >> >....
>> >> >> >> >> >> >public void start(BundleContext ctxt){
>> >> >> >> >> >> >...
>> >> >> >> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is
>> >>starting...!" );
>> >> >> >> >> >> >...
>> >> >> >> >> >> >}
>> >> >> >> >> >> >_________________________
>> >> >> >> >> >> >
>> >> >> >> >> >> >This logs nothing: when I do a 'log' command in shell no
>> >>log
>> >> >> >>DEBUG
>> >> >> >> >> >>appears
>> >> >> >> >> >> >!?
>> >> >> >> >> >>
>> >> >> >> >> >> First, I don't know which level is displayed by the log
>> >>command
>> >> >> >>(info
>> >> >> >> >> >> maybe).
>> >> >> >> >> >> Then, do you have an instance of your component:
>> >> >> >> >> >>
>> >> >> >> >> >> @Component
>> >> >> >> >> >> @Instantiate
>> >> >> >> >> >> Public class MyClass {
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> }
>> >> >> >> >> >>
>> >> >> >> >> >> Regards,
>> >> >> >> >> >>
>> >> >> >> >> >> Clement
>> >> >> >> >> >>
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> >Pierre
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> >2010/12/20 Clement Escoffier
>><cl...@gmail.com>
>> >> >> >> >> >> >
>> >> >> >> >> >> >> Hi,
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret"
>> >> >><ph...@gmail.com>
>> >> >> >> >>wrote:
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> >Hello,
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >I have this code to inject  an instance of LogService
>> >>in a
>> >> >> >> >>bundle:
>> >> >> >> >> >> >> >_______________________________
>> >> >> >> >> >> >> >    @Requires
>> >> >> >> >> >> >> >    private LogReaderService lrs;
>> >> >> >> >> >> >> >    @Requires
>> >> >> >> >> >> >> >    private LogService log;
>> >> >> >> >> >> >> >________________________________
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >But when I use log service - write and read in it -
>> >>after
>> >> >> >>adding
>> >> >> >> >>a
>> >> >> >> >> >> >> >LogListeneer, I get nothing on felix console .
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> The LogService Implementation from Felix does not
>>print
>> >>the
>> >> >>log
>> >> >> >> >> >>message
>> >> >> >> >> >> >>on
>> >> >> >> >> >> >> the console.
>> >> >> >> >> >> >> If you're using Gogo (provided in the latest Felix
>> >> >> >>distribution),
>> >> >> >> >>you
>> >> >> >> >> >> >>have
>> >> >> >> >> >> >> the 'log' command
>> >> >> >> >> >> >> Giving the last logged entries.
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Regards,
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Clement
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >Have I missed something ?
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >Pierre
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >>
>> >>
>> 
>>>>>>>>-------------------------------------------------------------------
>>>>>>>>--
>> >> >> >> >> >> >> 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
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> 
>>>>---------------------------------------------------------------------
>> >> >> >> >> 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
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> 
>>---------------------------------------------------------------------
>> >> >> 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
>> >>
>> >>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: iPOJO log service

Posted by Pierre Henry Perret <ph...@gmail.com>.
The instance is created and valid.
I use the 1.6.4 versio of annotations and iPOJO 1.7.0



2010/12/22 Clement Escoffier <cl...@gmail.com>

>
>
> On 22.12.10 09:55, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >Hello Clément,
> >
> >Here is the sample code I have to get the log service:
> >___________________________
> >    @Requires
> >    private LogService log;
> >    @Requires
> >    private LogReaderService lrs;
> >    @Validate
> >    public void start(){
> >        lrs.addLogListener(new LogListener() {
> >
> >            public void logged(LogEntry entry) {
> >                System.out.println("log "+entry.getMessage());
> >            }
> >        });
> >        log.log(LogService.LOG_DEBUG, "starting");
> >    }
> >____________________________
> >
> >I also have the org.apache.felix.log bundle as the log implementation.
> >
> >But still no logs on the console !
> >Have I missed something ?
>
> Well, I can't really tell you what's wrong. Your code looks good. Check
> with the arch command that your instance is created and valid.
>
> Clement
>
> >
> >Pierre
> >
> >
> >
> >
> >2010/12/21 Clement Escoffier <cl...@gmail.com>
> >
> >>
> >>
> >> On 21.12.10 12:58, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >>
> >> >Yes, it seems the point.
> >> >
> >> >An instance is invalid because of an interface not found.
> >>
> >> Which service is not found ?
> >>
> >> >
> >> >What is strange is that hen I suppress the metadata.xmf file from the
> >> >hello.impl.annotation sample, the instance is no more created.
> >> >
> >> >Is the instance name compulsory ?
> >>
> >>
> >> If you use the @Instantiate annotation (requiring the latest
> >>manipulator),
> >> then the XML file is no more required.
> >> The tutorial does not use the @Instantiate annotation so still require
> >>the
> >> XML file to declare the instances.
> >>
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >>
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >2010/12/21 Clement Escoffier <cl...@gmail.com>
> >> >
> >> >>
> >> >>
> >> >> On 21.12.10 11:33, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >> >>
> >> >> >This is precisely what I want to know !
> >> >> >
> >> >> >I receive this event log from felix:
> >> >> >__________________________
> >> >> >2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent
> >>STARTED
> >> >> >___________________
> >> >> >
> >> >> >I see the bundle 'Active' in the framework.
> >> >> >But it is like if that @Ativate , in which I put the log directive,
> >>is
> >> >>not
> >> >> >executed, because if it were, I'll see the log ?
> >> >>
> >> >> Try first with a simple System.out.
> >> >>
> >> >> Bundles and components have two different lifecycles. The bundle can
> >>be
> >> >> resolved and activated (imports were resolved), and components can
> >>still
> >> >> be invalid because of some missing services.
> >> >>
> >> >> Moreover, try to deploy and check the validity of your component with
> >> >>the
> >> >> arch / instance command
> >> >> (http://felix.apache.org/site/ipojo-arch-command.html)
> >> >>
> >> >> Regards,
> >> >>
> >> >> Clement
> >> >>
> >> >> >
> >> >> >
> >> >> >Pierre
> >> >> >
> >> >> >
> >> >> >
> >> >> >2010/12/21 Clement Escoffier <cl...@gmail.com>
> >> >> >
> >> >> >>
> >> >> >>
> >> >> >> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com>
> >>wrote:
> >> >> >>
> >> >> >> >Yes, I do that.
> >> >> >> >But even so, there is no log entry when I lauch the log command
> >>in
> >> >> >>felix
> >> >> >> >shell...
> >> >> >>
> >> >> >> Are you sure that your code is executed ?
> >> >> >>
> >> >> >> Clement
> >> >> >>
> >> >> >> >
> >> >> >> >Pierre
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >> >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com>
> >> >>wrote:
> >> >> >> >>
> >> >> >> >> >Do you mean I should only use the log service in a declared
> >> >> >>component ?
> >> >> >> >> >
> >> >> >> >> >The fact is that when I use annotations to inject the
> >>LogService
> >> >> >>which
> >> >> >> >>is
> >> >> >> >> >an
> >> >> >> >> >'org.apache.felix.log' instance from the same bundle name
> >>which I
> >> >> >>put
> >> >> >> >>in
> >> >> >> >> >the
> >> >> >> >> >'bundle' directory, the log service instiated because there
> >>is no
> >> >> >>log
> >> >> >> >> >errors
> >> >> >> >> >....
> >> >> >> >>
> >> >> >> >> I don't really understand but you cannot use @Requires in a
> >> >> >> >>non-component
> >> >> >> >> class. Only components are injected.
> >> >> >> >>
> >> >> >> >> So you should have something like:
> >> >> >> >>
> >> >> >> >> @Component
> >> >> >> >> @Instantiate
> >> >> >> >> public class MyClass {
> >> >> >> >>     @Requires
> >> >> >> >>    private LogReaderService lrs;
> >> >> >> >>    @Requires
> >> >> >> >>    private LogService log;
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>     @Validate
> >> >> >> >>    public void start(){
> >> >> >> >>         ...
> >> >> >> >>        log.log(LogService.LOG_DEBUG, "my bundle is
> >>starting...!"
> >> >>);
> >> >> >> >>        ...
> >> >> >> >>    }
> >> >> >> >>
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Note that the 'start' method (@Validate) do not have a bundle
> >> >>context
> >> >> >> >> parameter. If you want the bundle contex,t you can get it from
> >>the
> >> >> >> >> constructor (it's the only place we inject the bundle context
> >>so
> >> >> >>far):
> >> >> >> >>
> >> >> >> >> public MyClass(BundleContext bc) {
> >> >> >> >>  ...
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> Regards,
> >> >> >> >>
> >> >> >> >> Clement
> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >THe log level is INFO yes, but command log has a parameter to
> >>set
> >> >> >>the
> >> >> >> >> >level.
> >> >> >> >> >
> >> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> On 20.12.10 14:21, "Pierre Henry Perret"
> >><ph...@gmail.com>
> >> >> >>wrote:
> >> >> >> >> >>
> >> >> >> >> >> >Thanks Clement,
> >> >> >> >> >> >
> >> >> >> >> >> >If I use log command in my felix shell , I effectively got
> >>the
> >> >> >> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
> >> >> >> >> >> >my bundle: no logs:
> >> >> >> >> >> >____________________
> >> >> >> >> >> >@Requires
> >> >> >> >> >> >LogService felixLogImpl; // This is the only impl I have
> >>in my
> >> >> >>shell
> >> >> >> >> >> >....
> >> >> >> >> >> >public void start(BundleContext ctxt){
> >> >> >> >> >> >...
> >> >> >> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is
> >>starting...!" );
> >> >> >> >> >> >...
> >> >> >> >> >> >}
> >> >> >> >> >> >_________________________
> >> >> >> >> >> >
> >> >> >> >> >> >This logs nothing: when I do a 'log' command in shell no
> >>log
> >> >> >>DEBUG
> >> >> >> >> >>appears
> >> >> >> >> >> >!?
> >> >> >> >> >>
> >> >> >> >> >> First, I don't know which level is displayed by the log
> >>command
> >> >> >>(info
> >> >> >> >> >> maybe).
> >> >> >> >> >> Then, do you have an instance of your component:
> >> >> >> >> >>
> >> >> >> >> >> @Component
> >> >> >> >> >> @Instantiate
> >> >> >> >> >> Public class MyClass {
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> }
> >> >> >> >> >>
> >> >> >> >> >> Regards,
> >> >> >> >> >>
> >> >> >> >> >> Clement
> >> >> >> >> >>
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >Pierre
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >> >> >> >
> >> >> >> >> >> >> Hi,
> >> >> >> >> >> >>
> >> >> >> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret"
> >> >><ph...@gmail.com>
> >> >> >> >>wrote:
> >> >> >> >> >> >>
> >> >> >> >> >> >> >Hello,
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >I have this code to inject  an instance of LogService
> >>in a
> >> >> >> >>bundle:
> >> >> >> >> >> >> >_______________________________
> >> >> >> >> >> >> >    @Requires
> >> >> >> >> >> >> >    private LogReaderService lrs;
> >> >> >> >> >> >> >    @Requires
> >> >> >> >> >> >> >    private LogService log;
> >> >> >> >> >> >> >________________________________
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >But when I use log service - write and read in it -
> >>after
> >> >> >>adding
> >> >> >> >>a
> >> >> >> >> >> >> >LogListeneer, I get nothing on felix console .
> >> >> >> >> >> >>
> >> >> >> >> >> >> The LogService Implementation from Felix does not print
> >>the
> >> >>log
> >> >> >> >> >>message
> >> >> >> >> >> >>on
> >> >> >> >> >> >> the console.
> >> >> >> >> >> >> If you're using Gogo (provided in the latest Felix
> >> >> >>distribution),
> >> >> >> >>you
> >> >> >> >> >> >>have
> >> >> >> >> >> >> the 'log' command
> >> >> >> >> >> >> Giving the last logged entries.
> >> >> >> >> >> >>
> >> >> >> >> >> >> Regards,
> >> >> >> >> >> >>
> >> >> >> >> >> >> Clement
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >Have I missed something ?
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >Pierre
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >>
> >>
> >>>>>>---------------------------------------------------------------------
> >> >> >> >> >> >> 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
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >>---------------------------------------------------------------------
> >> >> >> >> 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
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> 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
> >>
> >>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: iPOJO log service

Posted by Clement Escoffier <cl...@gmail.com>.

On 22.12.10 09:55, "Pierre Henry Perret" <ph...@gmail.com> wrote:

>Hello Clément,
>
>Here is the sample code I have to get the log service:
>___________________________
>    @Requires
>    private LogService log;
>    @Requires
>    private LogReaderService lrs;
>    @Validate
>    public void start(){
>        lrs.addLogListener(new LogListener() {
>
>            public void logged(LogEntry entry) {
>                System.out.println("log "+entry.getMessage());
>            }
>        });
>        log.log(LogService.LOG_DEBUG, "starting");
>    }
>____________________________
>
>I also have the org.apache.felix.log bundle as the log implementation.
>
>But still no logs on the console !
>Have I missed something ?

Well, I can't really tell you what's wrong. Your code looks good. Check
with the arch command that your instance is created and valid.

Clement

>
>Pierre
>
>
>
>
>2010/12/21 Clement Escoffier <cl...@gmail.com>
>
>>
>>
>> On 21.12.10 12:58, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>>
>> >Yes, it seems the point.
>> >
>> >An instance is invalid because of an interface not found.
>>
>> Which service is not found ?
>>
>> >
>> >What is strange is that hen I suppress the metadata.xmf file from the
>> >hello.impl.annotation sample, the instance is no more created.
>> >
>> >Is the instance name compulsory ?
>>
>>
>> If you use the @Instantiate annotation (requiring the latest
>>manipulator),
>> then the XML file is no more required.
>> The tutorial does not use the @Instantiate annotation so still require
>>the
>> XML file to declare the instances.
>>
>>
>> Regards,
>>
>> Clement
>>
>>
>> >
>> >
>> >
>> >
>> >
>> >2010/12/21 Clement Escoffier <cl...@gmail.com>
>> >
>> >>
>> >>
>> >> On 21.12.10 11:33, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>> >>
>> >> >This is precisely what I want to know !
>> >> >
>> >> >I receive this event log from felix:
>> >> >__________________________
>> >> >2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent
>>STARTED
>> >> >___________________
>> >> >
>> >> >I see the bundle 'Active' in the framework.
>> >> >But it is like if that @Ativate , in which I put the log directive,
>>is
>> >>not
>> >> >executed, because if it were, I'll see the log ?
>> >>
>> >> Try first with a simple System.out.
>> >>
>> >> Bundles and components have two different lifecycles. The bundle can
>>be
>> >> resolved and activated (imports were resolved), and components can
>>still
>> >> be invalid because of some missing services.
>> >>
>> >> Moreover, try to deploy and check the validity of your component with
>> >>the
>> >> arch / instance command
>> >> (http://felix.apache.org/site/ipojo-arch-command.html)
>> >>
>> >> Regards,
>> >>
>> >> Clement
>> >>
>> >> >
>> >> >
>> >> >Pierre
>> >> >
>> >> >
>> >> >
>> >> >2010/12/21 Clement Escoffier <cl...@gmail.com>
>> >> >
>> >> >>
>> >> >>
>> >> >> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com>
>>wrote:
>> >> >>
>> >> >> >Yes, I do that.
>> >> >> >But even so, there is no log entry when I lauch the log command
>>in
>> >> >>felix
>> >> >> >shell...
>> >> >>
>> >> >> Are you sure that your code is executed ?
>> >> >>
>> >> >> Clement
>> >> >>
>> >> >> >
>> >> >> >Pierre
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com>
>> >>wrote:
>> >> >> >>
>> >> >> >> >Do you mean I should only use the log service in a declared
>> >> >>component ?
>> >> >> >> >
>> >> >> >> >The fact is that when I use annotations to inject the
>>LogService
>> >> >>which
>> >> >> >>is
>> >> >> >> >an
>> >> >> >> >'org.apache.felix.log' instance from the same bundle name
>>which I
>> >> >>put
>> >> >> >>in
>> >> >> >> >the
>> >> >> >> >'bundle' directory, the log service instiated because there
>>is no
>> >> >>log
>> >> >> >> >errors
>> >> >> >> >....
>> >> >> >>
>> >> >> >> I don't really understand but you cannot use @Requires in a
>> >> >> >>non-component
>> >> >> >> class. Only components are injected.
>> >> >> >>
>> >> >> >> So you should have something like:
>> >> >> >>
>> >> >> >> @Component
>> >> >> >> @Instantiate
>> >> >> >> public class MyClass {
>> >> >> >>     @Requires
>> >> >> >>    private LogReaderService lrs;
>> >> >> >>    @Requires
>> >> >> >>    private LogService log;
>> >> >> >>
>> >> >> >>
>> >> >> >>     @Validate
>> >> >> >>    public void start(){
>> >> >> >>         ...
>> >> >> >>        log.log(LogService.LOG_DEBUG, "my bundle is
>>starting...!"
>> >>);
>> >> >> >>        ...
>> >> >> >>    }
>> >> >> >>
>> >> >> >> }
>> >> >> >>
>> >> >> >>
>> >> >> >> Note that the 'start' method (@Validate) do not have a bundle
>> >>context
>> >> >> >> parameter. If you want the bundle contex,t you can get it from
>>the
>> >> >> >> constructor (it's the only place we inject the bundle context
>>so
>> >> >>far):
>> >> >> >>
>> >> >> >> public MyClass(BundleContext bc) {
>> >> >> >>  ...
>> >> >> >> }
>> >> >> >>
>> >> >> >> Regards,
>> >> >> >>
>> >> >> >> Clement
>> >> >> >>
>> >> >> >> >
>> >> >> >> >THe log level is INFO yes, but command log has a parameter to
>>set
>> >> >>the
>> >> >> >> >level.
>> >> >> >> >
>> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> On 20.12.10 14:21, "Pierre Henry Perret"
>><ph...@gmail.com>
>> >> >>wrote:
>> >> >> >> >>
>> >> >> >> >> >Thanks Clement,
>> >> >> >> >> >
>> >> >> >> >> >If I use log command in my felix shell , I effectively got
>>the
>> >> >> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
>> >> >> >> >> >my bundle: no logs:
>> >> >> >> >> >____________________
>> >> >> >> >> >@Requires
>> >> >> >> >> >LogService felixLogImpl; // This is the only impl I have
>>in my
>> >> >>shell
>> >> >> >> >> >....
>> >> >> >> >> >public void start(BundleContext ctxt){
>> >> >> >> >> >...
>> >> >> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is
>>starting...!" );
>> >> >> >> >> >...
>> >> >> >> >> >}
>> >> >> >> >> >_________________________
>> >> >> >> >> >
>> >> >> >> >> >This logs nothing: when I do a 'log' command in shell no
>>log
>> >> >>DEBUG
>> >> >> >> >>appears
>> >> >> >> >> >!?
>> >> >> >> >>
>> >> >> >> >> First, I don't know which level is displayed by the log
>>command
>> >> >>(info
>> >> >> >> >> maybe).
>> >> >> >> >> Then, do you have an instance of your component:
>> >> >> >> >>
>> >> >> >> >> @Component
>> >> >> >> >> @Instantiate
>> >> >> >> >> Public class MyClass {
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >> Regards,
>> >> >> >> >>
>> >> >> >> >> Clement
>> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >Pierre
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >> >> >> >
>> >> >> >> >> >> Hi,
>> >> >> >> >> >>
>> >> >> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret"
>> >><ph...@gmail.com>
>> >> >> >>wrote:
>> >> >> >> >> >>
>> >> >> >> >> >> >Hello,
>> >> >> >> >> >> >
>> >> >> >> >> >> >I have this code to inject  an instance of LogService
>>in a
>> >> >> >>bundle:
>> >> >> >> >> >> >_______________________________
>> >> >> >> >> >> >    @Requires
>> >> >> >> >> >> >    private LogReaderService lrs;
>> >> >> >> >> >> >    @Requires
>> >> >> >> >> >> >    private LogService log;
>> >> >> >> >> >> >________________________________
>> >> >> >> >> >> >
>> >> >> >> >> >> >But when I use log service - write and read in it -
>>after
>> >> >>adding
>> >> >> >>a
>> >> >> >> >> >> >LogListeneer, I get nothing on felix console .
>> >> >> >> >> >>
>> >> >> >> >> >> The LogService Implementation from Felix does not print
>>the
>> >>log
>> >> >> >> >>message
>> >> >> >> >> >>on
>> >> >> >> >> >> the console.
>> >> >> >> >> >> If you're using Gogo (provided in the latest Felix
>> >> >>distribution),
>> >> >> >>you
>> >> >> >> >> >>have
>> >> >> >> >> >> the 'log' command
>> >> >> >> >> >> Giving the last logged entries.
>> >> >> >> >> >>
>> >> >> >> >> >> Regards,
>> >> >> >> >> >>
>> >> >> >> >> >> Clement
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> >
>> >> >> >> >> >> >Have I missed something ?
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> >Pierre
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >>
>> 
>>>>>>---------------------------------------------------------------------
>> >> >> >> >> >> 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
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >>---------------------------------------------------------------------
>> >> >> >> 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
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>>



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


Re: iPOJO log service

Posted by Pierre Henry Perret <ph...@gmail.com>.
Hello Clément,

Here is the sample code I have to get the log service:
___________________________
    @Requires
    private LogService log;
    @Requires
    private LogReaderService lrs;
    @Validate
    public void start(){
        lrs.addLogListener(new LogListener() {

            public void logged(LogEntry entry) {
                System.out.println("log "+entry.getMessage());
            }
        });
        log.log(LogService.LOG_DEBUG, "starting");
    }
____________________________

I also have the org.apache.felix.log bundle as the log implementation.

But still no logs on the console !
Have I missed something ?

Pierre




2010/12/21 Clement Escoffier <cl...@gmail.com>

>
>
> On 21.12.10 12:58, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >Yes, it seems the point.
> >
> >An instance is invalid because of an interface not found.
>
> Which service is not found ?
>
> >
> >What is strange is that hen I suppress the metadata.xmf file from the
> >hello.impl.annotation sample, the instance is no more created.
> >
> >Is the instance name compulsory ?
>
>
> If you use the @Instantiate annotation (requiring the latest manipulator),
> then the XML file is no more required.
> The tutorial does not use the @Instantiate annotation so still require the
> XML file to declare the instances.
>
>
> Regards,
>
> Clement
>
>
> >
> >
> >
> >
> >
> >2010/12/21 Clement Escoffier <cl...@gmail.com>
> >
> >>
> >>
> >> On 21.12.10 11:33, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >>
> >> >This is precisely what I want to know !
> >> >
> >> >I receive this event log from felix:
> >> >__________________________
> >> >2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent STARTED
> >> >___________________
> >> >
> >> >I see the bundle 'Active' in the framework.
> >> >But it is like if that @Ativate , in which I put the log directive, is
> >>not
> >> >executed, because if it were, I'll see the log ?
> >>
> >> Try first with a simple System.out.
> >>
> >> Bundles and components have two different lifecycles. The bundle can be
> >> resolved and activated (imports were resolved), and components can still
> >> be invalid because of some missing services.
> >>
> >> Moreover, try to deploy and check the validity of your component with
> >>the
> >> arch / instance command
> >> (http://felix.apache.org/site/ipojo-arch-command.html)
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >> >
> >> >
> >> >Pierre
> >> >
> >> >
> >> >
> >> >2010/12/21 Clement Escoffier <cl...@gmail.com>
> >> >
> >> >>
> >> >>
> >> >> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >> >>
> >> >> >Yes, I do that.
> >> >> >But even so, there is no log entry when I lauch the log command in
> >> >>felix
> >> >> >shell...
> >> >>
> >> >> Are you sure that your code is executed ?
> >> >>
> >> >> Clement
> >> >>
> >> >> >
> >> >> >Pierre
> >> >> >
> >> >> >
> >> >> >
> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >
> >> >> >>
> >> >> >>
> >> >> >> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com>
> >>wrote:
> >> >> >>
> >> >> >> >Do you mean I should only use the log service in a declared
> >> >>component ?
> >> >> >> >
> >> >> >> >The fact is that when I use annotations to inject the LogService
> >> >>which
> >> >> >>is
> >> >> >> >an
> >> >> >> >'org.apache.felix.log' instance from the same bundle name which I
> >> >>put
> >> >> >>in
> >> >> >> >the
> >> >> >> >'bundle' directory, the log service instiated because there is no
> >> >>log
> >> >> >> >errors
> >> >> >> >....
> >> >> >>
> >> >> >> I don't really understand but you cannot use @Requires in a
> >> >> >>non-component
> >> >> >> class. Only components are injected.
> >> >> >>
> >> >> >> So you should have something like:
> >> >> >>
> >> >> >> @Component
> >> >> >> @Instantiate
> >> >> >> public class MyClass {
> >> >> >>     @Requires
> >> >> >>    private LogReaderService lrs;
> >> >> >>    @Requires
> >> >> >>    private LogService log;
> >> >> >>
> >> >> >>
> >> >> >>     @Validate
> >> >> >>    public void start(){
> >> >> >>         ...
> >> >> >>        log.log(LogService.LOG_DEBUG, "my bundle is starting...!"
> >>);
> >> >> >>        ...
> >> >> >>    }
> >> >> >>
> >> >> >> }
> >> >> >>
> >> >> >>
> >> >> >> Note that the 'start' method (@Validate) do not have a bundle
> >>context
> >> >> >> parameter. If you want the bundle contex,t you can get it from the
> >> >> >> constructor (it's the only place we inject the bundle context so
> >> >>far):
> >> >> >>
> >> >> >> public MyClass(BundleContext bc) {
> >> >> >>  ...
> >> >> >> }
> >> >> >>
> >> >> >> Regards,
> >> >> >>
> >> >> >> Clement
> >> >> >>
> >> >> >> >
> >> >> >> >THe log level is INFO yes, but command log has a parameter to set
> >> >>the
> >> >> >> >level.
> >> >> >> >
> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >> >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com>
> >> >>wrote:
> >> >> >> >>
> >> >> >> >> >Thanks Clement,
> >> >> >> >> >
> >> >> >> >> >If I use log command in my felix shell , I effectively got the
> >> >> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
> >> >> >> >> >my bundle: no logs:
> >> >> >> >> >____________________
> >> >> >> >> >@Requires
> >> >> >> >> >LogService felixLogImpl; // This is the only impl I have in my
> >> >>shell
> >> >> >> >> >....
> >> >> >> >> >public void start(BundleContext ctxt){
> >> >> >> >> >...
> >> >> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
> >> >> >> >> >...
> >> >> >> >> >}
> >> >> >> >> >_________________________
> >> >> >> >> >
> >> >> >> >> >This logs nothing: when I do a 'log' command in shell no log
> >> >>DEBUG
> >> >> >> >>appears
> >> >> >> >> >!?
> >> >> >> >>
> >> >> >> >> First, I don't know which level is displayed by the log command
> >> >>(info
> >> >> >> >> maybe).
> >> >> >> >> Then, do you have an instance of your component:
> >> >> >> >>
> >> >> >> >> @Component
> >> >> >> >> @Instantiate
> >> >> >> >> Public class MyClass {
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >> Regards,
> >> >> >> >>
> >> >> >> >> Clement
> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >Pierre
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >> >> >
> >> >> >> >> >> Hi,
> >> >> >> >> >>
> >> >> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret"
> >><ph...@gmail.com>
> >> >> >>wrote:
> >> >> >> >> >>
> >> >> >> >> >> >Hello,
> >> >> >> >> >> >
> >> >> >> >> >> >I have this code to inject  an instance of LogService in a
> >> >> >>bundle:
> >> >> >> >> >> >_______________________________
> >> >> >> >> >> >    @Requires
> >> >> >> >> >> >    private LogReaderService lrs;
> >> >> >> >> >> >    @Requires
> >> >> >> >> >> >    private LogService log;
> >> >> >> >> >> >________________________________
> >> >> >> >> >> >
> >> >> >> >> >> >But when I use log service - write and read in it - after
> >> >>adding
> >> >> >>a
> >> >> >> >> >> >LogListeneer, I get nothing on felix console .
> >> >> >> >> >>
> >> >> >> >> >> The LogService Implementation from Felix does not print the
> >>log
> >> >> >> >>message
> >> >> >> >> >>on
> >> >> >> >> >> the console.
> >> >> >> >> >> If you're using Gogo (provided in the latest Felix
> >> >>distribution),
> >> >> >>you
> >> >> >> >> >>have
> >> >> >> >> >> the 'log' command
> >> >> >> >> >> Giving the last logged entries.
> >> >> >> >> >>
> >> >> >> >> >> Regards,
> >> >> >> >> >>
> >> >> >> >> >> Clement
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> >
> >> >> >> >> >> >Have I missed something ?
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >Pierre
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >>
> >>>>---------------------------------------------------------------------
> >> >> >> >> >> 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
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >>---------------------------------------------------------------------
> >> >> >> 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
> >> >>
> >> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>

Re: iPOJO log service

Posted by Clement Escoffier <cl...@gmail.com>.

On 21.12.10 12:58, "Pierre Henry Perret" <ph...@gmail.com> wrote:

>Yes, it seems the point.
>
>An instance is invalid because of an interface not found.

Which service is not found ?

>
>What is strange is that hen I suppress the metadata.xmf file from the
>hello.impl.annotation sample, the instance is no more created.
>
>Is the instance name compulsory ?


If you use the @Instantiate annotation (requiring the latest manipulator),
then the XML file is no more required.
The tutorial does not use the @Instantiate annotation so still require the
XML file to declare the instances.


Regards,

Clement


>
>
>
>
>
>2010/12/21 Clement Escoffier <cl...@gmail.com>
>
>>
>>
>> On 21.12.10 11:33, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>>
>> >This is precisely what I want to know !
>> >
>> >I receive this event log from felix:
>> >__________________________
>> >2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent STARTED
>> >___________________
>> >
>> >I see the bundle 'Active' in the framework.
>> >But it is like if that @Ativate , in which I put the log directive, is
>>not
>> >executed, because if it were, I'll see the log ?
>>
>> Try first with a simple System.out.
>>
>> Bundles and components have two different lifecycles. The bundle can be
>> resolved and activated (imports were resolved), and components can still
>> be invalid because of some missing services.
>>
>> Moreover, try to deploy and check the validity of your component with
>>the
>> arch / instance command
>> (http://felix.apache.org/site/ipojo-arch-command.html)
>>
>> Regards,
>>
>> Clement
>>
>> >
>> >
>> >Pierre
>> >
>> >
>> >
>> >2010/12/21 Clement Escoffier <cl...@gmail.com>
>> >
>> >>
>> >>
>> >> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>> >>
>> >> >Yes, I do that.
>> >> >But even so, there is no log entry when I lauch the log command in
>> >>felix
>> >> >shell...
>> >>
>> >> Are you sure that your code is executed ?
>> >>
>> >> Clement
>> >>
>> >> >
>> >> >Pierre
>> >> >
>> >> >
>> >> >
>> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >
>> >> >>
>> >> >>
>> >> >> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com>
>>wrote:
>> >> >>
>> >> >> >Do you mean I should only use the log service in a declared
>> >>component ?
>> >> >> >
>> >> >> >The fact is that when I use annotations to inject the LogService
>> >>which
>> >> >>is
>> >> >> >an
>> >> >> >'org.apache.felix.log' instance from the same bundle name which I
>> >>put
>> >> >>in
>> >> >> >the
>> >> >> >'bundle' directory, the log service instiated because there is no
>> >>log
>> >> >> >errors
>> >> >> >....
>> >> >>
>> >> >> I don't really understand but you cannot use @Requires in a
>> >> >>non-component
>> >> >> class. Only components are injected.
>> >> >>
>> >> >> So you should have something like:
>> >> >>
>> >> >> @Component
>> >> >> @Instantiate
>> >> >> public class MyClass {
>> >> >>     @Requires
>> >> >>    private LogReaderService lrs;
>> >> >>    @Requires
>> >> >>    private LogService log;
>> >> >>
>> >> >>
>> >> >>     @Validate
>> >> >>    public void start(){
>> >> >>         ...
>> >> >>        log.log(LogService.LOG_DEBUG, "my bundle is starting...!"
>>);
>> >> >>        ...
>> >> >>    }
>> >> >>
>> >> >> }
>> >> >>
>> >> >>
>> >> >> Note that the 'start' method (@Validate) do not have a bundle
>>context
>> >> >> parameter. If you want the bundle contex,t you can get it from the
>> >> >> constructor (it's the only place we inject the bundle context so
>> >>far):
>> >> >>
>> >> >> public MyClass(BundleContext bc) {
>> >> >>  ...
>> >> >> }
>> >> >>
>> >> >> Regards,
>> >> >>
>> >> >> Clement
>> >> >>
>> >> >> >
>> >> >> >THe log level is INFO yes, but command log has a parameter to set
>> >>the
>> >> >> >level.
>> >> >> >
>> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com>
>> >>wrote:
>> >> >> >>
>> >> >> >> >Thanks Clement,
>> >> >> >> >
>> >> >> >> >If I use log command in my felix shell , I effectively got the
>> >> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
>> >> >> >> >my bundle: no logs:
>> >> >> >> >____________________
>> >> >> >> >@Requires
>> >> >> >> >LogService felixLogImpl; // This is the only impl I have in my
>> >>shell
>> >> >> >> >....
>> >> >> >> >public void start(BundleContext ctxt){
>> >> >> >> >...
>> >> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
>> >> >> >> >...
>> >> >> >> >}
>> >> >> >> >_________________________
>> >> >> >> >
>> >> >> >> >This logs nothing: when I do a 'log' command in shell no log
>> >>DEBUG
>> >> >> >>appears
>> >> >> >> >!?
>> >> >> >>
>> >> >> >> First, I don't know which level is displayed by the log command
>> >>(info
>> >> >> >> maybe).
>> >> >> >> Then, do you have an instance of your component:
>> >> >> >>
>> >> >> >> @Component
>> >> >> >> @Instantiate
>> >> >> >> Public class MyClass {
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> }
>> >> >> >>
>> >> >> >> Regards,
>> >> >> >>
>> >> >> >> Clement
>> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >Pierre
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >> >> >
>> >> >> >> >> Hi,
>> >> >> >> >>
>> >> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret"
>><ph...@gmail.com>
>> >> >>wrote:
>> >> >> >> >>
>> >> >> >> >> >Hello,
>> >> >> >> >> >
>> >> >> >> >> >I have this code to inject  an instance of LogService in a
>> >> >>bundle:
>> >> >> >> >> >_______________________________
>> >> >> >> >> >    @Requires
>> >> >> >> >> >    private LogReaderService lrs;
>> >> >> >> >> >    @Requires
>> >> >> >> >> >    private LogService log;
>> >> >> >> >> >________________________________
>> >> >> >> >> >
>> >> >> >> >> >But when I use log service - write and read in it - after
>> >>adding
>> >> >>a
>> >> >> >> >> >LogListeneer, I get nothing on felix console .
>> >> >> >> >>
>> >> >> >> >> The LogService Implementation from Felix does not print the
>>log
>> >> >> >>message
>> >> >> >> >>on
>> >> >> >> >> the console.
>> >> >> >> >> If you're using Gogo (provided in the latest Felix
>> >>distribution),
>> >> >>you
>> >> >> >> >>have
>> >> >> >> >> the 'log' command
>> >> >> >> >> Giving the last logged entries.
>> >> >> >> >>
>> >> >> >> >> Regards,
>> >> >> >> >>
>> >> >> >> >> Clement
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >Have I missed something ?
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >Pierre
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> 
>>>>---------------------------------------------------------------------
>> >> >> >> >> 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
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> 
>>---------------------------------------------------------------------
>> >> >> 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
>> >>
>> >>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: iPOJO log service

Posted by Pierre Henry Perret <ph...@gmail.com>.
Yes, it seems the point.

An instance is invalid because of an interface not found.

What is strange is that hen I suppress the metadata.xmf file from the
hello.impl.annotation sample, the instance is no more created.

Is the instance name compulsory ?





2010/12/21 Clement Escoffier <cl...@gmail.com>

>
>
> On 21.12.10 11:33, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >This is precisely what I want to know !
> >
> >I receive this event log from felix:
> >__________________________
> >2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent STARTED
> >___________________
> >
> >I see the bundle 'Active' in the framework.
> >But it is like if that @Ativate , in which I put the log directive, is not
> >executed, because if it were, I'll see the log ?
>
> Try first with a simple System.out.
>
> Bundles and components have two different lifecycles. The bundle can be
> resolved and activated (imports were resolved), and components can still
> be invalid because of some missing services.
>
> Moreover, try to deploy and check the validity of your component with the
> arch / instance command
> (http://felix.apache.org/site/ipojo-arch-command.html)
>
> Regards,
>
> Clement
>
> >
> >
> >Pierre
> >
> >
> >
> >2010/12/21 Clement Escoffier <cl...@gmail.com>
> >
> >>
> >>
> >> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >>
> >> >Yes, I do that.
> >> >But even so, there is no log entry when I lauch the log command in
> >>felix
> >> >shell...
> >>
> >> Are you sure that your code is executed ?
> >>
> >> Clement
> >>
> >> >
> >> >Pierre
> >> >
> >> >
> >> >
> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >
> >> >>
> >> >>
> >> >> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >> >>
> >> >> >Do you mean I should only use the log service in a declared
> >>component ?
> >> >> >
> >> >> >The fact is that when I use annotations to inject the LogService
> >>which
> >> >>is
> >> >> >an
> >> >> >'org.apache.felix.log' instance from the same bundle name which I
> >>put
> >> >>in
> >> >> >the
> >> >> >'bundle' directory, the log service instiated because there is no
> >>log
> >> >> >errors
> >> >> >....
> >> >>
> >> >> I don't really understand but you cannot use @Requires in a
> >> >>non-component
> >> >> class. Only components are injected.
> >> >>
> >> >> So you should have something like:
> >> >>
> >> >> @Component
> >> >> @Instantiate
> >> >> public class MyClass {
> >> >>     @Requires
> >> >>    private LogReaderService lrs;
> >> >>    @Requires
> >> >>    private LogService log;
> >> >>
> >> >>
> >> >>     @Validate
> >> >>    public void start(){
> >> >>         ...
> >> >>        log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
> >> >>        ...
> >> >>    }
> >> >>
> >> >> }
> >> >>
> >> >>
> >> >> Note that the 'start' method (@Validate) do not have a bundle context
> >> >> parameter. If you want the bundle contex,t you can get it from the
> >> >> constructor (it's the only place we inject the bundle context so
> >>far):
> >> >>
> >> >> public MyClass(BundleContext bc) {
> >> >>  ...
> >> >> }
> >> >>
> >> >> Regards,
> >> >>
> >> >> Clement
> >> >>
> >> >> >
> >> >> >THe log level is INFO yes, but command log has a parameter to set
> >>the
> >> >> >level.
> >> >> >
> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >
> >> >> >>
> >> >> >>
> >> >> >> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com>
> >>wrote:
> >> >> >>
> >> >> >> >Thanks Clement,
> >> >> >> >
> >> >> >> >If I use log command in my felix shell , I effectively got the
> >> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
> >> >> >> >my bundle: no logs:
> >> >> >> >____________________
> >> >> >> >@Requires
> >> >> >> >LogService felixLogImpl; // This is the only impl I have in my
> >>shell
> >> >> >> >....
> >> >> >> >public void start(BundleContext ctxt){
> >> >> >> >...
> >> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
> >> >> >> >...
> >> >> >> >}
> >> >> >> >_________________________
> >> >> >> >
> >> >> >> >This logs nothing: when I do a 'log' command in shell no log
> >>DEBUG
> >> >> >>appears
> >> >> >> >!?
> >> >> >>
> >> >> >> First, I don't know which level is displayed by the log command
> >>(info
> >> >> >> maybe).
> >> >> >> Then, do you have an instance of your component:
> >> >> >>
> >> >> >> @Component
> >> >> >> @Instantiate
> >> >> >> Public class MyClass {
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> }
> >> >> >>
> >> >> >> Regards,
> >> >> >>
> >> >> >> Clement
> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> >Pierre
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >> >
> >> >> >> >> Hi,
> >> >> >> >>
> >> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com>
> >> >>wrote:
> >> >> >> >>
> >> >> >> >> >Hello,
> >> >> >> >> >
> >> >> >> >> >I have this code to inject  an instance of LogService in a
> >> >>bundle:
> >> >> >> >> >_______________________________
> >> >> >> >> >    @Requires
> >> >> >> >> >    private LogReaderService lrs;
> >> >> >> >> >    @Requires
> >> >> >> >> >    private LogService log;
> >> >> >> >> >________________________________
> >> >> >> >> >
> >> >> >> >> >But when I use log service - write and read in it - after
> >>adding
> >> >>a
> >> >> >> >> >LogListeneer, I get nothing on felix console .
> >> >> >> >>
> >> >> >> >> The LogService Implementation from Felix does not print the log
> >> >> >>message
> >> >> >> >>on
> >> >> >> >> the console.
> >> >> >> >> If you're using Gogo (provided in the latest Felix
> >>distribution),
> >> >>you
> >> >> >> >>have
> >> >> >> >> the 'log' command
> >> >> >> >> Giving the last logged entries.
> >> >> >> >>
> >> >> >> >> Regards,
> >> >> >> >>
> >> >> >> >> Clement
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >Have I missed something ?
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >Pierre
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >>---------------------------------------------------------------------
> >> >> >> >> 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
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> 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
> >>
> >>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: iPOJO log service

Posted by Clement Escoffier <cl...@gmail.com>.

On 21.12.10 11:33, "Pierre Henry Perret" <ph...@gmail.com> wrote:

>This is precisely what I want to know !
>
>I receive this event log from felix:
>__________________________
>2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent STARTED
>___________________
>
>I see the bundle 'Active' in the framework.
>But it is like if that @Ativate , in which I put the log directive, is not
>executed, because if it were, I'll see the log ?

Try first with a simple System.out.

Bundles and components have two different lifecycles. The bundle can be
resolved and activated (imports were resolved), and components can still
be invalid because of some missing services.

Moreover, try to deploy and check the validity of your component with the
arch / instance command
(http://felix.apache.org/site/ipojo-arch-command.html)

Regards,

Clement

>
>
>Pierre
>
>
>
>2010/12/21 Clement Escoffier <cl...@gmail.com>
>
>>
>>
>> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>>
>> >Yes, I do that.
>> >But even so, there is no log entry when I lauch the log command in
>>felix
>> >shell...
>>
>> Are you sure that your code is executed ?
>>
>> Clement
>>
>> >
>> >Pierre
>> >
>> >
>> >
>> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >
>> >>
>> >>
>> >> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>> >>
>> >> >Do you mean I should only use the log service in a declared
>>component ?
>> >> >
>> >> >The fact is that when I use annotations to inject the LogService
>>which
>> >>is
>> >> >an
>> >> >'org.apache.felix.log' instance from the same bundle name which I
>>put
>> >>in
>> >> >the
>> >> >'bundle' directory, the log service instiated because there is no
>>log
>> >> >errors
>> >> >....
>> >>
>> >> I don't really understand but you cannot use @Requires in a
>> >>non-component
>> >> class. Only components are injected.
>> >>
>> >> So you should have something like:
>> >>
>> >> @Component
>> >> @Instantiate
>> >> public class MyClass {
>> >>     @Requires
>> >>    private LogReaderService lrs;
>> >>    @Requires
>> >>    private LogService log;
>> >>
>> >>
>> >>     @Validate
>> >>    public void start(){
>> >>         ...
>> >>        log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
>> >>        ...
>> >>    }
>> >>
>> >> }
>> >>
>> >>
>> >> Note that the 'start' method (@Validate) do not have a bundle context
>> >> parameter. If you want the bundle contex,t you can get it from the
>> >> constructor (it's the only place we inject the bundle context so
>>far):
>> >>
>> >> public MyClass(BundleContext bc) {
>> >>  ...
>> >> }
>> >>
>> >> Regards,
>> >>
>> >> Clement
>> >>
>> >> >
>> >> >THe log level is INFO yes, but command log has a parameter to set
>>the
>> >> >level.
>> >> >
>> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >
>> >> >>
>> >> >>
>> >> >> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com>
>>wrote:
>> >> >>
>> >> >> >Thanks Clement,
>> >> >> >
>> >> >> >If I use log command in my felix shell , I effectively got the
>> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
>> >> >> >my bundle: no logs:
>> >> >> >____________________
>> >> >> >@Requires
>> >> >> >LogService felixLogImpl; // This is the only impl I have in my
>>shell
>> >> >> >....
>> >> >> >public void start(BundleContext ctxt){
>> >> >> >...
>> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
>> >> >> >...
>> >> >> >}
>> >> >> >_________________________
>> >> >> >
>> >> >> >This logs nothing: when I do a 'log' command in shell no log
>>DEBUG
>> >> >>appears
>> >> >> >!?
>> >> >>
>> >> >> First, I don't know which level is displayed by the log command
>>(info
>> >> >> maybe).
>> >> >> Then, do you have an instance of your component:
>> >> >>
>> >> >> @Component
>> >> >> @Instantiate
>> >> >> Public class MyClass {
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> }
>> >> >>
>> >> >> Regards,
>> >> >>
>> >> >> Clement
>> >> >>
>> >> >> >
>> >> >> >
>> >> >> >Pierre
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >> >
>> >> >> >> Hi,
>> >> >> >>
>> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com>
>> >>wrote:
>> >> >> >>
>> >> >> >> >Hello,
>> >> >> >> >
>> >> >> >> >I have this code to inject  an instance of LogService in a
>> >>bundle:
>> >> >> >> >_______________________________
>> >> >> >> >    @Requires
>> >> >> >> >    private LogReaderService lrs;
>> >> >> >> >    @Requires
>> >> >> >> >    private LogService log;
>> >> >> >> >________________________________
>> >> >> >> >
>> >> >> >> >But when I use log service - write and read in it - after
>>adding
>> >>a
>> >> >> >> >LogListeneer, I get nothing on felix console .
>> >> >> >>
>> >> >> >> The LogService Implementation from Felix does not print the log
>> >> >>message
>> >> >> >>on
>> >> >> >> the console.
>> >> >> >> If you're using Gogo (provided in the latest Felix
>>distribution),
>> >>you
>> >> >> >>have
>> >> >> >> the 'log' command
>> >> >> >> Giving the last logged entries.
>> >> >> >>
>> >> >> >> Regards,
>> >> >> >>
>> >> >> >> Clement
>> >> >> >>
>> >> >> >>
>> >> >> >> >
>> >> >> >> >Have I missed something ?
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >Pierre
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >>---------------------------------------------------------------------
>> >> >> >> 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
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>>



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


Re: iPOJO log service

Posted by Pierre Henry Perret <ph...@gmail.com>.
This is precisely what I want to know !

I receive this event log from felix:
__________________________
2010.12.21 11:29:24 INFO - Bundle: .OsgiLogTest - BundleEvent STARTED
___________________

I see the bundle 'Active' in the framework.
But it is like if that @Ativate , in which I put the log directive, is not
executed, because if it were, I'll see the log ?


Pierre



2010/12/21 Clement Escoffier <cl...@gmail.com>

>
>
> On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >Yes, I do that.
> >But even so, there is no log entry when I lauch the log command in felix
> >shell...
>
> Are you sure that your code is executed ?
>
> Clement
>
> >
> >Pierre
> >
> >
> >
> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >
> >>
> >>
> >> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >>
> >> >Do you mean I should only use the log service in a declared component ?
> >> >
> >> >The fact is that when I use annotations to inject the LogService which
> >>is
> >> >an
> >> >'org.apache.felix.log' instance from the same bundle name which I put
> >>in
> >> >the
> >> >'bundle' directory, the log service instiated because there is no log
> >> >errors
> >> >....
> >>
> >> I don't really understand but you cannot use @Requires in a
> >>non-component
> >> class. Only components are injected.
> >>
> >> So you should have something like:
> >>
> >> @Component
> >> @Instantiate
> >> public class MyClass {
> >>     @Requires
> >>    private LogReaderService lrs;
> >>    @Requires
> >>    private LogService log;
> >>
> >>
> >>     @Validate
> >>    public void start(){
> >>         ...
> >>        log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
> >>        ...
> >>    }
> >>
> >> }
> >>
> >>
> >> Note that the 'start' method (@Validate) do not have a bundle context
> >> parameter. If you want the bundle contex,t you can get it from the
> >> constructor (it's the only place we inject the bundle context so far):
> >>
> >> public MyClass(BundleContext bc) {
> >>  ...
> >> }
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >> >
> >> >THe log level is INFO yes, but command log has a parameter to set the
> >> >level.
> >> >
> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >
> >> >>
> >> >>
> >> >> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >> >>
> >> >> >Thanks Clement,
> >> >> >
> >> >> >If I use log command in my felix shell , I effectively got the
> >> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
> >> >> >my bundle: no logs:
> >> >> >____________________
> >> >> >@Requires
> >> >> >LogService felixLogImpl; // This is the only impl I have in my shell
> >> >> >....
> >> >> >public void start(BundleContext ctxt){
> >> >> >...
> >> >> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
> >> >> >...
> >> >> >}
> >> >> >_________________________
> >> >> >
> >> >> >This logs nothing: when I do a 'log' command in shell no log DEBUG
> >> >>appears
> >> >> >!?
> >> >>
> >> >> First, I don't know which level is displayed by the log command (info
> >> >> maybe).
> >> >> Then, do you have an instance of your component:
> >> >>
> >> >> @Component
> >> >> @Instantiate
> >> >> Public class MyClass {
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> }
> >> >>
> >> >> Regards,
> >> >>
> >> >> Clement
> >> >>
> >> >> >
> >> >> >
> >> >> >Pierre
> >> >> >
> >> >> >
> >> >> >
> >> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >> >
> >> >> >> Hi,
> >> >> >>
> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com>
> >>wrote:
> >> >> >>
> >> >> >> >Hello,
> >> >> >> >
> >> >> >> >I have this code to inject  an instance of LogService in a
> >>bundle:
> >> >> >> >_______________________________
> >> >> >> >    @Requires
> >> >> >> >    private LogReaderService lrs;
> >> >> >> >    @Requires
> >> >> >> >    private LogService log;
> >> >> >> >________________________________
> >> >> >> >
> >> >> >> >But when I use log service - write and read in it - after adding
> >>a
> >> >> >> >LogListeneer, I get nothing on felix console .
> >> >> >>
> >> >> >> The LogService Implementation from Felix does not print the log
> >> >>message
> >> >> >>on
> >> >> >> the console.
> >> >> >> If you're using Gogo (provided in the latest Felix distribution),
> >>you
> >> >> >>have
> >> >> >> the 'log' command
> >> >> >> Giving the last logged entries.
> >> >> >>
> >> >> >> Regards,
> >> >> >>
> >> >> >> Clement
> >> >> >>
> >> >> >>
> >> >> >> >
> >> >> >> >Have I missed something ?
> >> >> >> >
> >> >> >> >
> >> >> >> >Pierre
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >>---------------------------------------------------------------------
> >> >> >> 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
> >> >>
> >> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>

Re: iPOJO log service

Posted by Clement Escoffier <cl...@gmail.com>.

On 21.12.10 11:08, "Pierre Henry Perret" <ph...@gmail.com> wrote:

>Yes, I do that.
>But even so, there is no log entry when I lauch the log command in felix
>shell...

Are you sure that your code is executed ?

Clement

>
>Pierre
>
>
>
>2010/12/20 Clement Escoffier <cl...@gmail.com>
>
>>
>>
>> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>>
>> >Do you mean I should only use the log service in a declared component ?
>> >
>> >The fact is that when I use annotations to inject the LogService which
>>is
>> >an
>> >'org.apache.felix.log' instance from the same bundle name which I put
>>in
>> >the
>> >'bundle' directory, the log service instiated because there is no log
>> >errors
>> >....
>>
>> I don't really understand but you cannot use @Requires in a
>>non-component
>> class. Only components are injected.
>>
>> So you should have something like:
>>
>> @Component
>> @Instantiate
>> public class MyClass {
>>     @Requires
>>    private LogReaderService lrs;
>>    @Requires
>>    private LogService log;
>>
>>
>>     @Validate
>>    public void start(){
>>         ...
>>        log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
>>        ...
>>    }
>>
>> }
>>
>>
>> Note that the 'start' method (@Validate) do not have a bundle context
>> parameter. If you want the bundle contex,t you can get it from the
>> constructor (it's the only place we inject the bundle context so far):
>>
>> public MyClass(BundleContext bc) {
>>  ...
>> }
>>
>> Regards,
>>
>> Clement
>>
>> >
>> >THe log level is INFO yes, but command log has a parameter to set the
>> >level.
>> >
>> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >
>> >>
>> >>
>> >> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>> >>
>> >> >Thanks Clement,
>> >> >
>> >> >If I use log command in my felix shell , I effectively got the
>> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
>> >> >my bundle: no logs:
>> >> >____________________
>> >> >@Requires
>> >> >LogService felixLogImpl; // This is the only impl I have in my shell
>> >> >....
>> >> >public void start(BundleContext ctxt){
>> >> >...
>> >> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
>> >> >...
>> >> >}
>> >> >_________________________
>> >> >
>> >> >This logs nothing: when I do a 'log' command in shell no log DEBUG
>> >>appears
>> >> >!?
>> >>
>> >> First, I don't know which level is displayed by the log command (info
>> >> maybe).
>> >> Then, do you have an instance of your component:
>> >>
>> >> @Component
>> >> @Instantiate
>> >> Public class MyClass {
>> >>
>> >>
>> >>
>> >>
>> >> }
>> >>
>> >> Regards,
>> >>
>> >> Clement
>> >>
>> >> >
>> >> >
>> >> >Pierre
>> >> >
>> >> >
>> >> >
>> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >> >
>> >> >> Hi,
>> >> >>
>> >> >> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com>
>>wrote:
>> >> >>
>> >> >> >Hello,
>> >> >> >
>> >> >> >I have this code to inject  an instance of LogService in a
>>bundle:
>> >> >> >_______________________________
>> >> >> >    @Requires
>> >> >> >    private LogReaderService lrs;
>> >> >> >    @Requires
>> >> >> >    private LogService log;
>> >> >> >________________________________
>> >> >> >
>> >> >> >But when I use log service - write and read in it - after adding
>>a
>> >> >> >LogListeneer, I get nothing on felix console .
>> >> >>
>> >> >> The LogService Implementation from Felix does not print the log
>> >>message
>> >> >>on
>> >> >> the console.
>> >> >> If you're using Gogo (provided in the latest Felix distribution),
>>you
>> >> >>have
>> >> >> the 'log' command
>> >> >> Giving the last logged entries.
>> >> >>
>> >> >> Regards,
>> >> >>
>> >> >> Clement
>> >> >>
>> >> >>
>> >> >> >
>> >> >> >Have I missed something ?
>> >> >> >
>> >> >> >
>> >> >> >Pierre
>> >> >>
>> >> >>
>> >> >>
>> >> >> 
>>---------------------------------------------------------------------
>> >> >> 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
>> >>
>> >>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: iPOJO log service

Posted by Pierre Henry Perret <ph...@gmail.com>.
Yes, I do that.
But even so, there is no log entry when I lauch the log command in felix
shell...

Pierre



2010/12/20 Clement Escoffier <cl...@gmail.com>

>
>
> On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >Do you mean I should only use the log service in a declared component ?
> >
> >The fact is that when I use annotations to inject the LogService which is
> >an
> >'org.apache.felix.log' instance from the same bundle name which I put in
> >the
> >'bundle' directory, the log service instiated because there is no log
> >errors
> >....
>
> I don't really understand but you cannot use @Requires in a non-component
> class. Only components are injected.
>
> So you should have something like:
>
> @Component
> @Instantiate
> public class MyClass {
>     @Requires
>    private LogReaderService lrs;
>    @Requires
>    private LogService log;
>
>
>     @Validate
>    public void start(){
>         ...
>        log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
>        ...
>    }
>
> }
>
>
> Note that the 'start' method (@Validate) do not have a bundle context
> parameter. If you want the bundle contex,t you can get it from the
> constructor (it's the only place we inject the bundle context so far):
>
> public MyClass(BundleContext bc) {
>  ...
> }
>
> Regards,
>
> Clement
>
> >
> >THe log level is INFO yes, but command log has a parameter to set the
> >level.
> >
> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >
> >>
> >>
> >> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >>
> >> >Thanks Clement,
> >> >
> >> >If I use log command in my felix shell , I effectively got the
> >> >'ServiceEvent' and 'BundleEvent' but not my logs in
> >> >my bundle: no logs:
> >> >____________________
> >> >@Requires
> >> >LogService felixLogImpl; // This is the only impl I have in my shell
> >> >....
> >> >public void start(BundleContext ctxt){
> >> >...
> >> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
> >> >...
> >> >}
> >> >_________________________
> >> >
> >> >This logs nothing: when I do a 'log' command in shell no log DEBUG
> >>appears
> >> >!?
> >>
> >> First, I don't know which level is displayed by the log command (info
> >> maybe).
> >> Then, do you have an instance of your component:
> >>
> >> @Component
> >> @Instantiate
> >> Public class MyClass {
> >>
> >>
> >>
> >>
> >> }
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >> >
> >> >
> >> >Pierre
> >> >
> >> >
> >> >
> >> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >> >
> >> >> Hi,
> >> >>
> >> >> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >> >>
> >> >> >Hello,
> >> >> >
> >> >> >I have this code to inject  an instance of LogService in a bundle:
> >> >> >_______________________________
> >> >> >    @Requires
> >> >> >    private LogReaderService lrs;
> >> >> >    @Requires
> >> >> >    private LogService log;
> >> >> >________________________________
> >> >> >
> >> >> >But when I use log service - write and read in it - after adding a
> >> >> >LogListeneer, I get nothing on felix console .
> >> >>
> >> >> The LogService Implementation from Felix does not print the log
> >>message
> >> >>on
> >> >> the console.
> >> >> If you're using Gogo (provided in the latest Felix distribution), you
> >> >>have
> >> >> the 'log' command
> >> >> Giving the last logged entries.
> >> >>
> >> >> Regards,
> >> >>
> >> >> Clement
> >> >>
> >> >>
> >> >> >
> >> >> >Have I missed something ?
> >> >> >
> >> >> >
> >> >> >Pierre
> >> >>
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> 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
> >>
> >>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: iPOJO log service

Posted by Clement Escoffier <cl...@gmail.com>.

On 20.12.10 16:12, "Pierre Henry Perret" <ph...@gmail.com> wrote:

>Do you mean I should only use the log service in a declared component ?
>
>The fact is that when I use annotations to inject the LogService which is
>an
>'org.apache.felix.log' instance from the same bundle name which I put in
>the
>'bundle' directory, the log service instiated because there is no log
>errors
>....

I don't really understand but you cannot use @Requires in a non-component
class. Only components are injected.

So you should have something like:

@Component
@Instantiate
public class MyClass {
    @Requires
    private LogReaderService lrs;
    @Requires
    private LogService log;

    
    @Validate
    public void start(){
        ...
        log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
        ...
    }

}


Note that the 'start' method (@Validate) do not have a bundle context
parameter. If you want the bundle contex,t you can get it from the
constructor (it's the only place we inject the bundle context so far):

public MyClass(BundleContext bc) {
  ...
}

Regards,

Clement

>
>THe log level is INFO yes, but command log has a parameter to set the
>level.
>
>2010/12/20 Clement Escoffier <cl...@gmail.com>
>
>>
>>
>> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>>
>> >Thanks Clement,
>> >
>> >If I use log command in my felix shell , I effectively got the
>> >'ServiceEvent' and 'BundleEvent' but not my logs in
>> >my bundle: no logs:
>> >____________________
>> >@Requires
>> >LogService felixLogImpl; // This is the only impl I have in my shell
>> >....
>> >public void start(BundleContext ctxt){
>> >...
>> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
>> >...
>> >}
>> >_________________________
>> >
>> >This logs nothing: when I do a 'log' command in shell no log DEBUG
>>appears
>> >!?
>>
>> First, I don't know which level is displayed by the log command (info
>> maybe).
>> Then, do you have an instance of your component:
>>
>> @Component
>> @Instantiate
>> Public class MyClass {
>>
>>
>>
>>
>> }
>>
>> Regards,
>>
>> Clement
>>
>> >
>> >
>> >Pierre
>> >
>> >
>> >
>> >2010/12/20 Clement Escoffier <cl...@gmail.com>
>> >
>> >> Hi,
>> >>
>> >> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>> >>
>> >> >Hello,
>> >> >
>> >> >I have this code to inject  an instance of LogService in a bundle:
>> >> >_______________________________
>> >> >    @Requires
>> >> >    private LogReaderService lrs;
>> >> >    @Requires
>> >> >    private LogService log;
>> >> >________________________________
>> >> >
>> >> >But when I use log service - write and read in it - after adding a
>> >> >LogListeneer, I get nothing on felix console .
>> >>
>> >> The LogService Implementation from Felix does not print the log
>>message
>> >>on
>> >> the console.
>> >> If you're using Gogo (provided in the latest Felix distribution), you
>> >>have
>> >> the 'log' command
>> >> Giving the last logged entries.
>> >>
>> >> Regards,
>> >>
>> >> Clement
>> >>
>> >>
>> >> >
>> >> >Have I missed something ?
>> >> >
>> >> >
>> >> >Pierre
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>>



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


Re: iPOJO log service

Posted by Pierre Henry Perret <ph...@gmail.com>.
Do you mean I should only use the log service in a declared component ?

The fact is that when I use annotations to inject the LogService which is an
'org.apache.felix.log' instance from the same bundle name which I put in the
'bundle' directory, the log service instiated because there is no log errors
....

THe log level is INFO yes, but command log has a parameter to set the level.

2010/12/20 Clement Escoffier <cl...@gmail.com>

>
>
> On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >Thanks Clement,
> >
> >If I use log command in my felix shell , I effectively got the
> >'ServiceEvent' and 'BundleEvent' but not my logs in
> >my bundle: no logs:
> >____________________
> >@Requires
> >LogService felixLogImpl; // This is the only impl I have in my shell
> >....
> >public void start(BundleContext ctxt){
> >...
> >  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
> >...
> >}
> >_________________________
> >
> >This logs nothing: when I do a 'log' command in shell no log DEBUG appears
> >!?
>
> First, I don't know which level is displayed by the log command (info
> maybe).
> Then, do you have an instance of your component:
>
> @Component
> @Instantiate
> Public class MyClass {
>
>
>
>
> }
>
> Regards,
>
> Clement
>
> >
> >
> >Pierre
> >
> >
> >
> >2010/12/20 Clement Escoffier <cl...@gmail.com>
> >
> >> Hi,
> >>
> >> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com> wrote:
> >>
> >> >Hello,
> >> >
> >> >I have this code to inject  an instance of LogService in a bundle:
> >> >_______________________________
> >> >    @Requires
> >> >    private LogReaderService lrs;
> >> >    @Requires
> >> >    private LogService log;
> >> >________________________________
> >> >
> >> >But when I use log service - write and read in it - after adding a
> >> >LogListeneer, I get nothing on felix console .
> >>
> >> The LogService Implementation from Felix does not print the log message
> >>on
> >> the console.
> >> If you're using Gogo (provided in the latest Felix distribution), you
> >>have
> >> the 'log' command
> >> Giving the last logged entries.
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >>
> >> >
> >> >Have I missed something ?
> >> >
> >> >
> >> >Pierre
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>

Re: iPOJO log service

Posted by Clement Escoffier <cl...@gmail.com>.

On 20.12.10 14:21, "Pierre Henry Perret" <ph...@gmail.com> wrote:

>Thanks Clement,
>
>If I use log command in my felix shell , I effectively got the
>'ServiceEvent' and 'BundleEvent' but not my logs in
>my bundle: no logs:
>____________________
>@Requires
>LogService felixLogImpl; // This is the only impl I have in my shell
>....
>public void start(BundleContext ctxt){
>...
>  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
>...
>}
>_________________________
>
>This logs nothing: when I do a 'log' command in shell no log DEBUG appears
>!?

First, I don't know which level is displayed by the log command (info
maybe).
Then, do you have an instance of your component:

@Component
@Instantiate
Public class MyClass {




}

Regards,

Clement

>
>
>Pierre
>
>
>
>2010/12/20 Clement Escoffier <cl...@gmail.com>
>
>> Hi,
>>
>> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>>
>> >Hello,
>> >
>> >I have this code to inject  an instance of LogService in a bundle:
>> >_______________________________
>> >    @Requires
>> >    private LogReaderService lrs;
>> >    @Requires
>> >    private LogService log;
>> >________________________________
>> >
>> >But when I use log service - write and read in it - after adding a
>> >LogListeneer, I get nothing on felix console .
>>
>> The LogService Implementation from Felix does not print the log message
>>on
>> the console.
>> If you're using Gogo (provided in the latest Felix distribution), you
>>have
>> the 'log' command
>> Giving the last logged entries.
>>
>> Regards,
>>
>> Clement
>>
>>
>> >
>> >Have I missed something ?
>> >
>> >
>> >Pierre
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: iPOJO log service

Posted by Pierre Henry Perret <ph...@gmail.com>.
Thanks Clement,

If I use log command in my felix shell , I effectively got the
'ServiceEvent' and 'BundleEvent' but not my logs in
my bundle: no logs:
____________________
@Requires
LogService felixLogImpl; // This is the only impl I have in my shell
....
public void start(BundleContext ctxt){
...
  log.log(LogService.LOG_DEBUG, "my bundle is starting...!" );
...
}
_________________________

This logs nothing: when I do a 'log' command in shell no log DEBUG appears
!?


Pierre



2010/12/20 Clement Escoffier <cl...@gmail.com>

> Hi,
>
> On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >Hello,
> >
> >I have this code to inject  an instance of LogService in a bundle:
> >_______________________________
> >    @Requires
> >    private LogReaderService lrs;
> >    @Requires
> >    private LogService log;
> >________________________________
> >
> >But when I use log service - write and read in it - after adding a
> >LogListeneer, I get nothing on felix console .
>
> The LogService Implementation from Felix does not print the log message on
> the console.
> If you're using Gogo (provided in the latest Felix distribution), you have
> the 'log' command
> Giving the last logged entries.
>
> Regards,
>
> Clement
>
>
> >
> >Have I missed something ?
> >
> >
> >Pierre
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: iPOJO log service

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

On 20.12.10 12:50, "Pierre Henry Perret" <ph...@gmail.com> wrote:

>Hello,
>
>I have this code to inject  an instance of LogService in a bundle:
>_______________________________
>    @Requires
>    private LogReaderService lrs;
>    @Requires
>    private LogService log;
>________________________________
>
>But when I use log service - write and read in it - after adding a
>LogListeneer, I get nothing on felix console .

The LogService Implementation from Felix does not print the log message on
the console.
If you're using Gogo (provided in the latest Felix distribution), you have
the 'log' command
Giving the last logged entries.

Regards,

Clement


>
>Have I missed something ?
>
>
>Pierre



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