aspose file tools*
The moose likes EJB and other Java EE Technologies 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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
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 you help me!!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

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
 
Similar Threads
need some help with a more advanced log4j.properties files with multiple appenders..
Multiple log files using Log4j
Multiple log files using Log4j
Log4j - log in different files, same jar , different Main classes
Log4J - File appender in 2 or more files for the same package.