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

Remove System.out calls in PreComputeFieldFeature #30571

Closed
bclozel opened this issue Jun 1, 2023 · 6 comments
Closed

Remove System.out calls in PreComputeFieldFeature #30571

bclozel opened this issue Jun 1, 2023 · 6 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Jun 1, 2023

While logging information at the System.out level in the PreComputeFieldFeature was a conscious choice until oracle/graal#4669 was implemented, it seems that the information displayed is very verbose:

 - org.springframework.aot.nativex.feature.PreComputeFieldFeature
Field org.apache.commons.logging.LogAdapter#log4jSpiPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#log4jSlf4jProviderPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#slf4jSpiPresent set to true at build time
Field org.apache.commons.logging.LogAdapter#slf4jApiPresent set to true at build time
Field org.springframework.core.NativeDetector#imageCode set to true at build time
Field org.springframework.core.KotlinDetector#kotlinPresent set to false at build time
Field org.springframework.core.KotlinDetector#kotlinReflectPresent set to false at build time
Field org.springframework.format.support.DefaultFormattingConversionService#jsr354Present set to false at build time
Field org.springframework.cglib.core.AbstractClassGenerator#imageCode set to true at build time
Field org.springframework.boot.logging.log4j2.Log4J2LoggingSystem$Factory#PRESENT set to false at build time
Field org.springframework.web.reactive.config.WebFluxConfigurationSupport#jakartaValidatorPresent set to false at build time
Field org.springframework.http.converter.json.Jackson2ObjectMapperBuilder#jackson2XmlPresent set to false at build time
Field org.springframework.data.util.NullableWrapperConverters#GUAVA_PRESENT set to false at build time
Field org.springframework.data.util.NullableWrapperConverters#SCALA_PRESENT set to false at build time
Field org.springframework.data.util.NullableWrapperConverters#VAVR_PRESENT set to false at build time
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
Field org.springframework.core.ReactiveAdapterRegistry#reactorPresent set to true at build time
Field org.springframework.core.ReactiveAdapterRegistry#rxjava3Present set to false at build time
Field org.springframework.core.ReactiveAdapterRegistry#kotlinCoroutinesPresent set to false at build time
Field org.springframework.core.ReactiveAdapterRegistry#mutinyPresent set to false at build time
Field org.springframework.data.repository.util.QueryExecutionConverters#VAVR_PRESENT set to false at build time
Field org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer#springDataPresent set to true at build time
Field org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer#springSecurityPresent set to false at build time
Field org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer#beanValidationPresent set to false at build time
Field org.springframework.boot.logging.logback.LogbackLoggingSystem$Factory#PRESENT set to true at build time
Field org.springframework.boot.logging.java.JavaLoggingSystem$Factory#PRESENT set to true at build time
Field org.springframework.data.convert.JMoleculesConverters#JMOLECULES_PRESENT set to false at build time
Field org.springframework.data.util.ReactiveWrappers#PROJECT_REACTOR_PRESENT set to true at build time
Field org.springframework.data.util.ReactiveWrappers#RXJAVA3_PRESENT set to false at build time
Field org.springframework.data.util.ReactiveWrappers#KOTLIN_COROUTINES_PRESENT set to false at build time
Field org.springframework.data.util.ReactiveWrappers#MUTINY_PRESENT set to false at build time
Field org.springframework.data.repository.util.ReactiveWrapperConverters#RXJAVA3_PRESENT set to false at build time
Field org.springframework.data.repository.util.ReactiveWrapperConverters#REACTOR_PRESENT set to true at build time
Field org.springframework.data.repository.util.ReactiveWrapperConverters#KOTLIN_COROUTNES_PRESENT set to false at build time
Field org.springframework.data.repository.util.ReactiveWrapperConverters#MUTINY_PRESENT set to false at build time
Field org.springframework.web.context.support.StandardServletEnvironment#jndiPresent set to true at build time
Field org.springframework.boot.logging.logback.LogbackLoggingSystemProperties#JBOSS_LOGGING_PRESENT set to false at build time
Field org.springframework.context.event.ApplicationListenerMethodAdapter#reactiveStreamsPresent set to true at build time
Field org.springframework.data.querydsl.QuerydslUtils#QUERY_DSL_PRESENT set to false at build time
Field org.springframework.web.reactive.socket.server.support.HandshakeWebSocketService#tomcatWsPresent set to false at build time
Field org.springframework.web.reactive.socket.server.support.HandshakeWebSocketService#jettyWsPresent set to false at build time
Field org.springframework.web.reactive.socket.server.support.HandshakeWebSocketService#undertowWsPresent set to false at build time
Field org.springframework.web.reactive.socket.server.support.HandshakeWebSocketService#reactorNettyPresent set to true at build time
Field org.springframework.web.reactive.socket.server.support.HandshakeWebSocketService#reactorNetty2Present set to false at build time
Field org.springframework.web.reactive.function.client.DefaultWebClientBuilder#reactorNettyClientPresent set to true at build time
Field org.springframework.web.reactive.function.client.DefaultWebClientBuilder#reactorNetty2ClientPresent set to false at build time
Field org.springframework.web.reactive.function.client.DefaultWebClientBuilder#jettyClientPresent set to false at build time
Field org.springframework.web.reactive.function.client.DefaultWebClientBuilder#httpComponentsClientPresent set to false at build time
Field org.springframework.data.repository.core.support.ReactiveRepositoryFactorySupport$RxJavaOneConversionSetup#REACTIVE_STREAMS_PRESENT set to true at build time
Field org.springframework.graphql.data.query.JsonKeysetCursorStrategy#jackson2Present set to true at build time
Field org.springframework.boot.autoconfigure.web.format.WebConversionService#JSR_354_PRESENT set to false at build time
Field reactor.netty.internal.util.Metrics#isMicrometerAvailable set to true at build time
Field reactor.netty.internal.util.Metrics#isTracingAvailable set to true at build time
Field reactor.netty.resources.DefaultLoopIOUring#isIoUringAvailable set to false at build time
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
Field reactor.netty.resources.DefaultLoopEpoll#isEpollAvailable set to false at build time
Field reactor.netty.resources.DefaultLoopKQueue#isKqueueAvailable set to false at build time
Field org.springframework.graphql.data.method.annotation.support.BatchLoaderHandlerMethod#springSecurityPresent set to false at build time
Field org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvoker#IS_REACTOR_PRESENT set to true at build time
Field org.springframework.boot.actuate.endpoint.web.annotation.DiscoveredWebOperation#REACTIVE_STREAMS_PRESENT set to true at build time
Field org.springframework.boot.actuate.endpoint.invoke.reflect.OperationMethodParameter#jsr305Present set to false at build time
Field org.springframework.web.reactive.socket.WebSocketMessage#reactorNetty2Present set to false at build time
Field reactor.netty.http.server.HAProxyMessageReader#isProxyProtocolAvailable set to false at build time
Field org.springframework.web.client.RestTemplate#romePresent set to false at build time
Field org.springframework.web.client.RestTemplate#jaxb2Present set to false at build time
Field org.springframework.web.client.RestTemplate#jackson2Present set to true at build time
Field org.springframework.web.client.RestTemplate#jackson2XmlPresent set to false at build time
Field org.springframework.web.client.RestTemplate#jackson2SmilePresent set to false at build time
Field org.springframework.web.client.RestTemplate#jackson2CborPresent set to false at build time
Field org.springframework.web.client.RestTemplate#gsonPresent set to false at build time
Field org.springframework.web.client.RestTemplate#jsonbPresent set to false at build time
Field org.springframework.web.client.RestTemplate#kotlinSerializationCborPresent set to false at build time
Field org.springframework.web.client.RestTemplate#kotlinSerializationJsonPresent set to false at build time
Field org.springframework.web.client.RestTemplate#kotlinSerializationProtobufPresent set to false at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#jackson2Present set to true at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#jackson2SmilePresent set to false at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#jaxb2Present set to false at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#protobufPresent set to false at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#synchronossMultipartPresent set to false at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#nettyByteBufPresent set to true at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#netty5BufferPresent set to false at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#kotlinSerializationCborPresent set to false at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#kotlinSerializationJsonPresent set to false at build time
Field org.springframework.http.codec.support.BaseDefaultCodecs#kotlinSerializationProtobufPresent set to false at build time
Field org.springframework.graphql.execution.SecurityContextThreadLocalAccessor#springSecurityPresent set to false at build time

