Hi Clement,
I'm not sure, if I understood you right. Do you mean, I should create a
central method for logging for each bundle? Maybe a static one like
BundleXYLogger.log(...) ?
Clement Escoffier schrieb:
> Hi,
>
> Something recommended is to create a log method to get the logger. I
> also recommend you to set the dependency optional (enabling the nullable
> object support). In that case, if the logger is not there, you can still
> call the log but nothing will happen:
>
>
> @Component
> public class MyApp {
>
>
> @Requires(optional=true)
> private LogService log;
>
> public log(int level, String mes) { // Don't need to be synchronize
> log.(level, mes);
> }
>
> ...
>
> }
>
> Regards,
>
> Clement
>
>
> On 10.10.2009, at 16:56, Henrik Niehaus wrote:
>
>> Hi *,
>>
>> another question concerning iPOJO. I'm wondering how to use the osgi
>> logging service with iPOJO. Let's assume I want to use the logger like
>> this:
>>
>> @Component
>> public class LoggerTest {
>>
>> @Requires
>> private LogService log;
>>
>> @Validate
>> public void validate() {
>> log.log(LogService.LOG_INFO, "Alles klar. Der Logger is da");
>> }
>>
>> @Invalidate
>> public void invalidate() {
>> System.err.println("Verflixt, der logger is weg");
>> }
>> }
>>
>> Then I would need to convert every class, in which I want to use a
>> logger, to be a component. That would result in a lot of components.
>> That doesn't seem to be correct to me. Is there a best practice for
>> logging and iPOJO?
>>
>> Cheers
>> Henrik
>>
>> ---------------------------------------------------------------------
>> 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]
>
--
Mein öffentlicher PGP Schlüssel und Fingerabdruck:
http://hampelratte.org/pgp/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]