How to configure STDOUT appender to print logs in file?

In my project, logs are configured already. Appender type console is printing logs on the console.

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%coloredLevel %logger{15} - %message%n%xException{10}</pattern>
    </encoder>
  </appender>

On production, I am running application using nohup command which is printiing output in nohup.out file. I want to store STDOUT in a separate file. How to print console logs to file and use RollingFileAppender so that logs will be maintained datewise?

${application.home:-.}/logs/application.log %date [%level] from %logger in %thread - %message%n%xException
1 Like

Hey @chaitanya.anpat,

See Logback documentation about how to configure appenders:

https://logback.qos.ch/manual/appenders.html

There is information about how to configure RollingFileAppender and everything else there. :slight_smile:

Best.

1 Like

Thanks. I have configured using the same way :slightly_smiling_face: