-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathlog4j.properties
65 lines (55 loc) · 2.89 KB
/
log4j.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# OBJECTIVES
# 1. Log file path and it's properties
# (i.e. max log file size, max backup index etc) to be defined
# 2. Two log files will get generated for two different packages
# 3. The log will get printed on the CONSOLE as well
# 4. Use of custom log file appender for the 2nd log file
# instead of the default one. Custom appender will add
# the time stamp with the log file
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#****************************************************
# Root logger option. To change log level, change here
# Log level is TRACE. Log will be printed on CONSOLE and
# log file as configured in log4j.appender.logfile
#****************************************************
log4j.rootLogger=TRACE, CONSOLE, logfile
#****************************************************
# Package logger option
# Log level is FATAL. Log will be printed on CONSOLE and
# log file as configured in log4j.appender.logfile
#****************************************************
log4j.logger.com.ashish.anotherpackage=FATAL, another
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Redirect log messages to CONSOLE
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
#*****
#Below configuration append "2015-05-21 16:06:42 <LEVEL> Log4JIntegration:16" before the message
#*****
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Redirect log messages to a log file, support file rolling.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=D:\\logs\\output.log
log4j.appender.logfile.Append=true
log4j.appender.logfile.MaxFileSize=2MB
log4j.appender.logfile.MaxBackupIndex=10
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
#*****
#Below configuration append "2015-05-21 16:06:42 <LEVEL> Log4JIntegration:16" before the message
#*****
log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Another Log file for another package
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
log4j.appender.another=com.ashish.customlog4j.CustomLog4JAppender
log4j.appender.another.File=D:\\logs\\output_another.log
log4j.appender.another.layout=org.apache.log4j.PatternLayout
#*****
#Below configuration append "2015-05-21 16:06:42 <LEVEL> Log4JIntegration:16" before the message
#*****
log4j.appender.another.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n