facebook

[Closed] console do not show log4j debug info

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #222318 Reply

    kunji
    Member

    Myeclipse default only show the info. How to enable console to show debug from log4j?

    thanks

    #222320 Reply

    Greg
    Member

    You will need to setup a log4j.properties file in your project with parameters that will set logging to debug.

    log4j.rootCategory=DEBUG,....

    I would take a look at the log4j documentation for more info:
    http://logging.apache.org/log4j/docs/documentation.html

    #245069 Reply

    z979961
    Member

    I defined following log4j.properties and put it under my web application’s source folder. but looks like i still can not see the debug message.

    # Log4J Configuration File
    # This file specifies two different logs
    #
    # 1. Main Application Log
    # 2. Access Log of users attempting to log into the system

    # The root logging configuration
    log4j.rootCategory=DEBUG, rolling, stdout
    log4j.logger.accessLogger=DEBUG, accessFile

    # Define console appender
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d{ddMMMyy HH:mm:ss} %-5p %c %x – %m%n

    # Define application log appender
    log4j.appender.rolling=org.apache.log4j.RollingFileAppender
    log4j.appender.rolling.File=C:\\Servers\\logs\\mydom\\application.log
    log4j.appender.rolling.MaxFileSize=100KB
    log4j.appender.rolling.MaxBackupIndex=5
    log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
    log4j.appender.rolling.layout.ConversionPattern=%d{ddMMMyy HH:mm:ss} %-5p %c %x – %m%n

    #Define access log appender
    log4j.appender.accessFile=org.apache.log4j.RollingFileAppender
    log4j.appender.accessFile.File=C:\\Servers\\logs\\mydom\\access.log
    log4j.appender.accessFile.MaxFileSize=100KB
    log4j.appender.accessFile.MaxBackupIndex=5
    log4j.appender.accessFile.layout=org.apache.log4j.PatternLayout
    log4j.appender.accessFile.layout.ConversionPattern=%d{ddMMMyy HH:mm:ss} %x – %m%n

    #245088 Reply

    Greg
    Member

    Is the log4j.properties file at the same package location as where you are instantiating the logger class?

    #245091 Reply

    z979961
    Member

    I put the log4j.properties file under the source directory. But I just tried to move it to the same package location as the class which instantiating the logger class, still have no luck. Thanks

    #245147 Reply

    z979961
    Member

    By the way, this log4j.properties is working in WebSphere.

    #245168 Reply

    Riyad Kalla
    Member

    I really don’t think this is a MyEclipse issue. MyEclipse redirects all stdout and stderr to the Console. As long as your app server is outputting to the console and your log4j properties is found (which it sounds like it is) then you are all set. if you are still not seeing certain output, then it’s possible your app server isn’t outputting *that* output to stderr or stdout.

    #245221 Reply

    z979961
    Member

    I finally figured out what is the problem. For some reason, I don’t have log4j.jar file in WEB-INF/lib. I thought I had it there but looks like I mistakenly put commons-logging.jar instead of log4j.jar. After I added the log4j.jar in that directory, everything works like a charm. Sorry for the confusion.

    #245228 Reply

    Riyad Kalla
    Member

    No problem, glad it’s working.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: [Closed] console do not show log4j debug info

You must be logged in to post in the forum log in