java - No logs created unless it tests -
i'm using log4j2 logging in app. it's logging uncatched exceptions (error.log) , logging changes of data @ service layer (journal.log; journaljson.log).
and here's thing, when i'm starting service layer tests every log appears in file , console, when i'm using application deployed in tomcat they're in console. what's happening?
<?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> <file name="error" filename="logs/error.log" immediateflush="true" append="true"> <patternlayout pattern=" \n\n %d{yyyy-mm-dd hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </file> <randomaccessfile name="journal" filename="logs/journal.log" immediateflush="true" append="true"> <patternlayout pattern="[%d{yyyy-mm-dd hh:mm:ss.sss}] %msg%n"/> </randomaccessfile> <file name="journaljson" filename="logs/journaljson.log" immediateflush="true" append="false"> <jsonlayout complete="true" charset="utf-8" compact="false" eventeol="false"/> </file> </appenders> <loggers> <logger name="com.user.controller" level="error" additivity="false"> <appenderref ref="error" level="error"/> <appenderref ref="console" level="error"/> </logger> <logger name="com.user.service" level="info" additivity="false"> <appender-ref ref="journaljson" level="info"/> <appender-ref ref="journal" level="info"/> <appender-ref ref="console" level="info"/> </logger> <root level="warn"> <appenderref ref="console"/> </root> </loggers>
well, there couple of possibilities can think of:
- your configuration file isn't being found , using default configuration.
- the logger application isn't com.user.controller or com.user.service , root logger being used.
Comments
Post a Comment