Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect caller details logged with Flogger in spring boot #360

Open
charu-jain89 opened this issue Sep 5, 2023 · 2 comments
Open

Incorrect caller details logged with Flogger in spring boot #360

charu-jain89 opened this issue Sep 5, 2023 · 2 comments
Labels

Comments

@charu-jain89
Copy link

charu-jain89 commented Sep 5, 2023

I am using Flogger API to log details in my spring boot controller, I am using below dependency for logging:

                <dependency>
			<groupId>com.google.flogger</groupId>
			<artifactId>flogger-slf4j-backend</artifactId>
			<version>0.7.4</version>
		</dependency>

I need to log caller details like class name, method name and line number. so, I have been using this log pattern in logback.xml file.

Class:%class{36} Method:%method Line:%line

With Fluent API:

log.atInfo().log(">>>>>>>>>>>>>>Test>>>>>>>>>>>>>>>>");

It logs:

"Class1":"c.g.c.f.b.slf4j.Slf4jLoggerBackend","Method1":"log","Line1":"176"

So, its logging internal details. Not the current Controller class or method name, which is DemoController and test method here.

However, It logs properly with @slf4j or with log.info and log.debug etc

Can anyone pls suggest how to log correct caller details with Flogger API.

Also raised: https://stackoverflow.com/questions/77042586/what-is-the-log-pattern-to-log-caller-details-with-flogger-in-spring-boot

@eamonnmcmanus
Copy link
Member

This is probably better asked on Stack Overflow.

@charu-jain89
Copy link
Author

@eamonnmcmanus Is there a solution to this. Because I am not able to log caller details with @flogger However same log pattern(Class:%class{36} Method:%method Line:%line) works correctly with @slf4j.
I havn't got any reference of this online also.
Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants