---
title: "log4j.properties的加载"
author: "h2n2"
date: "2011-01-25T15:42:11Z"
tags: []
categories: ["编程语言"]
slug: "log4j-properties"
draft: false
lastmod: "2011-01-25T15:42:11Z"
id: 895124
url: "https://h2n2.iteye.com/blog/895124"
---

问题描述：
  普通java工程，编译打包后，通过bat启动程序，出现如下错误：
  log4j:ERROR setFile(null,true) call failed;/log/services.log (系统找不到指定的路径。)

分析过程：
  1、在eclipse中运行正常。
  2、修改发布环境的log4j.proporties中设置的log文件路径，报相同的错误，连路径都没变。
  3、打印classpath，发现classpath中多出来一些无关的路径。

解决办法：
  1、删除环境变量classpath
  2、或者、将所有classpath下的log4j.properties找出来，只保留一个。