Skip to content

Commit

Permalink
Logging logback appender : Class loader fix for custom enhancers
Browse files Browse the repository at this point in the history
Replacing system classloader with ch.qos.logback.core.util.Loader#loadClas for custom enhancers. (googleapis#2130)
Fix googleapis#2123
  • Loading branch information
jabubake authored Jun 8, 2017
1 parent 0c89651 commit d43a540
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.UnsynchronizedAppenderBase;
import ch.qos.logback.core.util.Loader;
import com.google.cloud.MonitoredResource;
import com.google.cloud.logging.LogEntry;
import com.google.cloud.logging.Logging;
Expand Down Expand Up @@ -143,7 +144,7 @@ private LoggingEnhancer getEnhancer(String enhancerClassName) {
try {
Class<? extends LoggingEnhancer> clz =
(Class<? extends LoggingEnhancer>)
ClassLoader.getSystemClassLoader().loadClass(enhancerClassName.trim());
Loader.loadClass(enhancerClassName.trim());
return clz.newInstance();
} catch (Exception ex) {
// If we cannot create the enhancer we fallback to null
Expand Down

0 comments on commit d43a540

Please sign in to comment.