- I am trying to integrate the logger with File appender but why the file is not get generated automatically while run the spring boot application.
Below are my log4j2.xml configuration file
<PatternLayout>
<!-- custome formate to see the log message -->
<Pattern>%d - %c [%M] - (%p) %m %n </Pattern>
</PatternLayout>
</console>
<File name="LogToFile" fileName="logs/myapp.log">
<PatternLayout>
<!-- custome formate to see the log message -->
<Pattern>%d - %c [%M] - (%p) %m %n </Pattern>
</PatternLayout>
</File>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="examPortalConsole"/>
<AppenderRef ref="LogToFile"/>
</Root>
</Loggers>
POM.XML file dependency
<!-- log4j neccessary dependency-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
I have successfully got the console appender log but failed to integrate the File appender because on path src/main/resources not get generated automatically file .