- This topic has 8 replies, 4 voices, and was last updated 19 years, 5 months ago by
Riyad Kalla.
-
AuthorPosts
-
kunjiMemberMyeclipse default only show the info. How to enable console to show debug from log4j?
thanks
January 6, 2005 at 9:53 pm #222320
GregMemberYou 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.htmlJanuary 23, 2006 at 3:20 pm #245069
z979961MemberI 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%nJanuary 23, 2006 at 5:48 pm #245088
GregMemberIs the log4j.properties file at the same package location as where you are instantiating the logger class?
January 23, 2006 at 6:07 pm #245091
z979961MemberI 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
January 24, 2006 at 9:08 am #245147
z979961MemberBy the way, this log4j.properties is working in WebSphere.
January 24, 2006 at 11:02 am #245168
Riyad KallaMemberI 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.
January 24, 2006 at 6:01 pm #245221
z979961MemberI 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.
January 24, 2006 at 8:26 pm #245228
Riyad KallaMemberNo problem, glad it’s working.
-
AuthorPosts