File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Multiple log files using Log4j    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Multiple log files using Log4j

sridhar mangipudi
Greenhorn

Joined: Jun 26, 2008
Posts: 3
Hello,

I want to generate log files based on package structure. Like com.temp.test in test.log ,also I am having a log file at application like app.log .

This is my requirement what has been logged in test.log should not be logged in app.log.This is my log4j.properties file.

# Log4j configuration file.
# Available levels are DEBUG, INFO, WARN, ERROR, FATAL

# Default logger
log4j.rootLogger=DEBUG, PFILE
log4j.logger.com.temp.test=DEBUG,TEST
#
# PFILE is the primary log file
log4j.appender.PFILE=org.apache.log4j.RollingFileAppender
log4j.appender.PFILE.File=./App.log
log4j.appender.PFILE.MaxFileSize=5120KB
log4j.appender.PFILE.MaxBackupIndex=10
#log4j.appender.PFILE.Threshold=DEBUG
log4j.appender.PFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.PFILE.layout.ConversionPattern=%p %d[%l][%C] %m%n
#log4j.appender.PFILE.layout.ConversionPattern=%p %d %m%n

log4j.appender.TEST=org.apache.log4j.RollingFileAppender
log4j.appender.TEST.File=./test.log
log4j.appender.TEST.MaxFileSize=5120KB
log4j.appender.TEST.MaxBackupIndex=10
log4j.appender.TEST.layout=org.apache.log4j.PatternLayout
log4j.appender.TEST.layout.ConversionPattern=%p %d[%l][%C] %m%n

Can youu help me!!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple log files using Log4j