improve the aesthetics of some quite ugly log messages
This commit is contained in:
parent
bf580b9e72
commit
ac83f3e62f
|
@ -48,7 +48,12 @@ public class JtaPlatformInitiator implements StandardServiceInitiator<JtaPlatfor
|
|||
platform = getFallbackProvider( configurationValues, registry );
|
||||
}
|
||||
|
||||
LOG.usingJtaPlatform( platform != null ? platform.getClass().getName() : "null" );
|
||||
if ( platform != null && !(platform instanceof NoJtaPlatform) ) {
|
||||
LOG.usingJtaPlatform( platform.getClass().getName() );
|
||||
}
|
||||
else {
|
||||
LOG.noJtaPlatform();
|
||||
}
|
||||
return platform;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@Message(value = "On release of batch it still contained JDBC statements", id = 10)
|
||||
void batchContainedStatementsOnRelease();
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@LogMessage(level = DEBUG)
|
||||
@Message(value = "Bytecode provider: %s", id = 21)
|
||||
void bytecodeProvider(String provider);
|
||||
|
||||
|
@ -91,7 +91,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
void c3p0ProviderClassNotFound(String c3p0ProviderClassName);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "I/O reported cached file could not be found : %s : %s", id = 23)
|
||||
@Message(value = "I/O reported cached file could not be found: [%s]: %s", id = 23)
|
||||
void cachedFileNotFound(String path, FileNotFoundException error);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
|
@ -563,7 +563,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
// void parameterPositionOccurredAsBothJpaAndHibernatePositionalParameter(Integer position);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "Error parsing XML (%s) : %s", id = 196)
|
||||
@Message(value = "Error parsing XML: (%s) %s", id = 196)
|
||||
void parsingXmlError(
|
||||
int lineNumber,
|
||||
String message);
|
||||
|
@ -576,7 +576,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
String message);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "Warning parsing XML (%s) : %s", id = 198)
|
||||
@Message(value = "Warning parsing XML: (%s) %s", id = 198)
|
||||
void parsingXmlWarning(
|
||||
int lineNumber,
|
||||
String message);
|
||||
|
@ -615,11 +615,11 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
void propertiesLoaded(Properties maskOut);
|
||||
|
||||
@LogMessage(level = DEBUG)
|
||||
@Message(value = "hibernate.properties not found", id = 206)
|
||||
@Message(value = "'hibernate.properties' not found", id = 206)
|
||||
void propertiesNotFound();
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Property %s not found in class but described in <mapping-file/> (possible typo error)", id = 207)
|
||||
@Message(value = "Property '%s' not found in class but described in <mapping-file/> (possible typo error)", id = 207)
|
||||
void propertyNotFound(String property);
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
|
@ -994,7 +994,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
void unableToCreateSchema(@Cause Exception e);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Could not deserialize cache file: %s : %s", id = 307)
|
||||
@Message(value = "Could not deserialize cache file [%s]: %s", id = 307)
|
||||
void unableToDeserializeCache(
|
||||
String path,
|
||||
SerializationException error);
|
||||
|
@ -1674,7 +1674,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
void logCannotLocateIndexColumnInformation(String columnIdentifierText, String indexIdentifierText);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Executing script '%s'", id = 476)
|
||||
@Message(value = "Executing script [%s]", id = 476)
|
||||
void executingScript(String scriptName);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
|
@ -1749,7 +1749,11 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
String bytecodeEnhancementFailedUnableToGetPrivateLookupFor(String className);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Using JtaPlatform implementation: [%s]", id = 490)
|
||||
@Message(value = "No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)", id = 489)
|
||||
void noJtaPlatform();
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Using JTA platform [%s]", id = 490)
|
||||
void usingJtaPlatform(String jtaPlatformClassName);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
|
|
|
@ -66,8 +66,10 @@ public class GenerationTargetToDatabase implements GenerationTarget {
|
|||
|
||||
@Override
|
||||
public void beforeScript(ScriptSourceInput scriptSource) {
|
||||
if ( scriptSource.exists() ) {
|
||||
log.executingScript( scriptSource.getScriptDescription() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(String command) {
|
||||
|
|
|
@ -45,6 +45,7 @@ public class ScriptSourceInputAggregate implements ScriptSourceInput {
|
|||
int size = 0;
|
||||
for ( int i = 0; i < inputs.length; i++ ) {
|
||||
final AbstractScriptSourceInput scriptSourceInput = inputs[i];
|
||||
if ( scriptSourceInput.exists() ) {
|
||||
final Reader reader = scriptSourceInput.prepareReader();
|
||||
try {
|
||||
log.executingScript( scriptSourceInput.getScriptDescription() );
|
||||
|
@ -55,6 +56,7 @@ public class ScriptSourceInputAggregate implements ScriptSourceInput {
|
|||
scriptSourceInput.releaseReader( reader );
|
||||
}
|
||||
}
|
||||
}
|
||||
final List<String> list = new ArrayList<>( size );
|
||||
for ( List<String> strings : lists ) {
|
||||
list.addAll( strings );
|
||||
|
|
|
@ -49,4 +49,9 @@ public class ScriptSourceInputNonExistentImpl extends AbstractScriptSourceInput
|
|||
public List<String> extract(Function<Reader, List<String>> extractor) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,4 +32,8 @@ public interface ScriptSourceInput {
|
|||
return false;
|
||||
}
|
||||
|
||||
default boolean exists() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.Test;
|
|||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Vlad Mihalcea
|
||||
|
@ -47,10 +47,7 @@ public class JtaPlatformLoggingTest extends BaseNonConfigCoreFunctionalTestCase
|
|||
|
||||
@Test
|
||||
public void test() {
|
||||
assertEquals(
|
||||
"HHH000490: Using JtaPlatform implementation: [org.hibernate.testing.jta.TestingJtaPlatformImpl]",
|
||||
triggerable.triggerMessage()
|
||||
);
|
||||
assertTrue( triggerable.triggerMessage().startsWith("HHH000490: Using JTA platform"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue