eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
369 stars 137 forks source link

Move some info logged by the WebApp CL as INFO to DEBUG/FINE level to reduce noise #24944

Closed OndroMih closed 1 month ago

OndroMih commented 1 month ago

With this, the following is logged in INFO during app deployment:

[#|2024-05-05T05:23:24.750875+02:00|INFO|GF 7.0.15-SNAPSHOT|org.glassfish.web.loader.WebappClassLoader|_ThreadID=300;_ThreadName=RunLevelControllerThread-1714879404711;_LevelValue=800;|
  close(), WebappClassLoader classloader for application: myapp|#]

The following is not logged as INFO anymore, rather as DEBUG/FINE. As INFO is the default log level, it's a noise in logs which is mostly for troubleshooting and it's better to have it in DEBUG level, only if requested:

[2024-05-05T05:10:08.836483+02:00] [GF 7.0.15-SNAPSHOT] [FINE] [] [org.glassfish.web.loader.WebappClassLoader] [tid: _ThreadID=64 _ThreadName=admin-listener(4)] [levelValue: 500] [[
  close(), this:
org.glassfish.web.loader.WebappClassLoader@44694e1c[name=unknown], urls=[
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/classes/
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/byte-buddy-1.12.18.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jakarta.activation-api-2.1.0.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/lombok-1.18.28.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/antlr4-runtime-4.10.1.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jboss-logging-3.5.0.Final.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jaxb-runtime-4.0.2.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jakarta.transaction-api-2.0.1.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/commons-logging-1.2.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/txw2-4.0.2.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/classmate-1.5.1.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/hibernate-core-6.2.6.Final.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jaxb-core-4.0.2.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/commons-dbcp2-2.9.0.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/h2-2.1.214.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jakarta.inject-api-2.0.1.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jakarta.xml.bind-api-4.0.0.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/angus-activation-2.0.0.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/hibernate-commons-annotations-6.0.6.Final.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jakarta.persistence-api-3.1.0.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/istack-commons-runtime-4.1.1.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/commons-pool2-2.10.0.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/applications/myapp/WEB-INF/lib/jandex-3.0.5.jar
file:/glassfish/appserver/distributions/glassfish/target/stage/glassfish7/glassfish/domains/domain1/generated/ejb/myapp/
][webAppName=myapp, delegate=true, context=unknown, status=RUNNING, antiJARLocking=false, securityManager=false, packageDefinitionSecurityEnabled=false, repositories=RepositoryManager[WEB-INF/classes/], notFound.size=2, pathTimestamps.size=24, resourceEntryCache.size=5]]]
OndroMih commented 1 month ago

I'll close this PR. I see there's no consensus and this change is not important enough to seek for an agreement. I'm OK with logging the full classpath, although I still think it's more a debugging info and it's a noise in normal usage.

dmatej commented 1 month ago

At least you forced me to thing about some future state. @avpinchuk now works on more serious issues with reliable closing applibs (which was never considered on GF and causes IOExceptions on Windows), then I will try to analyze how to move the app name/context name out of the classloader and use the app name as the classloader name instead; and it should be ALWAYS set, so no "unknown" value should be set any more.

And the classpath or cl.toString should be written to logs on startup, not on close. That is still an issue, because of the "lifecycle" which I had to add to force the CL to keep at least some rules. Now we are still expanding the "zone of reliability", so finally it should converge to something more simple.