spring - Springboot sending logs to fluentd not working -
i need following problem.
i have spring boot
application , configure fluentd
appender using logback
.
i've created file called logback.xml
in src/main/resources
following content:
<?xml version="1.0" encoding="utf-8"?> <configuration debug="true"> <appender name="stdout" class="ch.qos.logback.core.consoleappender"> <encoder> <pattern>%date - %level - [%thread] - %logger - [%file:%line] - %msg%n</pattern> </encoder> </appender> <appender name="fluent_text" class="ch.qos.logback.more.appenders.datafluentappender"> <tag>dab</tag> <label>normal</label> <remotehost>localhost</remotehost> <port>24224</port> <maxqueuesize>20</maxqueuesize> </appender> <logger name="org.com" level="debug"/> <root level="debug"> <appender-ref ref="stdout" /> <appender-ref ref="fluent_text" /> </root> </configuration>
in build.gradle
have :
compile 'org.fluentd:fluent-logger:0.3.1' compile 'com.sndyuk:logback-more-appenders:1.1.0'
when launch app using gradle bootrun have following message:
10:56:33,020 |-warn in ch.qos.logback.core.consoleappender[stdout] - attempted append non started appender [stdout]. 10:56:33,020 |-warn in ch.qos.logback.more.appenders.datafluentappender[fluent_text] - attempted append non started appender [fluent_text]. 10:56:33,028 |-warn in ch.qos.logback.core.consoleappender[stdout] - attempted append non started appender [stdout]. exception in thread "main" 10:56:33,028 |-warn in ch.qos.logback.more.appenders.datafluentappender[fluent_text] - attempted append non started appender [fluent_text]. java.lang.nullpointerexception @ ch.qos.logback.more.appenders.datafluentappender$fluentdaemonappender.close(datafluentappender.java:72)
i've found here https://github.com/spring-projects/spring-boot/blob/master/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc saying logback.xml loaded need use file called logback-spring.xml
.
i've did , it's file never loaded, no error nothing gets fluetd socket.
any idea how solve ?
thanks. c.c.
when running springboot application, load 'spring' profile.
one way of doing via command line, see below.
-dspring.profiles.active=spring
Comments
Post a Comment