1

Where should I place the logging.properties file to be available for the code?

LogManager.getLogManager().readConfiguration(new FileInputStream("logging.properties"));

Curently there is a IOException because the file is not found. This is my idea project structure. I tried to place it in src and in src\main.

enter image description here

rozerro
  • 5,787
  • 9
  • 46
  • 94
  • Does the file exists at the location where you start your application from? Do you want to use `getResourceAsStream()` instead? – Progman May 22 '22 at 11:13
  • @Progman it's not a servlet based app, just a runnable jar – rozerro May 22 '22 at 11:15
  • 2
    Then check other questions like https://stackoverflow.com/questions/29070109/how-to-read-properties-file-inside-jar or https://stackoverflow.com/questions/2815404/load-properties-file-in-jar – Progman May 22 '22 at 11:16
  • @Progman I placed it in the folder where my jar file and it works but I want to keep it inside jar – rozerro May 22 '22 at 11:18
  • 1
    The file should be in `src/main/resources`. See https://stackoverflow.com/a/2816029/139985 – Stephen C May 23 '22 at 08:02

0 Answers0