On 21.12.10 11:33, "Pierre Henry Perret" <[email protected]> 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 <[email protected]>
>
>>
>>
>> On 21.12.10 11:08, "Pierre Henry Perret" <[email protected]> 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 <[email protected]>
>> >
>> >>
>> >>
>> >> On 20.12.10 16:12, "Pierre Henry Perret" <[email protected]> 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 <[email protected]>
>> >> >
>> >> >>
>> >> >>
>> >> >> On 20.12.10 14:21, "Pierre Henry Perret" <[email protected]>
>>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 <[email protected]>
>> >> >> >
>> >> >> >> Hi,
>> >> >> >>
>> >> >> >> On 20.12.10 12:50, "Pierre Henry Perret" <[email protected]>
>> >>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: [email protected]
>> >> >> >> For additional commands, e-mail: [email protected]
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> 
>>---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: [email protected]
>> >> >> For additional commands, e-mail: [email protected]
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [email protected]
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to