Skip to content

Commit

Permalink
changing trace from debug too much noise
Browse files Browse the repository at this point in the history
  • Loading branch information
lmajano committed May 20, 2024
1 parent f9abcf9 commit acaac8f
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,18 @@ public Class<?> findClass( String className, Boolean safe ) throws ClassNotFound
safe = false;
}

logger.debug( "[{}] Discovering class: [{}]", this.nameAsKey.getName(), className );
logger.trace( "[{}] Discovering class: [{}]", this.nameAsKey.getName(), className );

// 1. Check the loaded cache first and return if found
Class<?> cachedClass = this.loadedClasses.get( className );
if ( cachedClass != null ) {
logger.debug( "[{}].[{}] : Class found in cache", this.nameAsKey.getName(), className );
logger.trace( "[{}].[{}] : Class found in cache", this.nameAsKey.getName(), className );
return cachedClass;
}

// 2. Check the unfound cache, and if already there, return just null or throw an exception depending on the safe flag
if ( this.unfoundClasses.containsKey( className ) ) {
logger.debug( "[{}].[{}] : Class not found in cache, but already in unfound cache", this.nameAsKey.getName(), className );
logger.trace( "[{}].[{}] : Class not found in cache, but already in unfound cache", this.nameAsKey.getName(), className );
if ( safe ) {
return null;
}
Expand All @@ -157,22 +157,22 @@ public Class<?> findClass( String className, Boolean safe ) throws ClassNotFound
// 3. Attempt to load from JARs/classes in the seeded URLs
try {
cachedClass = super.findClass( className );
logger.debug( "[{}].[{}] : Class found locally", this.nameAsKey.getName(), className );
logger.trace( "[{}].[{}] : Class found locally", this.nameAsKey.getName(), className );
} catch ( ClassNotFoundException e ) {

// 3. If not found in JARs, delegate to parent class loader
try {
logger.debug( "[{}].[{}] : Class not found locally, trying the parent...", this.nameAsKey.getName(), className );
logger.trace( "[{}].[{}] : Class not found locally, trying the parent...", this.nameAsKey.getName(), className );
cachedClass = getDynamicParent().loadClass( className );
logger.debug( "[{}].[{}] : Class found in parent", this.nameAsKey.getName(), className );
logger.trace( "[{}].[{}] : Class found in parent", this.nameAsKey.getName(), className );
} catch ( ClassNotFoundException parentException ) {
// Add to the unfound cache
this.unfoundClasses.put( className, NullValue.class );
// If not safe, throw the exception
if ( !safe ) {
throw new ClassNotFoundException( String.format( "Class [%s] not found in class loader [%s]", className, this.nameAsKey.getName() ) );
}
logger.debug( "[{}].[{}] : Class not found in parent", this.nameAsKey.getName(), className );
logger.trace( "[{}].[{}] : Class not found in parent", this.nameAsKey.getName(), className );
}

}
Expand Down

0 comments on commit acaac8f

Please sign in to comment.