How to redirect application logs to Console or file

Hi ,
I have a main method in a class other than the Main class and this main method starts my spring boot app

SringApplication.run(OtherMain.class);

I wish to start my app using a JavaExec task like so

 task appRun(type:JavaExec) {
    main = com.mine.Company
    classpath = sourceSets.main.runtimeClasspath}

This works , the app boots up and serves my request but the application logs are not displayed on the console.Is there a way to bring the logs to console or even write to a file

I tried the below but it does not give me the logs

    task appRun(type:JavaExec) {
         logging.captureStandardOutput LogLevel.LIFECYCLE
          logging.captureStandardError  LogLevel.ERROR
            main = com.mine.Company
            classpath = sourceSets.main.runtimeClasspath
    }

Help is much appreciated

I think it is broken on some systems only. Usually JavaExec does redirect to console. I have a system where I don’t see the JavaExec output and one where I do. You could try '–console=plain" and see if this helps.