private static Logger logger;
static {
String path = Run.class.getProtectionDomain().getCodeSource().getLocation().getPath();
File file = new File(path);
String parent = file.getParent();
System.setProperty("app.dir", parent);
//一定要在set app.dir 后面,在前面就会导致 app.dir的参数没有生效
public static void main(String[] args) {
}
<!-- app.dir 为app 可执行jar 所在路径-->
<property name="LOG_HOME" value="${app.dir}/log"/>