Hi Andy
Here is part of the LoggerFactory class :
public class CustomLoggerFactory {
public static final String LOG4J_VAR_EMITTER_NAME = "emitterName";
public static final String LOG4J_VAR_EMITTER_TYPE = "emitterType";
public static final String LOG4J_VAR_EMITTER_VERSION = "emitterVersion";
public static final String LOG4J_VAR_Custom_SERVICE = "emitterCodeService";
public static final String LOG4J_CONF_HOST_NAME = "hostName";
public static final String LOG4J_VAR_CUSTOM_MAPPING_VERSION = "customMappingVersion";
public static final String LOG4J_VAR_COMMON_MAPPING_VERSION = "commonMappingVersion";
public static final String LOG4J_VAR_CONTEXT_CLASS = "contextClass";
private static final ThreadLocal<CustomLoggerContext> Custom_LOGGER_CONTEXT_THREAD_LOCAL = new ThreadLocal<CustomLoggerContext>() {
protected CustomLoggerContext initialValue() {
return new CustomLoggerContext();
}
};
(...)
private CustomLoggerFactory() {
}
private static void initProperties() {
LoggerContext context = (LoggerContext)LogManager.getContext(Thread.currentThread().getContextClassLoader(), false);
Configuration configuration = context.getConfiguration();
localHost = (String)configuration.getProperties().get("hostName");
StrLookup variableResolver = configuration.getStrSubstitutor().getVariableResolver();
log4jConfigLocation = configuration.getConfigurationSource().getLocation();
String emitterName = getLog4JProperty(variableResolver, "emitterName");
String emitterType = getLog4JProperty(variableResolver, "emitterType");
String emitterVersion = getLog4JProperty(variableResolver, "emitterVersion");
String mappingCommonVersion = getLog4JProperty(variableResolver, "commonMappingVersion");
String mappingCustomVersion = getLog4JProperty(variableResolver, "customMappingVersion", false);
(...)
private static String getLog4JProperty(StrLookup variableResolver, String key, boolean isMandatory) {
String res = variableResolver.lookup(key);
if (res == null && isMandatory) {
throw new LoggerRuntimeException(String.format("%s is not set in the log4j2 configuration file (%s), cannot continue", key, log4jConfigLocation));
} else {
return res;
}
}
(...)
As you can see, it seems that the ‘log4jConfigLocation’ was initialized with the logback configuration file…
And then here is the logback file generated by diffblue plugin :
<configuration debug="false">
<!-- Daily rolling file appender -->
<appender name="file-logger"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>{java.io.tmpdir}/diffblue/log/cover-plugin-server.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>
{java.io.tmpdir}/diffblue/log/cover-plugin-server.%d{yyyy-MM-dd}.gz
</FileNamePattern>
</rollingPolicy>
<immediateFlush>true</immediateFlush>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%level][%thread][%logger{16}] %message%n</pattern>
</encoder>
<!-- set level="DEBUG" or "TRACE" or "INFO" to enable more verbose output -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>
<!-- set level="DEBUG" or "TRACE" or "INFO" to enable more verbose output -->
<logger name="com.diffblue" additivity="false" level="DEBUG">
<appender-ref ref="file-logger"/>
</logger>
<!-- disable all logging that does not come from Diffblue code -->
<!-- <root level="OFF"/> -->
</configuration>
Thank you for help !
Frederic