Closed vvargas90 closed 5 years ago
MockServer hasn't used such a logback filter for many many versions. So I doubt this is caused by MockServer, what does your logback.xml
or logback configuration look like. The error is caused by a script filter in logback using a janino script evaluator.
I have one pretty similar as the on you have as example in https://github.com/jamesdbloom/mockserver/blob/master/mockserver-netty/src/main/resources/example_logback.xml
<configuration debug="false">
<!-- to use add system property logback.configurationFile, for example: -Dlogback.configurationFile=/Users/james.bloom/git/mockserver/mockserver-netty/src/main/resources/example_logback.xml -->
<!-- To completely disable all logging completely -Droot.logLevel=OFF -->
<!-- application log -->
<appender name="FILE" class="org.mockserver.logging.DelayedFileCreationRollingFileAppender">
<file>${log.dir:-./}mockserver.log</file>
<encoder>
<pattern>%date %level [%thread] %logger{35} [%file:%line] %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>TRACE</level>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.dir:-./}mockserver.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>1</maxHistory>
</rollingPolicy>
</appender>
<!-- make application log asynchronous -->
<appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>128</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="FILE" />
</appender>
<!-- application console log (for errors and warnings) -->
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
<target>System.err</target>
<encoder>
<pattern>%date %level %logger{20} %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
</appender>
<!-- make console log (for errors and warnings) asynchronous -->
<appender name="ASYNC_STDERR" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>128</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="STDERR" />
</appender>
<!-- application console log -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<target>System.out</target>
<encoder>
<pattern>%date %level %logger{20} %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator>
<!--<expression>level >= INFO && level < WARN</expression>-->
<expression>level < WARN</expression>
</evaluator>
<OnMismatch>DENY</OnMismatch>
<OnMatch>NEUTRAL</OnMatch>
</filter>
</appender>
<!-- make console log asynchronous -->
<appender name="ASYNC_STDOUT" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>128</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="STDOUT" />
</appender>
<!-- request log configuration -->
<appender name="REQUEST_LOG" class="org.mockserver.logging.DelayedFileCreationRollingFileAppender">
<file>${log.dir:-./}mockserver_request.log</file>
<encoder>
<pattern>%msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.dir:-./}mockserver_request.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>3</maxHistory>
</rollingPolicy>
</appender>
<logger name="REQUEST" level="WARN" additivity="false">
<appender-ref ref="REQUEST_LOG"/>
</logger>
<logger name="org.mockserver" level="${mockserver.logLevel:-WARN}"/>
<logger name="org.mockserver.proxy" level="${mockserver.logLevel:-WARN}"/>
<logger name="org.mockserver.mockserver" level="${mockserver.logLevel:-WARN}"/>
<root level="${root.logLevel:-WARN}">
<appender-ref ref="ASYNC_FILE"/>
<appender-ref ref="ASYNC_STDERR"/>
<appender-ref ref="ASYNC_STDOUT"/>
</root>
</configuration>
If you change to the latest version of the example logback file your problem will be resolved:
<configuration debug="false">
<!-- to use add system property logback.configurationFile, for example: -Dlogback.configurationFile=/Users/james.bloom/git/mockserver/mockserver-netty/src/main/resources/example_logback.xml -->
<!-- To completely disable all logging completely -Droot.logLevel=OFF -->
<!-- application log -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.dir:-./}mockserver.log</file>
<encoder>
<pattern>%date %level [%thread] %logger{35} [%file:%line] %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.dir:-./}mockserver.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>1</maxHistory>
</rollingPolicy>
</appender>
<!-- make application log asynchronous -->
<appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>128</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="FILE" />
</appender>
<!-- application console log -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<target>System.out</target>
<encoder>
<pattern>%date %level %logger{20} %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
</appender>
<!-- make console log asynchronous -->
<appender name="ASYNC_STDOUT" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>128</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="STDOUT" />
</appender>
<logger name="org.mockserver" level="${mockserver.logLevel:-INFO}"/>
<logger name="io.netty.handler.ssl.SslHandler" level="WARN"/>
<root level="${root.logLevel:-WARN}">
<appender-ref ref="ASYNC_FILE"/>
<appender-ref ref="ASYNC_STDOUT"/>
</root>
</configuration>
In github at: https://github.com/jamesdbloom/mockserver/blob/master/mockserver-netty/src/main/resources/example_logback.xml
Alright, that fixed the issue. Thanks 😄
Mockserver version: 5.5.0
Steps to reproduce:
MockServerClient mockServerClient = new MockServerClient(mockServerHost, mockServerPort);
Expected result: MockserverClient is initialized at that host and port
Actual result: The following error happen:
Comments: As workaround adding janino dependency in your
pom.xml
fixes the issue