Hello, there is an xml file with the following content:

<Configuration> <Appenders> <File name="file" fileName="log.log"> <PatternLayout> <Pattern>%d{HH:mm:ss} %-5p %c{1}: %L %m%n</Pattern> </PatternLayout> </File> </Appenders> <Loggers> <Root level="trace"> <AppenderRef ref="file" level="INFO"/> </Root> </Loggers> </Configuration> 

Where is the log file saved, maybe you need to specify the path?

  • The log will be saved next to the file being run. Where it specifically depends on whether it is a JAR or WAR. You must specify the full path, or use placeholders and environment variables. - enzo

1 answer 1

The commentary says almost true in fact but not disclosed in meaning.

There is a "working directory" from which all relative paths are built. By default, it is the same as the directory in which the jar is located and is launched. But in fact, he can be anything.

You can learn it programmatically like this:

 String workingDir = System.getProperty("user.dir"); 

You can set it using the -Duser.dir option. Thus, you can run one jar several times from different directories with different settings.