logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Ho <sebasti...@bii.a-star.edu.sg>
Subject how to log to different files
Date Tue, 01 Jun 2004 07:34:01 GMT
Hi

I wish to have output from classes to go into a log file and some other
classes (from the same packages) into another log file. I have the
following log4j.properties configuration but it doesn't work.

>>From the config, there are 4 fours that I wish to go into 'searchfile'
and all the other classes to log to 'file'.

What this produces is both files (searchfile and file) are created and
contains exactly the same logs. All logs (including those from the 4
classes) goes into both the files.

This is what I have in my Java files.

static Logger logger = Logger.getLogger(CatCrawler.class);
PropertyConfigurator.configure(path_to_log4j.properties_file);


=================================================================================
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=${user.home}/.catcrawler/log/application.log
log4j.appender.file.threshold=debug
log4j.appender.file.append=false
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d [%t] %5p %c{1}:%M - %m%n

log4j.appender.searchfile=org.apache.log4j.FileAppender
log4j.appender.searchfile.File=${user.home}/.catcrawler/log/search.log
log4j.appender.searchfile.threshold=debug
log4j.appender.searchfile.append=false
log4j.appender.searchfile.layout=org.apache.log4j.PatternLayout
log4j.appender.searchfile.layout.ConversionPattern=%d [%t] %5p %c{1}:%M
- %m%n

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.threshold=debug
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %5p %c{1}:%M -
%m%n

log4j.rootLogger=DEBUG, file, stdout

log4j.logger.sg.edu.astar.bii.catcrawler.ui.CrawlSearchProcess = DEBUG,
searchfile
log4j.logger.sg.edu.astar.bii.catcrawler.crawler.WebCrawler = DEBUG,
searchfile
log4j.logger.sg.edu.astar.bii.catcrawler.crawler.HTMLFilter = DEBUG,
searchfile
log4j.logger.sg.edu.astar.bii.catcrawler.crawler.IndexHTML = DEBUG,
searchfile

=================================================================================

Thanks

Sebastian Ho
BII


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message