File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes file : where to place it in Netbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark " file : where to place it in Netbeans" Watch " file : where to place it in Netbeans" New topic
Author file : where to place it in Netbeans

Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96

Hi All,

I guess this is a very common issue, but all solutions/suggestions provided for, in different forums did not work for me. So I am posting this for any help. I just started learning log4j and am working on implementing it in my tutorial project. I wrote the file, which looks like this :

I am using logging in an action class in my Struts project. this is the code :

When I am trying to run this from Netbean 7.0 IDE, I'm getting an error
SEVERE: log4j:WARN No appenders could be found for logger (org.apache.struts.faces.application.ActionListenerImpl).
SEVERE: log4j:WARN Please initialize the log4j system properly.
SEVERE: log4j:WARN See for more info.

I gather from all the discussions that this means my file is not available. I have already tried placing it in the src folder as well as in WEB-INF under web folder. It still doesn't work.
Can anyone please advise where to place it? My folder structure from netbeans looks like the attached file folderStructure_netbeans, while the folder structure at the physical location looks like shown in folderStructure_location. Netbeans is using Glassfish server 3.1

[Thumbnail for folderStructure_location.jpg]

[Thumbnail for folderStructure_netbeans.jpg]

OCJP 6.0
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

The short answer is that it should go in a folder which is in the classpath. In a web application, then the WEB-INF/classes folder would be a good choice.

And since you're developing a web application, you should ask where to put it in a web application. Don't put it somewhere else for Netbeans's purposes, if you do then the web application will only work when run from Netbeans.
Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96

Hi Paul,
By WEB-INF/classes, I guess you mean the folder structure that is created when the application is built and deployed? In my case, netbeans is creating this structure inside the build folder, that gets created when I build the application from inside netbeans. And this folder does have a copy of my properties file. But it still doesn't work. If you mean some other place, can you kindly clarify further?
I have attached the screenshot to show where I have placed the properties file.

[Thumbnail for log4j.jpg]

It is sorta covered in the JavaRanch Style Guide.
subject: file : where to place it in Netbeans
It's not a secret anymore!