Unless we find a way to activate those logs with a debug flag, we should probably silence this as it doesn't provide much value to users and hasn't been helpful in the past for investigating on issues.

@bclozel bclozel added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels Jun 1, 2023
@bclozel bclozel added this to the 6.1.0-M1 milestone Jun 1, 2023
@bclozel bclozel self-assigned this Jun 1, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented Jun 1, 2023

I agree those logs introduce too much noise. Since without that we have no way to know the fields initialized at build time, and it has be proven useful in a few recent issues, maybe we can silent that by default, and enable such logging based on a system property? Also should we do this change only as of 6.1.x or 6.0.x?

@snicoll
Copy link
Member

snicoll commented Jun 1, 2023

This looks like a change that we can make in M1. This gives the community a chance to provide feedback on whatever mechanism we put in place to add the logging back.

@sdeleuze sdeleuze assigned sdeleuze and unassigned bclozel Jun 13, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented Jun 14, 2023

Logging has been removed by default and can be restored by passing -Dspring.aot.precompute=verbose as a native-image compiler build argument to display detailed logs about pre-computed fields.

@snicoll
Copy link
Member

snicoll commented Jun 14, 2023

Isn't that a bit odd to call that spring.aot when it has actually nothing to do with that phase? This is a native-image callback isn't it?

@sdeleuze
Copy link
Contributor

Yes this is a Spring-related native-image compiler callback. But we also have structured the packages to have native inside AOT (org.springframework.aot.nativex package which is the package of PreComputeFieldFeature impacted here) and conceptually that kind of make sense (we provide native support as part of our wider AOT arrangement). We already have some system properties prefixed by spring.aot, I was not sure it was better to introduce a new one like spring.native.precompute and it sounds a bit too Spring Native in my hears. spring.aot.native.precompute looked a bit long, and there is the native versus nativex question, so I chose to use spring.aot.precompute.

If you want to propose a better option, please let me know.

@sdeleuze
Copy link
Contributor

sdeleuze commented Jun 14, 2023

As discussed, let's use -Dspring.native.precompute.log=verbose then.

sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Jun 14, 2023
This commit changes the Java system property used to
control PreComputeFieldFeature verbose logging from
spring.aot.precompute to spring.native.precompute.log
in order to clarify its purpose and avoid confusion
with AOT processing of JVM bytecode or Java sources.

See spring-projectsgh-30571
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants