Harry
Harry

Reputation: 505

Spring boot logging path

I have configured the logging path property in my spring boot application.properties.

logging.path=
logging.file=

In respective of this property in application.properties. It is taking the logging file name and creating a new log file in tomcat log file directory.I checked my system properties it has set both LOG_FILE and LOG_PATH property. I have using 1.3.6 version of spring boot. Any known issue related to this. I have read one issue and it seems to be fixed long back.

Upvotes: 1

Views: 3562

Answers (2)

Dhana D.
Dhana D.

Reputation: 1720

If you wish to put the log file in a specific folder and have its own specific filename, you can simply write all of them in the logging.file, i.e. you want the logs stored in the file logmyapi.log inside the folder named logs placed in the current directory, you can write it to:

logging.file=./logs/logmyapi.log

P.S. This will also create folders if there's no such folder with the specified name before.

Upvotes: 0

alexbt
alexbt

Reputation: 17045

You can only use one of the two properties, either you set:

  • the logging file name (logging.file);
  • or the path (logging.path).

You can't specify both at the same time.


Sources

Spring documentation is very subtle on this:

If you want to write log files in addition to the console output you need to set a logging.file OR logging.path property.

springframework.guru says this:

There is also a logging.path property to specify a path for a logging file. If you use it, Spring Boot creates a spring.log file in the specified path. However, you cannot specify both the logging.file and logging.path properties together. If done, Spring Boot will ignore both.

Upvotes: 2

Related Questions