Skip to content

Instantly share code, notes, and snippets.

@kryger
kryger / LogbackConfig.java
Last active Sep 15, 2016
Programmatic SentryAppender + profile-dependent LogstashEncoder in logback-spring.xml
View LogbackConfig.java
@Configuration
public class LogbackConfig {
@Value("${dsn.etc}")
private String dsn;
@Bean(initMethod = "start", destroyMethod = "stop")
public SentryAppender sentryAppender(){
LoggerContext ctx = (LoggerContext) LoggerFactory.getILoggerFactory();
SentryAppender sentryAppender = new SentryAppender();
sentryAppender.setDsn(dsn);
View gist:cd539c29cee983d18f62
package demo.app;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class SomeController {
@RequestMapping("/test")