# tinylog 모듈 사용해보기

pom.xml

```xml
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>
```

```xml
<properties>
    <tinylog.version>2.4.1</tinylog.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.tinylog</groupId>
        <artifactId>tinylog-api</artifactId>
        <version>${tinylog.version}</version>
    </dependency>
    <dependency>
        <groupId>org.tinylog</groupId>
        <artifactId>tinylog-impl</artifactId>
        <version>${tinylog.version}</version>
    </dependency>
    <dependency>
        <groupId>org.tinylog</groupId>
        <artifactId>slf4j-tinylog</artifactId>
        <version>${tinylog.version}</version>
    </dependency>
    <dependency>
        <groupId>org.tinylog</groupId>
        <artifactId>jcl-tinylog</artifactId>
        <version>${tinylog.version}</version>
    </dependency>
    <dependency>
        <groupId>org.tinylog</groupId>
        <artifactId>log4j1.2-api</artifactId>
        <version>${tinylog.version}</version>
    </dependency>

</dependencies>
```

테스트 코드

```java
@Slf4j
@SpringBootApplication
public class LogDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(LogDemoApplication.class, args);

        log.error("Hello World");
        log.warn("Hello World");
        log.info("Hello World");
        log.debug("Hello World");
        log.trace("Hello World");
    }

}
```

구동 로그확인

<figure><img src="https://3202568828-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVNjdXkr3ciD8p5jXPCI%2Fuploads%2FaQk4UTn8CQhlYkIIcHvs%2Fimage.png?alt=media&#x26;token=9e30caee-6885-46a4-964f-1016c6739ce8" alt=""><figcaption></figcaption></figure>

TinylogLogger 가 적용된것을 확인 할수 있다.

<figure><img src="https://3202568828-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVNjdXkr3ciD8p5jXPCI%2Fuploads%2FLNE7scnWrffzmA5lKIKC%2Fimage.png?alt=media&#x26;token=6e72c661-aebc-4245-b0f3-69a131bd2c33" alt=""><figcaption></figcaption></figure>

**resources 폴더 안에 tinylog.properties  파일 생성**

```properties
writer=console
writer.format={date: HH:mm:ss.SSS} {level}: {message}
```

Log 출력 상태

<figure><img src="https://3202568828-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgVNjdXkr3ciD8p5jXPCI%2Fuploads%2FtYcERQdxW6B5XyfVOcqt%2Fimage.png?alt=media&#x26;token=d5ff2645-c7b5-48e0-b8e3-967c85baf226" alt=""><figcaption></figcaption></figure>
