1 | # See for basic example https://stackoverflow.com/questions/125 32339/no-appenders-could-be-found-for-loggerlog4j
|
---|
2 | # For better examples, see /greenstone/greenstone3/web/WEB-INF/classes/log4j.properties
|
---|
3 | # Manual (examples use XML versions of log4j config files): https://logging.apache.org/log4j/2.x/manual/configuration.html
|
---|
4 | # https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties
|
---|
5 | # HH (0-24 hrs) vs hh (0-12 hrs, am/pm): https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
|
---|
6 | # https://logging.apache.org/log4j/1.2/manual.html
|
---|
7 | #######################
|
---|
8 |
|
---|
9 | # define some reusable properties
|
---|
10 | maori-lang-detector.home=/Scratch/ak19/gs3-extensions/maori-lang-detection
|
---|
11 | maori-lang-detector.logpath=${maori-lang-detector.home}/logs
|
---|
12 |
|
---|
13 | # Let's log everything from the most basic DEBUG msgs on (so INFO, WARN, ERROR too)
|
---|
14 | # Also want to log to the console, see
|
---|
15 | # https://stackoverflow.com/questions/3382985/how-to-make-log4j-to-write-to-the-console-as-well
|
---|
16 |
|
---|
17 | log4j.rootCategory=DEBUG, console, mldlog
|
---|
18 |
|
---|
19 | # Define Console Appender
|
---|
20 | log4j.appender.console=org.apache.log4j.ConsoleAppender
|
---|
21 | # Define the layout for console appender. If you do not define it, you will get an error
|
---|
22 | log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
---|
23 | log4j.appender.console.Target=System.err
|
---|
24 |
|
---|
25 | # We're saying our log "mldlog" is some file that gets appended to,
|
---|
26 | # and it will write it out to "maori-lang-detector.log" located in whatever we defined the "logpath" to be
|
---|
27 |
|
---|
28 | # Old way of logging:
|
---|
29 | #log4j.appender.mldlog=org.apache.log4j.RollingFileAppender
|
---|
30 | #log4j.appender.mldlog.File=${maori-lang-detector.logpath}/maori-lang-detector.log
|
---|
31 | ## https://howtodoinjava.com/log4j/log4j-rolling-file-appender/
|
---|
32 | ##log4j.appender.mldlog.MaxBackupIndex=10
|
---|
33 |
|
---|
34 | # We want a DailyRollingFileAppender.
|
---|
35 | # Its behaviour is explained at
|
---|
36 | # https://examples.javacodegeeks.com/enterprise-java/log4j/log4j-rolling-daily-file-example/
|
---|
37 | log4j.appender.mldlog=org.apache.log4j.DailyRollingFileAppender
|
---|
38 | log4j.appender.mldlog.File=${maori-lang-detector.logpath}/maori-lang-detector.log
|
---|
39 | log4j.appender.mldlog.DatePattern='.'yyyy-MM-dd
|
---|
40 | # set to roll over every day, can change this to weekly/every min etc, see https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html
|
---|
41 |
|
---|
42 | # if you have more logs, define category, additivity, appender and appender.File for it as above
|
---|
43 | # for each log also set the format of the output as below, after setting the layout to use PatternLayout class to parse the format
|
---|
44 |
|
---|
45 | log4j.appender.mldlog.layout=org.apache.log4j.PatternLayout
|
---|
46 | log4j.appender.mldlog.layout.ConversionPattern=%-5p: [%d{yyyy-MM-dd HH:mm:ss}] %C{1}.%M()%n %m%n
|
---|
47 |
|
---|
48 | #######################
|
---|