[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901518#action_12901518
 ] 

Olaf Krische commented on ZOOKEEPER-850:
----------------------------------------

Hello,

if you still use the log4j logger at runtime, then it should have no impact on 
the logging output, since those definitions in log4j.properties for log4j 
remain valid.

1) 

Add "slf4j-api-1.5.10.jar", its the API for slf4j

2) 

For $clazz, replace:

  final static org.apache.log4j.Logger = 
org.apache.log4j.Logger.getLogger($clazz);

with

  final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger($clazz);

This must compile, then zookeeper is independend from log4j.

3) 

For runtime, e.g. testing, decide which logger to use. For log4j, you would 
just add:

- slf4j-log4j12-1.5.10.jar, the adapter from slf4j to log4j
- log4j-1.2.15.jar for log4j, which should already be defined in ant

This would be all. 

(patchset is not so easy as i thought, since zookeeper use its very own file 
structure, i dont even get 3.3.1 with a normal ant compile to work) :P


> Switch from log4j to slf4j
> --------------------------
>
>                 Key: ZOOKEEPER-850
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-850
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: java client
>            Reporter: Olaf Krische
>
> Hello,
> i would like to see slf4j integrated into the zookeeper instead of relying 
> explicitly on log4j.
> slf4j is an abstract logging framework. There are adapters from slf4j to many 
> logger implementations, one of them is log4j.
> The decision which log engine to use i dont like to make so early.
> This would help me to embed zookeeper in my own applications (which use a 
> different logger implemenation, but slf4j is the basis)
> What do you think?
> (as i can see, those slf4j request flood all other projects on apache as well 
> :-)
> Maybe for 3.4 or 4.0?
> I can offer a patchset, i have experience in such an migration already. :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to