slf4j-api의 더미 StaticLoggerBinder 학술

커스텀 slf4j logger를 붙여보려고 좀 뜯어보는 중인데..
원래 API 사용할 때는 slf4j-api 모듈의 LoggerFactory를 써서 Logger를 얻어내도록 되어있고..
LoggerFactory에서는 org.slf4j.impl.StaticLoggerBinder를 참조하고 있는데..

원래 StaticLoggerBinder는 slf4j 연동 모듈별로 구현되도록 된 것이고 여기서 각 Logger 구현을 던져야 되는데.. 이게 slf4j-api 모듈 안에 StaticLoggerBinder가 구현되어 있더라..

그래서 뭔가 이상한데 하면서 소스를 보니까.. 주석에 분명히 dummy라고는 써있고 -_- 여기도 정의되어 있고 연동 모듈에도 StaticLoggerBinder가 구현되어 있으면 이게 어떻게 돌아간다는건가.. 고민을 하다가 -_-.. 구글질을 다시 하다보니..

Revision 726 - (view) (download) (as text) (annotate) - [select for diffs]
Added Fri Feb 16 18:27:16 2007 UTC (2 years, 2 months ago) by seb
File length: 2441 byte(s)

Added the LoggerFactory class to the api module.
A dummy StaticLoggerBinder class has also been added so that everything compiles nicely.
The slf4j-api pom.xml file now uses an ant task to remove the dummy StaticLoggerBinder from the compiled classes so that each other module uses its own StaticLoggerBinder class.

slf4j-api를 빌드할 때 딴게 없으면 컴파일이 제대로 안 되니까 넣은 모양이다..
ant task로 dummy를 제거한다니 좀 -_-;;

아래와 같이 되어있었다.

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
      <execution>
        <phase>process-classes</phase>
        <goals>
         <goal>run</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <tasks>
        <echo>Removing slf4j-api's dummy StaticLoggerBinder and StaticMarkerBinder</echo>
        <delete dir="target/classes/org/slf4j/impl"/>
      </tasks>
    </configuration>
  </plugin>

골 때리는구만 ㅋㅋㅋㅋ

트랙백

이 글과 관련된 글 쓰기 (트랙백 보내기)
TrackbackURL : http://www.xeraph.com/tb/4921293 [도움말]

덧글

댓글 입력 영역