0

How to enable the spring-boot application to print the logging directory while startup?, like below example:

logging directory - /home/test/studentapp.log

Irrespective of any logging framework we use like LOGBACK, Log4j2, Java Util logging ..e.t.c in Spring, want to print the logging directory while startup.

Is there any property needs to be configured at application.properties to enable this?

Edit:

For example, if I use the below logging logback.xml configuration, then I want to log the logging directory mentioned in the below configuration to the console at application startup, Like If you start kafka server It will give the location of the logging directories in the console at startup. In a similar way can we have this feature in spring?

<appender name="STUDENT_APP_LOG_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/home/test/studentapp.log</file>
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <pattern>[%d{ dd-MM-yyyy HH:mm:ss.SSS }] [ %5p ] [%thread] [ %logger ] %msg%n</pattern>
    </encoder>
    <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
        <fileNamePattern>/home/test/archived/studentapp-%d{dd-MM-yyyy HH:mm:ss}.%i.log</fileNamePattern>
        <maxFileSize>100MB</maxFileSize>
        <totalSizeCap>10GB</totalSizeCap>
        <maxHistory>90</maxHistory>
    </rollingPolicy>
</appender>
Arun Sai Mustyala
  • 1,736
  • 1
  • 11
  • 27
  • Does this answer your question? [spring-boot default log location](https://stackoverflow.com/questions/31939849/spring-boot-default-log-location) – İsmail Y. Aug 06 '21 at 09:01
  • Can you refer to output from apache kafka you mentioned? Have you tried probing the apache kafka source code to see how they do it? It is open source , can be found on github – Ran Lupovich Aug 06 '21 at 10:25
  • No, I'm expecting a solution from spring configuration if present – Arun Sai Mustyala Aug 06 '21 at 10:33

0 Answers0