How to configure STDOUT appender to print logs in file?

(Chaitanya Anpat) #1

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">
      <pattern>%coloredLevel %logger{15} - %message%n%xException{10}</pattern>

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?

(Sergei Myshliakov) #2
${application.home:-.}/logs/application.log %date [%level] from %logger in %thread - %message%n%xException

(Marcos Pereira) #3

Hey @chaitanya.anpat,

See Logback documentation about how to configure appenders:

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


(Chaitanya Anpat) #4

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