|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | | -<!-- Logging configuration for DSpace container (matches log4j2.xml but to console, removing file refs & most comments) --> |
| 2 | +<!-- Logging configuration for DSpace container. |
| 3 | +
|
| 4 | + Writes [dspace.dir]/log/dspace.log exactly like log4j2.xml does outside of a container, and |
| 5 | + mirrors the same events to stdout so that "docker logs" keeps working. Point the container at |
| 6 | + this file with the LOGGING_CONFIG environment variable (see docker-compose-rest.yml). |
| 7 | +
|
| 8 | + NOTE: /dspace/log only survives a container recreate when it is mounted as a volume. --> |
3 | 9 | <Configuration strict='true' |
4 | 10 | xmlns='http://logging.apache.org/log4j/2.0/config'> |
5 | 11 |
|
6 | 12 | <Properties> |
| 13 | + <!-- Log file directory. "dspace.dir" is fixed to /dspace in the image (see Dockerfile), |
| 14 | + so the log directory is /dspace/log. Override with the DSPACE_LOG_DIR env variable |
| 15 | + when the container installs DSpace somewhere else. --> |
| 16 | + <Property name='log.dir'>${env:DSPACE_LOG_DIR:-/dspace/log}</Property> |
| 17 | + |
| 18 | + <!-- Log level for all DSpace-specific code (org.dspace.*) |
| 19 | + Possible values (from most to least info): |
| 20 | + DEBUG, INFO, WARN, ERROR, FATAL --> |
7 | 21 | <Property name='loglevel.dspace'>INFO</Property> |
| 22 | + |
| 23 | + <!-- Log level for other third-party tools/APIs used by DSpace |
| 24 | + Possible values (from most to least info): |
| 25 | + DEBUG, INFO, WARN, ERROR, FATAL --> |
8 | 26 | <Property name='loglevel.other'>INFO</Property> |
| 27 | + |
| 28 | + <!-- Level of the copy that is echoed to the container console ("docker logs"). |
| 29 | + dspace.log always receives everything; raise this to WARN, or set it to OFF, to keep |
| 30 | + the container output small once dspace.log is being collected. --> |
| 31 | + <Property name='loglevel.console'>${env:DSPACE_LOG_CONSOLE_LEVEL:-INFO}</Property> |
9 | 32 | </Properties> |
10 | 33 |
|
11 | 34 | <Appenders> |
12 | 35 | <!-- A1 is for most DSpace activity --> |
13 | 36 | <Appender name='A1' |
14 | | - type='Console' |
| 37 | + filePattern='${log.dir}/dspace.log-%d{yyyy-MM-dd}' |
| 38 | + type='RollingFile' |
| 39 | + fileName='${log.dir}/dspace.log' |
15 | 40 |
|
16 | 41 | > |
| 42 | + <!-- NOTE: The %equals patterns are providing a default value of "unknown" if "correlationID" or |
| 43 | + "requestID" are not currently set in the ThreadContext. --> |
| 44 | + <Layout type='PatternLayout' |
| 45 | + pattern='%d %-5p %equals{%X{correlationID}}{}{unknown} %equals{%X{requestID}}{}{unknown} %c @ %m%n'/> |
| 46 | + <policies> |
| 47 | + <policy type='TimeBasedTriggeringPolicy'>yyyy-MM-dd</policy> |
| 48 | + </policies> |
| 49 | + <!-- Sample deletion policy: keep last 30 archived files |
| 50 | + <DefaultRolloverStrategy> |
| 51 | + <Delete basePath='${log.dir}'> |
| 52 | + <IfFileName glob='dspace.log-*'/> |
| 53 | + <IfAccumulatedFileCount exceeds='30'/> |
| 54 | + </Delete> |
| 55 | + </DefaultRolloverStrategy> |
| 56 | + --> |
| 57 | + </Appender> |
| 58 | + |
| 59 | + <!-- STDOUT echoes A1 to the container console, so that "docker logs" is not blind --> |
| 60 | + <Appender name='STDOUT' |
| 61 | + type='Console'> |
17 | 62 | <Layout type='PatternLayout' |
18 | 63 | pattern='%d %-5p %equals{%X{correlationID}}{}{unknown} %equals{%X{requestID}}{}{unknown} %c @ %m%n'/> |
| 64 | + <Filters> |
| 65 | + <Filter type='ThresholdFilter' |
| 66 | + level='${loglevel.console}'/> |
| 67 | + </Filters> |
19 | 68 | </Appender> |
20 | 69 |
|
21 | 70 | <!-- A2 is for the checksum checker --> |
|
33 | 82 | level='${loglevel.dspace}' |
34 | 83 | additivity='false'> |
35 | 84 | <AppenderRef ref='A1'/> |
| 85 | + <AppenderRef ref='STDOUT'/> |
36 | 86 | </Logger> |
37 | 87 |
|
38 | 88 | <!-- The checksum checker --> |
|
60 | 110 | <!-- Anything not a part of DSpace --> |
61 | 111 | <Root level='${loglevel.other}'> |
62 | 112 | <AppenderRef ref='A1'/> |
| 113 | + <AppenderRef ref='STDOUT'/> |
63 | 114 | </Root> |
64 | 115 | </Loggers> |
65 | 116 | </Configuration> |
0 commit comments