public static Logger logger_name = Logger.getLogger(classname.class);
PropertyConfigurator.configure(System.getProperty("user.dir") + "\\config\\log4j.properties");
EX:
public static Logger APP_LOGS = Logger.getLogger(DriverScript.class.getName());
log4j.properties:
# Define the root logger with appender file
# Define the layout for file appender
(HTMLLayout OR PatternLayout)
PropertyConfigurator.configure(System.getProperty("user.dir") + "\\config\\log4j.properties");
EX:
public static Logger APP_LOGS = Logger.getLogger(DriverScript.class.getName());
log4j.properties:
# Define the root logger with appender file
log = TestOutput/Logs
log4j.rootLogger = INFO, FILE
# log4j.rootLogger = INFO,console, FILE ( To print all logging messages to both the console and a log file)
# Define the file appender(RollingFileAppender OR ConsoleAppender(to print in console))
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=${log}/SFDCTests.html
# Constrole the maximum log file size
log4j.appender.FILE.File=${log}/SFDCTests.html
# Constrole the maximum log file size
log4j.appender.FILE.maxFileSize=10000KB
# Archive log files (one backup file here)
# Archive log files (one backup file here)
log4j.appender.FILE.maxBackupIndex=3
# Define the layout for file appender
(HTMLLayout OR PatternLayout)
log4j.appender.FILE.layout=org.apache.log4j.HTMLLayout
log4j.appender.FILE.layout.Title=Logger For SFDC Test Cases
log4j.appender.FILE.layout.LocationInfo=true
#do not append the old file. Create a new log file everytime
log4j.appender.FILE.Append=false
#Prevent internal log4j DEBUG messages from polluting the output.
#log4j.logger.org.apache.log4j.PropertyConfigurator=INFO
#log4j.logger.org.apache.log4j.config.PropertySetter=INFO
#log4j.logger.org.apache.log4j.FileAppender=INFO
No comments:
Post a Comment