Results 1 to 2 of 2
  1. #1
    Marcus is offline Member
    Join Date
    Jun 2007
    Posts
    92
    Rep Power
    0

    Default 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:

  2. #2
    Albert is offline Senior Member
    Join Date
    Jun 2007
    Posts
    114
    Rep Power
    0

    Default 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

    Java 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:

Similar Threads

  1. composite-id problem hibernate
    By javadev in forum JDBC
    Replies: 14
    Last Post: 07-27-2009, 07:30 PM
  2. Regarding Log4j
    By sidiq in forum New To Java
    Replies: 0
    Last Post: 04-07-2008, 08:35 PM
  3. Lead Java developer -- Spring and Hibernate experience
    By orjueladiego in forum Jobs Offered
    Replies: 0
    Last Post: 10-29-2007, 02:50 PM
  4. problem with hibernate and oracle 8i
    By javadev in forum JDBC
    Replies: 4
    Last Post: 08-09-2007, 03:21 PM
  5. Replies: 2
    Last Post: 06-30-2007, 04:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •