I am trying to programmatically configure logstash with logback in my Spring boot project to configure it using the environment.
To do this, I use a simple @Configuration bean (simplified code, then I will set the host / port using the environment):
@Component @Slf4j public class LogstashConfiguration { private LogstashTcpSocketAppender logstashTcpSocketAppender; @PostConstruct public void init() { Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); LoggerContext loggerContext = rootLogger.getLoggerContext();
I see that TcpSocketAppender is logging on my logstash server, but I never get the TEST log. But I see "TEST" in my console.
Also when setting up the logger mentioned in https://github.com/logstash/logstash-logback-encoder#tcp , it also works.
Do you have any suggestion to do this job?
Thanks,
Fabris
source share