I have a Play 2.0 app, ran play console from the command line. Somewhere in one of the libraries I use, it uses log4j and started to stream debug output for [crawler4j][1], I'm trying to figure out how to selectively disable that output in the play console. I have tried changing the following in application.conf and logger.xml without any luck
application.conf
logger.root=ERROR
logger.play=ERROR
logger.application=ERROR
logger.xml
<logger name="org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager" level="ERROR"/>
Here's a sample of the streaming debug log
13:10:18.818 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.conn.tsccm.ConnPoolByRoute - Closing connections idle longer than 60 SECONDS
13:10:18.818 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.t.ThreadSafeClientConnManager - Closing connections idle longer than 60 SECONDS
13:10:18.818 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.conn.tsccm.ConnPoolByRoute - Closing connections idle longer than 60 SECONDS
13:10:18.818 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.t.ThreadSafeClientConnManager - Closing connections idle longer than 60 SECONDS
13:10:18.818 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.conn.tsccm.ConnPoolByRoute - Closing connections idle longer than 60 SECONDS
13:10:18.818 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.t.ThreadSafeClientConnManager - Closing connections idle longer than 60 SECONDS
13:10:18.819 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.conn.tsccm.ConnPoolByRoute - Closing connections idle longer than 60 SECONDS
13:11:18.818 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.t.ThreadSafeClientConnManager - Closing connections idle longer than 60 SECONDS
13:11:18.818 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.conn.tsccm.ConnPoolByRoute - Closing connections idle longer than 60 SECONDS
13:11:18.819 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.c.t.ThreadSafeClientConnManager - Closing connections idle longer than 60 SECONDS
13:11:18.819 [java-sdk-http-connection-reaper] DEBUG o.a.h.i.conn.tsccm.ConnPoolByRoute - Closing connections idle longer than 60 SECONDS
Just to be clear, the log settings are enforced when I ran the Play app from command line, it's when I run it from within the play console that the settings are not enforced.
I don't think log4j is in use here actually. Apache HTTP client, which is the library producing the debug, logs via apache commons logging.
Play2 uses the SLF4J API with a logback backend.
There is a library on your classpath called jcl-over-slf4j that causes log messages going to apache commons logging to bridge through SLF4J and then to logback instead. (Convoluted I know, but an attempt to allow SLF4J to act as a facade to all the others, and its backend to be the "one logger to rule them all").
The play2 docs indicate logger.xml should allow you to totally customize logging settings, so I think that when there's a logger.xml file present, the application.conf settings have no effect.
logger.xml needs to be a full logback configuration file. I'm not sure if you've posted the full contents of logger.xml or just the changes.
To suppress output like that shown, you should be able to set the contents of logger.xml to something like this:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.apache.http.impl.conn.tsccm" level="error" />
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>
If this doesn't work change the top line to be:
<configuration debug="true">
which will cause logback to log its attempt to configure itself. This might give more pointers.
Hope this helps.
This worked for me:
import org.slf4j.{Logger, LoggerFactory}
LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME).asInstanceOf[
ch.qos.logback.classic.Logger].setLevel(ch.qos.logback.classic.Level.INFO)
Related
I have configured the max. connection pool size of my SpringBoot application to 1 by using the following command:
spring.datasource.hikari.maximum-pool-size=1
Is there any way to verify and confirm this change. I want to check that this is working for my application.
You can see the pool values in log, if you enable debug log for HikariCP.
HikariCP housekeeper thread logs pool information at fixed time interval.
Just set com.zaxxer.hikari logging level to debug.
In logback.xml you can do it like
<logger name="com.zaxxer.hikari" level="debug"/>
Or you can do it in application.properties
logging.level.com.zaxxer.hikari=debug
In your console of log file you will find something similar like this.
DEBUG [HikariPool-1 housekeeper] com.zaxxer.hikari.pool.HikariPool: HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
Total value should not exceed maximum-pool-size value.
I get bunch of messages like these:
2018-09-25 14:22:42.606 [DEBUG] akka.actor.LocalActorRefProvider(akka://cluster) - Resolve (deserialization) of path [system/ddataReplicator/$b#1795511840] doesn't match an active actor. It has probably been stopped, using deadLetters.
2018-09-25 14:22:42.607 [DEBUG] akka.actor.LocalActorRefProvider(akka://cluster) - Resolve (deserialization) of path [system/ddataReplicator/$a#161990085] doesn't match an active actor. It has probably been stopped, using deadLetters.
2018-09-25 14:22:48.897 [DEBUG] akka.actor.LocalActorRefProvider(akka://cluster) - Resolve (deserialization) of path [system/ddataReplicator/$b#1795511840] doesn't match an active actor. It has probably been stopped, using deadLetters.
2018-09-25 14:22:48.898 [DEBUG] akka.actor.LocalActorRefProvider(akka://cluster) - Resolve (deserialization) of path [system/ddataReplicator/$a#161990085] doesn't match an active actor. It has probably been stopped, using deadLetters.
which I would like not to log at debug level. Afaik I cannot just use logger name akka.actor.LocalActorRefProvider because the full logger name includes cluster name (akka.actor.LocalActorRefProvider(akka://cluster)), and we name those differently based on environment it is run, so something like this won't work:
<logger name="akka.actor.LocalActorRefProvider" level="info" />
One option as I understand would be to use regex filters:
Which works, but I'm not sure if this is optimal?
Solved by adding:
<logger name="akka.actor.LocalActorRefProvider(akka://${sys:logging.clustername})" level="info" />
And then passing the logging.clustername at runtime with :
-Dlogging.clustername=current-cluster-name
My logs are getting hammered by below log message in JBOSS 7. Can you anyone suggest how to stop this log message.
2018-02-28 13:37:13,618 WARN [com.arjuna.ats.arjuna] (default-threads - 48) ARJUNA012141: Multiple last resources have been added to the current transaction. This is transactionally unsafe and should not be relied upon. Current resource is LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl#5d70439b[connectionListener=653eac5d connectionManager=7f6856e8 warned=false currentXid=null productName=MySQL productVersion=10.2.13-MariaDB-log jndiName=java:/jdbc/db_jndi]))
In your standalone.xml file, in the logging section, add something like this under the appropriate handler element:
<filter>
<not>
<match pattern="ARJUNA012141"/>
</not>
</filter>
Of course, you should add these lines using the jboss-cli utility. Did you know that changes to logging don't require a server restart, but will be picked up at the defined refresh interval?
I have a problem with logback + wildfly 8 configuration.
I'm using simple ConsoleAppender:
appender("STDOUT", ConsoleAppender) {
encoder(PatternLayoutEncoder) {
pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{70} - %msg%n"
}
}
logger("com.package.app", INFO)
root(DEBUG, ["STDOUT"])
The problem is that Wildfly appends to logback messages also server's log pattern.
It looks like:
11:31:49,954 INFO [stdout] (default task-1) 11:31:49.951 [default task-1] INFO com.package.app.controller.FrontController - message...
As You can see, there is a server logs pattern first and then the logback message
How to solve this problem?
WildFly captures System.out and System.err and redirects them to a logger. You could configure a logger in WildFly with the name stdout, set the use-parent-handlers attribute to false and set the level to NONE. This should disable System.out from printing which means it will also not appear in the server.log.
That said, I don't see a reason to use logback for a ConsoleAppender since the server already provides one.
Jboss 7 war deployment failed and i got the below error message in the log.
ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015052: Did not receive a response to the deployment operation within the allowed timeout period [60 seconds]. Check the server configuration file and the server logs to find more about the status of the deployment
I tried restarting the JBoss server, I have never seen this before, it was working fine before. I googled around for solution and cause of this issue but cant find anything really useful, can anyone help please?
Well I tried deleting the log file, it helped at the beginning but then I got the error again. The proper solution is as following:
Go to Jboss_installation_dir\standalone\configuration and find the file standalone.xml. Change the following line:
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" />
</subsystem>
into:
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" deployment-timeout="1000" />
</subsystem>
then it should work fine.
NOTE: This deployment-timeout is in seconds
It was caused by insufficient space on the disk, cleared some unwanted log files and other temp files to fix this issue.
When dealing with JBoss 7 (6.1+ EAP) remember to edit XML settings only when the server is not running - otherwise they will be overwritten and the changes will not take place.
According to the documentation, Deployment-timeout is specified in seconds and Scan-interval time is specified in miliseconds.