0

我想做一些简单的日志记录,我在这里缺少什么?

我只想尽可能简单地记录它(现在)。此代码似乎有效,但在 Web 服务上无效!

@WebMethod(operationName = "xyz")
public boolean xyz(@WebParam(name = "entityID") final int entityID throws IOException {

    FileHandler fh = new FileHandler("SISlog.txt", true);
    fh.setFormatter(new SimpleFormatter());
    fh.setLevel(Level.FINEST);

    Logger rootLogger = Logger.getLogger("");
    rootLogger.addHandler(fh);
    rootLogger.setLevel(Level.FINEST);

    rootLogger.log(Level.SEVERE, "auiuuuuuuuuuuuuuuuuu");

    return true;
}
4

2 回答 2

0

You cannot rely on relative paths running inside a webcontainer. Try with an absolute path - like /tmp/SISlog.txt.

于 2012-11-17T08:57:30.247 回答
0

尝试将使用记录器的类的超类的名称放入 getLogger

于 2012-04-07T22:22:48.603 回答