Log4J, problem with Hibernate and Spring
I have this doubt,if somebody can helps me it would be great...I have already read in a lot of websites also I published it in other forums, but everything what they said to me was not successful, as I am working with websphere 5.1, this it must be the indicated forum...
How can I do the project web reads the configuration of the log4j.properties?, I tried adding it to application context, but I haven't had the expected results, also adding listeners in the web.xml, ah! and also throwing the file within the src folder.
Marcus :cool:
RE: Log4J, problem with Hibernate and Spring
To log you must do an instance of the Logger class, and then to put myLogger.info for level of info, debug for level of debug and so on.
Now if you don't see what does log in, maybe it's a .propierties configuration problem or perhaps you have log4j in level debug and you do logger.info and it doesn't show you because of that.
Log other things and do a log with that same level, thus must work…
Supposing that your .properties "key" are in package calls "data", you can use a code similar to this
Code:
String key = "key";
Properties prop = new Properties();
InputStream is = this.class.getResourceAsStream ("/data/config.properties");
prop.load (is);
String val = prop.getProperty (key);
Albert :rolleyes: