The bundles that you *need* are pax-logging-api.jar and 
pax-logging-service.jar. And depending on which logging api you use, 
you'll have to include the pax-logging-(logger-type).jar for it. E.g If 
you use commons-logging api, you'll include pax-logging-jcl.jar or if 
you're using log4j api, you'll include pax-logging-log4j.jar instead.

As an alternative, you can use the org.osgi.service.log.LogService 
interface, and you would only need the first 2 jar files mentioned.

AFAIK, to configure your logging output, you'll need to use 
ConfigurationAdmin to find a ManagedService with the SERVICE_PID of 
org.ops4j.pax.logging to set the logging output following the Log4j's 
properties key and value.

E.g
properties.put( "log4j.logger.com.acme", "TRACE, A1" );
properties.put( "log4j.appender.A1", "org.apache.log4j.FileAppender" );
properties.put( "log4j.appender.A1.File", "com.acme.log" );
properties.put( "log4j.appender.A1.layout", 
"org.apache.log4j.PatternLayout" );
properties.put( "log4j.appender.A1.layout.ConversionPattern", "%d %-5p 
[%t] %C{2} (%F:%L) - %m%n" );

And pass that properties into the Configuration.update() method.

Hope this helps.

Makas

Pierre Parrend wrote:
>  okay, fine, it compiles now. Does it not exist a Howto that tells how to
> quickly make the pax logger available on a OSGi platform ? currently it seems
> that the only way is to try and look what are the missing dependencies ...
>
> pierre
>
> Quoting Makas Tzavellas <[EMAIL PROTECTED]>:
>
>   
>> The testcase is now fixed. LoggingServiceFactory no longer implements 
>> the ManagedServiceFactory, hence the compile error.
>>
>> Pierre Parrend wrote:
>>     
>>>  Hello,
>>>
>>>  I'm planning to use PAX for logging on OSGi. unfortunately, it seems the
>>> compile stage have some bugs in the
>>> org.ops4j.pax.logging.internal.LoggingServiceFactory class, namely (at mvn
>>> install; code checked out from subversion this morning 13.11.06):
>>>
>>> - lacks the public fields LOG4J_LOGGER_NAME, LOG4J_CONFIG_FILE
>>> - lacks the constructor LoggingServiceFactory( ConfigFactory,
>>> PaxLoggingService)
>>> - lacks the method method updated( String, Hashtable<String, String>)
>>>
>>> Is there a clean LoggingServiceFactory lying somewhere ?
>>> you will find the error output just below,
>>>
>>> best regards,
>>>
>>> Pierre
>>>
>>> -----
>>>
>>>       
> /home/pierre/downloads/logging/ops4j/pax/logging/service/src/test/java/org/ops4j/pax/logging/test/Log4jServiceFactoryTestCase.java:[56,45]
>   
>>> cannot find symbol
>>> symbol  : variable LOG4J_LOGGER_NAME
>>> location: class org.ops4j.pax.logging.internal.LoggingServiceFactory
>>>
>>>
>>>       
> /home/pierre/downloads/logging/ops4j/pax/logging/service/src/test/java/org/ops4j/pax/logging/test/Log4jServiceFactoryTestCase.java:[57,45]
>   
>>> cannot find symbol
>>> symbol  : variable LOG4J_CONFIG_FILE
>>> location: class org.ops4j.pax.logging.internal.LoggingServiceFactory
>>>
>>>
>>>       
> /home/pierre/downloads/logging/ops4j/pax/logging/service/src/test/java/org/ops4j/pax/logging/test/Log4jServiceFactoryTestCase.java:[63,40]
>   
>>> cannot find symbol
>>> symbol  : constructor
>>>
>>>       
> LoggingServiceFactory(org.ops4j.pax.logging.internal.ConfigFactory,org.ops4j.pax.logging.PaxLoggingService)
>   
>>> location: class org.ops4j.pax.logging.internal.LoggingServiceFactory
>>>
>>>
>>>       
> /home/pierre/downloads/logging/ops4j/pax/logging/service/src/test/java/org/ops4j/pax/logging/test/Log4jServiceFactoryTestCase.java:[107,15]
>   
>>> cannot find symbol
>>> symbol  : method
>>>
>>>       
> updated(java.lang.String,java.util.Hashtable<java.lang.String,java.lang.String>)
>   
>>> location: class org.ops4j.pax.logging.internal.LoggingServiceFactory
>>>
>>> ----------
>>>
>>>   
>>>       
>> _______________________________________________
>> general mailing list
>> [email protected]
>> http://lists.ops4j.org/mailman/listinfo/general
>>
>>     
>
>
>   


_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to