这可能很明显,但我一直在寻找一个简单的例子org.apache.commons.logging
来记录一个特定的文件(即/path/to/my-log.txt
)
public class MyClass {
static Log log = LogFactory.getLog(MyClass.class);
public static void main(String[] args) {
// What to do here to get log to output to a file???
log.info("I want to appear in a specific log file")
}
}