4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Kotlinのログ出力方法

Last updated at Posted at 2019-01-09

以下のおまじない(2行)を入れて、logger.info("ログ出力")で出力。

import org.slf4j.LoggerFactory
private val logger = LoggerFactory.getLogger(javaClass)

  • 例:
import org.slf4j.LoggerFactory

@Component
class YourClass {
    private val logger = LoggerFactory.getLogger(javaClass)
    public fun yourFunction(): Any? {
        logger.info("ログ出力")
        return null
    }
}
  • 出力結果:
2019-01-09 11:31:14.400  INFO 21313 --- [xxx] xxx.YourClass : ログ出力
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?