I am building a JSF application that utilizes the expect4j library and am having a really hard time suppressing the output in the glassfish server log. I tried creating a logging.properties file in my src/main/resources directory based on the expect4j's logging.properties file. I also tried creating a log4j2.xml file to accomplish the same thing. I even tried moving the log4j2.xml file to the WEB-INF directory next to web.xml based on another post I found through the research.
I would like to suppress it because it generates a lot of messages at the info/debug level. Here is an example of the message:
[2016-06-25T14:36:06.195-0600] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=225 _ThreadName=Thread-8] [timeMillis: 1466886966195] [levelValue: 800] [[4229 [__ejb-thread-pool5] DEBUG expect4j.Expect4j - Found EOF]]
Looking over expect4j, it appears that it only depends on slf4j, so I shouldn't have any issue with defining log4j2 as my logger.
Here are the following dependencies I'm including in my maven project:
- expect4j : 1.6
- slf4j-log4j12 : 1.7.7
- jstl : 1.2
- jstl-api : 1.2-rev-1
- javax.ejb-api : 3.2
- jsf-api : 2.2.8-02
- jsf-impl : 2.2.8-02
- primefaces : 5.2
- log4j-web : 2.6.1
Here is what I have in my logging.properties file:
handlers=java.util.logging.ConsoleHandler
.level=INFO
java.util.logging.ConsoleHandler.level=INFO
#expect4j.handler=java.util.logging.ConsoleHandler
expect4j.level=SEVERE
Here is what I have in my log4j2.xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<Configuration status="INFO">
<Appenders>
<Console name="Console" target="STDOUT">
<PatternLayout
pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Logger name="expect4j" level="error" additivity="false">
<AppenderRef ref="Console" />
</Logger>
<Root level="warn">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
I did look at this link, but I wasn't seeing any of what it was pointing out in jconsole when I attached to my glassfish server. Suppress java util logging from 3rd party jar.
Thank you for any help you might be able to provide.