Skip to content

Commit 7e240d8

Browse files
authored
Merge pull request #43 from lucidworks/use_log4j2
Update Solr 7.4.0 logging templates to log4j2
2 parents 78bb852 + cdcac78 commit 7e240d8

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed

src/main/mpack/common-services/SOLR/7.4.0/configuration/solr-config-env.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@
139139
# Solr provides a default Log4J configuration properties file in server/resources
140140
# however, you may want to customize the log settings and file appender location
141141
# so you can point the script to use a different log4j.properties file
142-
LOG4J_PROPS={{solr_config_conf_dir}}/log4j.properties
142+
LOG4J_PROPS={{solr_config_conf_dir}}/log4j2.xml
143143

144144
# Changes the logging level. Valid values: ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Default is INFO
145-
# This is an alternative to changing the rootLogger in log4j.properties
145+
# This is an alternative to changing the rootLogger in log4j2.xml
146146
#SOLR_LOG_LEVEL=INFO
147147

148148
# Location where Solr should write logs to. Absolute or relative to solr start dir
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0"?>
2+
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
3+
4+
<configuration supports_final="false" supports_adding_forbidden="true">
5+
6+
<property>
7+
<name>content</name>
8+
<description>Custom log4j2.xml</description>
9+
<value>
10+
<![CDATA[
11+
<?xml version="1.0" encoding="UTF-8"?>
12+
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <Configuration>
13+
<Appenders>
14+
15+
<Console name="STDOUT" target="SYSTEM_OUT">
16+
<PatternLayout>
17+
<Pattern>
18+
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
19+
</Pattern>
20+
</PatternLayout>
21+
</Console>
22+
23+
<RollingFile
24+
name="RollingFile"
25+
fileName="{{solr_config_log_dir}}/solr.log"
26+
filePattern="{{solr_config_log_dir}}/solr.log.%i" >
27+
<PatternLayout>
28+
<Pattern>
29+
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
30+
</Pattern>
31+
</PatternLayout>
32+
<Policies>
33+
<OnStartupTriggeringPolicy />
34+
<SizeBasedTriggeringPolicy size="32 MB"/>
35+
</Policies>
36+
<DefaultRolloverStrategy max="10"/>
37+
</RollingFile>
38+
39+
<RollingFile
40+
name="SlowFile"
41+
fileName="{{solr_config_log_dir}}/solr_slow_requests.log"
42+
filePattern="{{solr_config_log_dir}}/solr_slow_requests.log.%i" >
43+
<PatternLayout>
44+
<Pattern>
45+
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
46+
</Pattern>
47+
</PatternLayout>
48+
<Policies>
49+
<OnStartupTriggeringPolicy />
50+
<SizeBasedTriggeringPolicy size="32 MB"/>
51+
</Policies>
52+
<DefaultRolloverStrategy max="10"/>
53+
</RollingFile>
54+
55+
</Appenders>
56+
<Loggers>
57+
<Logger name="org.apache.hadoop" level="warn"/>
58+
<Logger name="org.apache.solr.update.LoggingInfoStream" level="off"/>
59+
<Logger name="org.apache.zookeeper" level="warn"/>
60+
<Logger name="org.apache.solr.core.SolrCore.SlowRequest" level="info" additivity="false">
61+
<AppenderRef ref="SlowFile"/>
62+
</Logger>
63+
64+
<Root level="info">
65+
<AppenderRef ref="RollingFile"/>
66+
<AppenderRef ref="STDOUT"/>
67+
</Root>
68+
</Loggers>
69+
</Configuration>]]>
70+
</value>
71+
<value-attributes>
72+
<type>content</type>
73+
<show-property-name>false</show-property-name>
74+
</value-attributes>
75+
</property>
76+
</configuration>

src/main/mpack/common-services/SOLR/7.4.0/package/scripts/setup_solr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def setup_solr():
3434
)
3535

3636
File(
37-
format("{solr_config_conf_dir}/log4j.properties"),
37+
format("{solr_config_conf_dir}/log4j2.xml"),
3838
content=InlineTemplate(params.log4j_properties),
3939
owner=params.solr_config_user
4040
)

0 commit comments

Comments
 (0)