The normal way to configure log4j is to put the log4j.properties file in the classpath. That's all you need to do... unless you are trying to configure something which isn't in the properties file. Your code doesn't do anything like that, so you should remove it entirely.
As for putting it into the classpath, your Netbeans cfg directory definitely isn't going to be the right place. In real life your Glassfish server won't care about Netbeans at all, or even know about it. I try to arrange things so that my log4j.properties file gets put into the web application's /WEB-INF/classes directory. I assume Netbeans can arrange that for you but (not being a Netbeans user) I can't tell you how.