Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
174 views
in Technique[技术] by (71.8m points)

java - Remove SQL logs hibernate (SqlStatementLogger)

I'm trying to remove all sql logs from my project but It seems that does not work. I've tried to use the code bellow on my properties but the logs keep showing up.

spring.jpa.properties.hibernate.show_sql=false
logging.level.org.hibernate.SQL=TRACE

I also tried to debug my project and I see that the logs are from class SqlStatementLogger

@AllowSysOut
    public void logStatement(String statement, Formatter formatter) {
        if ( format ) {
            if ( logToStdout || LOG.isDebugEnabled() ) {
                statement = formatter.format( statement );
            }
        }
        LOG.debug( statement );
        if ( logToStdout ) {
            System.out.println( "Hibernate: " + statement );
        }
    }

And this class I can′t edit... There′s some way to remove that line "LOG.debug( statement );" ? Or another way that don′t show up the sql logs?

question from:https://stackoverflow.com/questions/65937847/remove-sql-logs-hibernate-sqlstatementlogger

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...