java - Can't find the log4j2 configuration file -
i have java project in eclipse kepler , i'm trying set log4j. i've added project using next in pom.xml:
<dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-api</artifactid> <version>2.1</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-core</artifactid> <version>2.1</version> </dependency>
i have next in log4j config file named log4j2.xml:
<?xml version="1.0" encoding="utf-8"?> <configuration status="warn"> <appenders> <console name="console" target="system_out"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n" /> </console> </appenders> <loggers> <root level="debug"> <appenderref ref="console" /> </root> </loggers> </configuration>
log4j2.xml located in src/main/resources i've added java build path source tab in eclipse. when launch project, i'm able utilize logger. but, if rename config file loggerconfig-dev.xml , add together vm arugments in eclipse:
-dlog4j.configuration=loggerconfig-dev.xml
i error saying "no log4j2 configuration file found...". how see configuration file new name?
according configuring log4j 2 - apache log4j 2
log4j inspect "log4j.configurationfile
" scheme property
so, need alter to:
-dlog4j.configurationfile=loggerconfig-dev.xml
see also:
system properties - configuring log4j 2 - apache log4j 2 java eclipse log4j
No comments:
Post a Comment