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

2019/05/springboot-How-to-print-JPA-and-jdbcTemplate-SQL-logs #18

Open
utterances-bot opened this issue Dec 28, 2021 · 1 comment
Open

Comments

@utterances-bot
Copy link

springboot-How to print JPA and jdbcTemplate SQL logs in SpringBoot apps?

  1. The purpose of this post This demo show how to print SQL logs of your dao when using springboot apps.

https://www.bswen.com/2019/05/springboot-How-to-print-JPA-and-jdbcTemplate-SQL-logs.html

Copy link

do this without any xml or yml config , but only pure java code ,like below:

import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;

Logger logger = (Logger) LoggerFactory.getLogger("org.springframework.jdbc.core.JdbcTemplate");
logger.setLevel(Level.valueOf("DEBUG"));

// or , for more details,you can retrieve another logger  like this 
// Logger logger2 = (Logger) LoggerFactory.getLogger("org.springframework.jdbc");
//logger2.setLevel(Level.valueOf("DEBUG"));

enjoy it, guys

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

No branches or pull requests

2 participants