Spring boot sleuth no traces in zipkin - spring-boot

we are trying to use sleuth to send logs to zipkin. We are using spring boot '2.2.6.RELEASE' and cloud version Hoxton.RELEASE. I have added below dependencies
implementation "org.springframework.cloud:spring-cloud-starter-zipkin:2.2.6.RELEASE"
implementation "org.springframework.cloud:spring-cloud-starter-sleuth:2.2.6.RELEASE"
implementation "org.springframework.cloud:spring-cloud-sleuth-zipkin:2.2.6.RELEASE"
And added below props in logback.xml
[%X{traceId} %X{spanId} %X{X-Span-Export}]
With the above changes in our 2 services, we were expecting zipkin will have some logs, but nothing appeared. So then we tried to add below properties in application.properties
spring.zipkin.base-url=http://localhost:9411
spring.zipkin.enabled=true
spring.zipkin.service.name=xyz-service
spring.sleuth.enabled=true
spring.sleuth.integration.enabled=true
spring.sleuth.sampler.rate=100
spring.sleuth.sampler.probability=1.0
spring.zipkin.sender.type=web
And still dont see logs / service name in zipkin.
Can you see what am I doing wrong here. Out apps have cloud-stream dependencies as well. And also noted that in logs I am getting X-span-export coming as false. For ex: [3e205e41db60212f 77a405a53d62c9fa false]

Please upgrade the project to the latest version of Spring Boot and Spring Cloud. Also use the BOM as the source of versions - do not set them manually. Please do not set the default properties manually cause as defaults they are already set.

Related

Spring cloud config server not honoring logging.file property and not logging external file

I'm using spring-boot-starter 2.3.3.RELEASE version. I'm running my spring cloud configuration server in native profile (looking for configuration files in file system). I added
logging.file = /var/log/config.log in application.properties file. But my application is not logging logs to this file.(All other microservices are logging to this location). Am I missing any additional settings for Spring cloud config server? Thank you so much for your help.
In the spring boot 2.3.3 RELEASE documentation the logging properties that specify where the location should be is indicated using the property:
logging.file.path={path}
The documentation:
https://docs.spring.io/spring-boot/docs/2.3.3.RELEASE/reference/htmlsingle/#boot-features-logging-file-output
This modification from logging.path to logging.file.path appears as a deprecation in Spring Boot 2.2:
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes#deprecations-in-spring-boot-22
One way to do it with spring-boot application is, setting it from command line argument as default it will dump every thing on console.
logging.file=logs/test.log
Old school but far effective, save path in application.properties
logging.file=logs/test.log

How to configure Spring Cloud Sleuth in Spring Boot microservices

Can someone please help me? I want to integrate Spring Sleuth with my Spring Boot microservices. I added spring-cloud-starter-sleuth dependency. Also tried by added SLF4J along with it. But it is print normal logs. Not printing in Sleuth style like app name, span id ,traceid etc. I am not sure if it is recognizing dependency? Do I need to add any other dependency? Any properties file?
Could you please guide with exact dependency? and exact steps to configure?
In terms of logging, we support slf4j out of the box. You have to implement your own SpanLogger interface to add the logging support for log4j

Spring Boot -1.5.3.Release Version - Enabled with Security Features?

I use Spring Boot - 1.5.3.Release Version for my project. Simply tested my demo application with Actuator and Dev-tools plugin from spring boot initializer site. (Hence I no longer needed to share my POM, as it is default).When I launch my application and try to hit the metrics End Point URL, I get this 401 Unauthorized status (image given below).
Following Options Tried to Bypass this exception
I excluded the SecurityAutoConfiguration on my main Class.
#SpringBootApplication
#EnableAutoConfiguration(exclude= {org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class})
public class MainConfig {
But the above option didn't work.
When I downgrade my Spring-Boot - 1.4.6.RELEASE Version, I didn't get the UnAuthorized Exception. My Application worked like a charm :-)
Questions
Is there any Specific Security Enhancements have been made in the latest release of Spring-Boot (1.5.3.RELEASE Version)?
If at all any enhancements made, let know the community on how to bypass such kind of exceptions?
I also, noticed that when using Spring-boot (1.5.3.RELEASE) it doesn't show any exceptions on startup, even though I have multiple main program in my IDE build path. Is that also an enhancement is spring-boot (1.5.3.RELEASE) version?
Kindly clarify.
From the Spring Boot 1.5 Release Notes:
If you’re upgrading a Spring Boot 1.4 application that doesn’t have dependency on Spring Security and you wish to retain open access to your sensitive endpoints you’ll need to set management.security.enabled to false.

Default Spring Boot log4j2 log pattern

Spring boot ships with several default logging framework configurations including Log4j2. While there is detailed documentation about logging in the Spring boot reference manual it does not mention how and where exactly the default log pattern is configured, which makes it difficult to override this.
The question is where does Spring Boot configure the default log pattern of for Log4j2?
So far I have looked in the following places of Spring Boot:
AutoConfigurationReportLoggingInitializer
LoggingApplicationListener
SimpleFormatter
LoggingSystem
Log4J2LoggingSystem
It seems the Log4J2 configuration is not done in any Java class so I was looking at the wrong place. Spring Boot ships with two files log4j2.xml and log4j2-file.xml which contain the default configuration and can be found in org.springframework.boot.logging.log4j2.

No log messages after Spring Boot upgrade

I have recently upgraded spring boot from 1.1.10 to 1.2.0. I did not specify version information for spring boot dependencies like spring mvc. So they also got upgraded.
After upgrade, I am not able to see any log information from spring.
I am able to see the sysout and syserr information of my code though.
Did any thing change in the latest relese ?
As per the changelog Spring Boot 1.2.0 changelog Spring Boot's default behavior is to not write any log files.
Sorry folks, I have a log4j.properties in my class path. That configuration file prevented entries from springframework packages. Not sure how it ended up there though. Probably 1.1.10 is not picking it up. Things might have changed with 1.2.0. Hence the problem. Once I deleted that file, every thing is working fine
Thank you for your time

Resources