0

Good day

I am new to log4j, I want to deploy a web app on an windows and Linux server so if the app is on windows it will use a path like c:/logs/appLogFile.log and if its running on Linux it will be something like /opt/app/logs/appLogFile.log I know you can set the path of the log file in the log4j.properties file but is there a way to for me to test on which OS its running and use the specified path for that OS. I am also using spring as a framework

Thank you in advance

  • The path separator on windows is a backslash (\\). Depending on the Windows APIs that log4j calls it may or may not convert / to \. See [Naming Files, Paths, and Namespaces](https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx) for additional details. – IInspectable Nov 17 '15 at 14:29
  • Thank you that was pretty useful – Joseph Koma Nov 18 '15 at 06:58

1 Answers1

1

I believe this question has already been answered here.

Also, if you are using Maven, you may want to look into build profiles to assist in managing different environments.

Community
  • 1
  • 1
bwoodson
  • 70
  • 8