remove hibernate.dialect.show_hql_functions and just make it a log category

really unclear why I didn't do it that way in the first place
This commit is contained in:
Gavin King 2022-01-06 14:39:32 +01:00
parent 0b96d8fca7
commit c96f22dfe0
4 changed files with 12 additions and 15 deletions

View File

@ -1075,6 +1075,12 @@ Registering a function isn't hard, but is beyond the scope of this chapter.
Fortunately, every built-in `Dialect` already registers many native functions for the database it supports.
[TIP]
====
Try setting the log category `org.hibernate.HQL_FUNCTIONS` to debug.
Then at startup Hibernate will log a list of type signatures of all registered functions.
====
[[hql-var-function-example]]
====
[source, JAVA, indent=0]

View File

@ -777,13 +777,6 @@ public interface AvailableSettings {
*/
String USE_SQL_COMMENTS ="hibernate.use_sql_comments";
/**
* Enable logging of functions registered by the
* {@linkplain AvailableSettings#DIALECT configured}
* SQL {@link org.hibernate.dialect.Dialect}.
*/
String SHOW_HQL_FUNCTIONS = "hibernate.dialect.show_hql_functions";
/**
* Maximum depth of outer join fetching
*/

View File

@ -56,7 +56,7 @@ import org.jboss.logging.Logger;
*/
@Incubating
public class QueryEngine {
private static final Logger LOG_HQL_FUNCTIONS = CoreLogging.logger( "org.hibernate.LOG_HQL_FUNCTIONS" );
private static final Logger LOG_HQL_FUNCTIONS = CoreLogging.logger( "org.hibernate.HQL_FUNCTIONS" );
public static QueryEngine from(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata) {
final QueryEngineOptions queryEngineOptions = sessionFactory.getSessionFactoryOptions();
@ -175,14 +175,9 @@ public class QueryEngine {
contributor.contributeFunctions( functionContributions );
}
final boolean showSQLFunctions = ConfigurationHelper.getBoolean(
AvailableSettings.SHOW_HQL_FUNCTIONS,
serviceRegistry.getService( ConfigurationService.class ).getSettings(),
false
);
if ( showSQLFunctions && LOG_HQL_FUNCTIONS.isInfoEnabled() ) {
if ( LOG_HQL_FUNCTIONS.isDebugEnabled() ) {
sqmFunctionRegistry.getFunctionsByName().forEach(
entry -> LOG_HQL_FUNCTIONS.info( entry.getValue().getSignature( entry.getKey() ) )
entry -> LOG_HQL_FUNCTIONS.debug( entry.getValue().getSignature( entry.getKey() ) )
);
}
}

View File

@ -128,7 +128,10 @@ logger.cache.level=trace
logger.stat.name=org.hibernate.stat
logger.stat.level=trace
###############################################################################
## Log a list of functions registered by the Dialect
org.hibernate.HQL_FUNCTIONS=info
###############################################################################
## Hibernate's JUnit extensions (hibernate-testing)