Skip to content

Instantly share code, notes, and snippets.

@itnotes
Last active August 24, 2016 10:39
Show Gist options
  • Select an option

  • Save itnotes/bc208cae4cf43c4c297c08cfc8936400 to your computer and use it in GitHub Desktop.

Select an option

Save itnotes/bc208cae4cf43c4c297c08cfc8936400 to your computer and use it in GitHub Desktop.
sprink-kottler-01
package io.github.itnotes.controllers
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping
@Controller
class HelloController {
@RequestMapping("/hello")
fun hello(): ResponseEntity<String> {
logger.debug("HelloController#hello executed")
return ResponseEntity<String>("Hello", HttpStatus.OK)
}
companion object {
val logger: Logger = LoggerFactory.getLogger(HelloController::class.java)
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36}[%L] - %msg%n"/>
</Console>
<RollingFile name="Full" fileName="logs/app.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<pattern>%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36}[%L] - %msg%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="5 MB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
<AppenderRef ref="Full"/>
</Root>
<Logger name="io.github.itnotes" additivity="false" level="debug">
<AppenderRef ref="Console"/>
<AppenderRef ref="Full"/>
</Logger>
</Loggers>
</Configuration>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment