classpath - Log4j2.xml monitorInterval not working -
hi using log4j2 , have written log4j2.xml file under
src/main/resources
i have added attribute
<configuration monitorinterval="60">
but doesn't work. how add file classpath using intellij.
i have included following in pom.xml under build tag:
<resources> <resource> <directory>src/main/resources</directory> </resource> </resources>
you should update log level in target/classes/log4j2.xml
instead of src/main/resources/log4j2.xml
update:
here's test , works me
test.java
public class test { static final logger logger = logmanager.getlogger(); public static void main(string[] args) throws interruptedexception { while (true) { logger.info("info"); logger.error("error"); thread.sleep(1000); } } }
log4j2.xml
<?xml version="1.0" encoding="utf-8"?> <configuration monitorinterval="5"> <appenders> <console name="stdout" target="system_out"> <patternlayout pattern="%m%n"/> </console> </appenders> <loggers> <root level="info"> <appenderref ref="stdout"/> </root> </loggers> </configuration>
i changed level in target/classes/log4j2.xml
info error , app output error log messages.
Comments
Post a Comment