how to create log in specific location when using log4j in java desktop application

前端 未结 4 1746
天命终不由人
天命终不由人 2020-12-16 03:09

I am using log4j in Eclipse for logging messages in a java desktop application. I want that the log should be created in a specific folder (Specifically, in the folder which

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 03:40

    It is not good to create log in a project folder since it gets bigger and bigger in size. Rather you can create it in user directory from which your application is running.

    Eg: should be ${user.home}/appName/MyWEB.log , user generally has right to write in home dir

    works for both windows and linux environment.

提交回复
热议问题