Results 1 to 4 of 4

Thread: logging configuration question

  1. #1
    Join Date
    Oct 2004
    Location
    Laguna Beach, CA
    Posts
    16

    Default logging configuration question

    Hi,

    I am trying to setup logging but can't figure out where to put the log4j.properties file.

    I am using Eclipse and right now my little project has a src folder for sources and a bin folder for built files. Under src I created my package hierarchy ending with test. In that test package I have a JUnit TestCase to test my DAO with iBatis. Evrything works fine except logging.

    My log4j.properties file is just under src. In that folder, there is another jdbc.properties file that is loaded by iBatis maps, so I know it should be accessible. However, it doesn't seem it is and I haven't found a way to test it.

    Here is my log4j.properties:

    Code:
    log4j.rootLogger=WARN,stdout
    log4j.logger.org.springframework=ERROR,stdout
    
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout-org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
    What am I missing?

    TIA

    Pascal

  2. #2
    Join Date
    Aug 2004
    Location
    Auburn, AL, USA.
    Posts
    106

    Default

    Do you have Log4J on the project's classpath ("build path" under the project's properties)? Do you have the commons-logging.jar there too (Spring uses this)? Finally, your code creating and using a Log4J Logger correctly? I think those are the most likely causes, but its hard to say without more data. Using Eclipse 3.0 and 3.1m4 I have been able to use a similar setup to the one you describe with correct results.

  3. #3
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default

    One thing I've done to debug this kind of problem is to simply output which logger is really being used. Or use a debugger. At one time, I thoght I was using log4j, but was using another. (output format should have told me, duh).
    Code:
    Log log = LogFactory.getLog(this.getClass());
    syserr(log.getClass());

  4. #4
    Join Date
    Oct 2004
    Location
    Laguna Beach, CA
    Posts
    16

    Default

    Thank you both. I was missing a common-logging.properties file. Adding this line to it fix all my Logging problems.

    Code:
    org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JLogger

Similar Threads

  1. configuration question
    By lumpynose in forum Container
    Replies: 7
    Last Post: Aug 31st, 2005, 07:56 PM
  2. Replies: 4
    Last Post: Aug 8th, 2005, 05:20 PM
  3. Newbie question: How to get spring debug logging on?
    By wangjammer5 in forum Container
    Replies: 2
    Last Post: Jul 15th, 2005, 07:11 AM
  4. Configuration / Deployment question
    By hay7777 in forum Container
    Replies: 9
    Last Post: Jun 21st, 2005, 04:32 AM
  5. Replies: 4
    Last Post: Oct 12th, 2004, 06:21 AM

Posting Permissions

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