gdantimi
gdantimi

Reputation: 388

Tomcat Couldn't get lock for log file

I have a Vaadin project and I have some resource to manage in some folders. I have, for example, a custom logger and I want to save that log in WebContent/WEB-INF folder, but when I create the file handler I get this error:

java.io.IOException: Couldn't get lock for pathtofile

This is how I create that FileHandler:

String baseDir = getContext().getBaseDirectory().getPath();
String path = URLDecoder.decode(baseDir + File.separator + "WEB-INF"+ File.separator + logsPath + File.separator + logName, "UTF-8");
handler = new FileHandler(path, true);

Where logsPath is a property loaded correctly. When I inspect from debug the path string is ok. I launch the application from Eclipse. I noticed that the tmp0 folder created by eclipse for running the application are readonly, is it right? Why I get that error?

Upvotes: 0

Views: 3271

Answers (1)

gdantimi
gdantimi

Reputation: 388

Solved: I created a "logs" folder under WebContent folder and I put an empty file in it, because Tomcat does not deploy empty folders.

Upvotes: 1

Related Questions