I deployed a war project in a Tomcat and it works without any problem. So I tried to deploy same war project in another tomcat. To deploy in this new Tomcat I need to insert this exclusion in my pom.xml file:
spring-boot-starter-logging
this exclusion get a lot of log lines ... inserting exclusion I have a log line every 30 seconds. This is the log line :
2019-10-02 11:36:08 DEBUG HikariPool:404 - ProjectHikaryPool - Pool stats (total=10, active=0, idle=10, waiting=0)
Image
spring-boot-starter-logging is embedded in the spring boot starter web. Spring boot is not dedicated to a specific logging framework and the default one is logback as you can read in the docs. Enabeling the spring-boot-starter-logging or spring-boot-starter-web will print out all the system side debug information to the console. If you disable it the logs won't be printed. Why don't you expect this behaviour?
If you want to change the log level that is printed to the console you can use
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
for example as mentioned in the docs
Related
I have a vert.x maven project using the vertx-jdbc-client version 3.6.0 and according to the vertx jdbc docs there are some basic c3p0 configs you can specify in the config object passed in when creating a JDBCClient, but for the rest you need to use a c3p0.properties file on the classpath. I placed the c3p0.properties file in src/main/resources/c3p0.properties with:
initialPoolSize=1
acquireRetryAttempts=1
I verified that the c3p0.properties file is in target/classes after the build, the log output even changes on startup, where it used to say
10:52:57.388 [vert.x-eventloop-thread-0] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping.
It no longer says this with the file there, so it seems it is finding it. But the values are not being respected, I still get the default initial pool size (3) and retry attempts (30).
What am I doing wrong? Any solutions for advanced c3p0 configurations in a maven vertx project?
I'm using log4j and slf4j-log4j12 to print log in my project.
Problem is i don't want to show ebean's log.
I have read Ebean logging config documentation but it's for logback.
I have tried log4j.logger.io.ebeaninternal.server.transaction.JdbcTransaction=INFO. It's not work too.
Does anyone know how to config log4j for ebean to just printout [INFO] level or None
I solved my problem. This is my config for anyone who need it.
# Setup log level for Ebean
log4j.logger.io.ebean.SQL=INFO
log4j.logger.io.ebean.SUM=INFO
log4j.logger.io.ebean.TXN=INFO
log4j.logger.org.avaje.classpath.scanner=INFO
I have a web application deployed on WildFly 10. After adding a new Maven dependency to my application, logging stopped working. Investigating, I've found that the new dependency includes a log4j.properties in its JAR, and I guess this is causing the logging to screw up.
I cannot delete the file from the JAR, since every time my project compiles it would come back. I need WildFly to manage the logging properties, so adding an additional log4j.properties isn't an option (it would be if it can be configured to fallback to WildFly defaults, but I don't know if this is possibile).
How can I ignore a dependency's log4j.properties or override it with WildFly's settings?
If your app does not use is own log4j properties file or xml, you are best just disabling the per-deployment logging configuration option on wildfly, then any will be ignored
You can exclude Logging module from you jar.
dependencies {
compile group : 'com.chapter1' name: 'common.all', version: '1.0.001'{
exclude( // here u can exclude that module... )
}
In WildFly 10 you can set the use-deployment-logging-config on the logging subsystem to false which will skip processing any logging configuration files. Do note this will skip processing on all deployments.
I'm testing my ear application on the container and I need to see some debugging messages I spread on my application. I'm using slf4j-api with log4j as logging framework.
During my test phase (out of the container) all logging was working perfectly, so the configuration is fine. But now I've deployed the application with the same configuration but my messages are not showing. Here is my log4j's config:
#rootLogger config
log4j.rootLogger=INFO, console
#appender config
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console..threshold=DEBUG
log4j.appender.console.target=System.out
log4j.appender.console.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.console.layout.ConversionPattern=%d{ABSOLUTE} [%t] %p %l - %m%n
# Log JDBC bind parameter runtime arguments
log4j.logger.org.hibernate.type=INFO
#application logger config
log4j.logger.ar.edu.unt.sigea=DEBUG, console
As I said, when I run my #Test methods, all my logger.debug() messages are shown correctly, but now that I'm running on the container with the same configuration, no debug message is shown.
I found this post and added the line log4j.appender.console..threshold=DEBUG as suggested by the answer but didn't work.
I'm deploying on Wildfly-10.0.0.Final Application Server and I'm using this logging dependencies:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
What am I missing? Where should I look for? Thanks in advance for your answers
You don't need to use the log4j binding unless you want to use your own log4j configuration. From the configuration file it looks like you're just using console appender which is already provided by the WildFly logging subsystem.
All you need to do to see debug messages with your current configuration is to remove the log4j.properties from your deployment and remove the org.slf4j:slf4j-log4j12 dependency from your pom. Then you can use the logging subsystem to configure logging and turn on/off debug logging. If you use CLI or the web console you can change logging levels without restarting the server.
To add a debug level and change the default console-handler level to DEBUG. The following two CLI commands are all you need to configure debug logging.
/subsystem=logging/logger=ar.edu.unt.sigea:add(level=DEBUG)
/subsystem=logging/console-handler=CONSOLE:write-attribute(name=level, value=DEBUG)
looking at this Wildfly Documentation I realized that my log4j.properties file was located in a wrong place: it was in a submodule of my project and must be in the META-INF folder of the EAR module.
By default, Wildfly takes the deployment's logging configuration, so no extra configuration is needed in standalone.xml (or standalone-full.xml depending on what profile are you using, which is my case).
switch the log level to DEBUG on console
{wildfly}/bin/jboss-cli.sh --connect
[standalone#localhost:9990 /] /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=DEBUG)
[standalone#localhost:9990 /] /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=DEBUG)
switch it back to whatever it was initial configuration (here it is INFO)
[standalone#localhost:9990 /] /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=INFO)
[standalone#localhost:9990 /] /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=INFO)
From: https://gist.github.com/lfryc/aae879ceb5534292e150
I am using log4j 2.4 and trying to convert log4j2.xml to log4j.properties, however monitorInterval property doesn't seem to be working with log4j2.properties.
status = trace
name=PropertiesConfig
property.filename = logs
appenders = console, file
monitorInterval=10
though log4j2 following documentation
https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties
clearly stats that
Properties configuration files support the advertiser,
monitorInterval, name, packages, shutdownHook, status
any changes in property file doesn't leads to reloading of logging configuration. On the contrary, it seems to be perfectly working in xml format
<Configuration status="TRACE" monitorInterval="5">
where whenever I do make any changes in .xml my log4j configuration is picked up and is verified via following log.
2016-06-17 14:43:17,267 Thread-5 DEBUG Reconfiguration started for context 1198108795 (org.apache.logging.log4j.core.LoggerContext#86be70a)
2016-06-17 14:43:17,268 Thread-5 DEBUG Not in a ServletContext environment, thus not loading WebLookup plugin.
2016-06-17 14:43:17,273 Thread-5 DEBUG Initializing configuration XmlConfiguration[location=/Users/userx/Desktop/logs/log4j2_prod.xml]
I also tried to upgrade Log4j version to 2.5 but still observe same behavior.
To add to Ralph's answer, this was fixed in Log4j 2.6. The corresponding ticket is https://issues.apache.org/jira/browse/LOG4J2-1263
Please use Log4j-2.6.1 or later.
This was a bug that has been fixed. I would suggest updating the latest log4j release.