aspose file tools
The moose likes Other Open Source Projects and the fly likes log4j for specific class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "log4j for specific class" Watch "log4j for specific class" New topic
Author

log4j for specific class

Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 102
Threre are few hundreds class in applcation and they run together and all use log4j.

Could I set log4j to only get the log for one or few classes, instead of find the info from thousandes log line ? I could filter it by grep, but I think it could be better method from log4j.

Thanks,

Steve
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Moving to Other Open Source Projects...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Seb Mathe
Ranch Hand

Joined: Sep 28, 2005
Posts: 225
Yes you can...
Have a look at log4j short manual
For example, if your log4j configuration is in a properties file :

# Turns off default logging,
log4j.rootLogger=OFF

# A console appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender

# All classes under com.mypackage will log to console with WARN level enabled
log4j.logger.com.mypackage=WARN, stdout


Regards,<br />Seb<br /> <br />SCJP 1.4
Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 102
Thanks a lot for your advice.
 
 
subject: log4j for specific class
 
Threads others viewed
Log4j Wrapper and PatternLayout Implementation
Unable to log to file
Why do we need mulitple loggers? - Log4j
Looking for an open source tool to parse log4-j log files.
remove log4j appender from an API
developer file tools