0

I am new to the Java language. I've written a Java web service application using the NetBeans IDE and it's working fine.

I want to maintain logs in a separate text file for each user login in the logs folder of the web service application, but I haven't figured out how to get the root folder path of the web service application.

I am .NET programmer, so in .NET I can use Server.MapPath("~/logs") to get the logs folder path which is present under the web service application root folder. How can I do the equivalent using Java?

JBC
  • 667
  • 1
  • 9
  • 21
YogeshNC
  • 311
  • 1
  • 2
  • 12
  • 2
    You should have a look at [Log4j 2](https://logging.apache.org/log4j/2.x/). It is a great lib for logging, and when using it, you will be the one defining where is the log output done – DamCx Sep 01 '17 at 13:32

1 Answers1

0

The following links might help. google it before you raise your question.

log4j relative file path

set an absolute path for a "log4j.properties" file

What is log4j's default log file dumping path

caot
  • 3,066
  • 35
  • 37