Skip to content

Commit

Permalink
# ignite-788: review
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutakGG committed Jul 24, 2015
1 parent 6894a87 commit 928c5e2
Show file tree
Hide file tree
Showing 15 changed files with 784 additions and 483 deletions.
5 changes: 5 additions & 0 deletions RELEASE_NOTES.txt
@@ -1,6 +1,11 @@
Apache Ignite Release Notes Apache Ignite Release Notes
=========================== ===========================


Apache Ignite In-Memory Data Fabric 1.4
---------------------------------------
* Added support for log4j2.


Apache Ignite In-Memory Data Fabric 1.3 Apache Ignite In-Memory Data Fabric 1.3
--------------------------------------- ---------------------------------------


Expand Down
5 changes: 5 additions & 0 deletions assembly/release-base.xml
Expand Up @@ -42,6 +42,11 @@
<outputDirectory>/config</outputDirectory> <outputDirectory>/config</outputDirectory>
</file> </file>


<file>
<source>config/ignite-log4j2.xml</source>
<outputDirectory>/config</outputDirectory>
</file>

<file> <file>
<source>config/java.util.logging.properties</source> <source>config/java.util.logging.properties</source>
<outputDirectory>/config</outputDirectory> <outputDirectory>/config</outputDirectory>
Expand Down
114 changes: 65 additions & 49 deletions config/ignite-log4j2.xml
Expand Up @@ -7,59 +7,75 @@
The ASF licenses this file to You under the Apache License, Version 2.0 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 not use this file except in compliance with
the License. You may obtain a copy of the License at the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
Configuration file for apache ignite 2 -->
-->
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" <Configuration>
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"> <Appenders>
<Configuration status="debug" strict="true" name="XMLConfigTest" <Console name="CONSOLE" target="SYSTEM_OUT">
packages="org.apache.ignite.logger.log4j2"> <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
<Filter type="ThresholdFilter" level="TRACE"/> <ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
<Appenders> </Console>
<Appender type="Console" name="CONSOLE_ERR">
</Appender> <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
<Routing name="Routing"> <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
<Routes pattern="$${ctx:ROUTINGKEY}"> </Console>
<Route key="$${ctx:ROUTINGKEY}">
<RollingFile name="Rolling-default" fileName="work/log/ignite.log" <Routing name="FILE">
filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz"> <Routes pattern="$${sys:nodeId}">
<PatternLayout> <Route>
<pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern> <RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
</PatternLayout> filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
<Policies> <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
<TimeBasedTriggeringPolicy interval="6" modulate="true" /> <Policies>
<SizeBasedTriggeringPolicy size="10 MB" /> <TimeBasedTriggeringPolicy interval="6" modulate="true" />
</Policies> <SizeBasedTriggeringPolicy size="10 MB" />
</RollingFile> </Policies>
</Route> </RollingFile>
<Route> </Route>
<RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log" </Routes>
filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz"> </Routing>
<PatternLayout> </Appenders>
<pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
</PatternLayout> <Loggers>
<Policies> <!--
<TimeBasedTriggeringPolicy interval="6" modulate="true" /> <Logger name="org.apache.ignite" level=DEBUG/>
<SizeBasedTriggeringPolicy size="10 MB" /> -->
</Policies>
</RollingFile> <!--
</Route> Uncomment to disable courtesy notices, such as SPI configuration
</Routes> consistency warnings.
</Routing> -->
</Appenders> <!--
<Loggers> <Logger name="org.apache.ignite.CourtesyConfigNotice" level=OFF/>
<Logger name="org.springframework" level="warn"/> -->
<Logger name="rg.eclipse.jetty" level="warn"/>
<Logger name="org.eclipse.jetty.util.log" level="warn"/> <Logger name="org.springframework" level="WARN"/>
<Logger name="org.eclipse.jetty.util.component" level="warn"/> <Logger name="org.eclipse.jetty" level="WARN"/>
<Logger name="com.amazonaws" level="warn"/>
<Root level="TRACE"> <!--
<AppenderRef ref="Routing"/> Avoid warnings about failed bind attempt when multiple nodes running on the same host.
</Root> -->
</Loggers> <Logger name="org.eclipse.jetty.util.log" level="ERROR"/>
<Logger name="org.eclipse.jetty.util.component" level="ERROR"/>

<Logger name="com.amazonaws" level="WARN"/>

<Root level="INFO">
<!-- Uncomment to enable logging to console. -->
<!--
<AppenderRef ref="CONSOLE" level="DEBUG"/>
-->

<AppenderRef ref="CONSOLE_ERR" level="ERROR"/>
<AppenderRef ref="FILE" level="DEBUG"/>
</Root>
</Loggers>
</Configuration> </Configuration>
Expand Up @@ -1487,13 +1487,25 @@ private void ackConfigUrl() {
private void ackAsciiLogo() { private void ackAsciiLogo() {
assert log != null; assert log != null;


String fileName = log.fileName();

if (System.getProperty(IGNITE_NO_ASCII) == null) { if (System.getProperty(IGNITE_NO_ASCII) == null) {
String ver = "ver. " + ACK_VER_STR; String ver = "ver. " + ACK_VER_STR;


// Big thanks to: http://patorjk.com/software/taag // Big thanks to: http://patorjk.com/software/taag
// Font name "Small Slant" // Font name "Small Slant"
if (log.isInfoEnabled()) {
log.info(NL + NL +
">>> __________ ________________ " + NL +
">>> / _/ ___/ |/ / _/_ __/ __/ " + NL +
">>> _/ // (7 7 // / / / / _/ " + NL +
">>> /___/\\___/_/|_/___/ /_/ /___/ " + NL +
">>> " + NL +
">>> " + ver + NL +
">>> " + COPYRIGHT + NL +
">>> " + NL +
">>> Ignite documentation: " + "http://" + SITE + NL
);
}

if (log.isQuiet()) { if (log.isQuiet()) {
U.quiet(false, U.quiet(false,
" __________ ________________ ", " __________ ________________ ",
Expand All @@ -1508,27 +1520,15 @@ private void ackAsciiLogo() {
"", "",
"Quiet mode."); "Quiet mode.");


String fileName = log.fileName();

if (fileName != null) if (fileName != null)
U.quiet(false, " ^-- Logging to file '" + fileName + '\''); U.quiet(false, " ^-- Logging to file '" + fileName + '\'');


U.quiet(false, U.quiet(false,
" ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or \"-v\" to ignite.{sh|bat}", " ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or \"-v\" to ignite.{sh|bat}",
""); "");
} }

if (log.isInfoEnabled()) {
log.info(NL + NL +
">>> __________ ________________ " + NL +
">>> / _/ ___/ |/ / _/_ __/ __/ " + NL +
">>> _/ // (7 7 // / / / / _/ " + NL +
">>> /___/\\___/_/|_/___/ /_/ /___/ " + NL +
">>> " + NL +
">>> " + ver + NL +
">>> " + COPYRIGHT + NL +
">>> " + NL +
">>> Ignite documentation: " + "http://" + SITE + NL
);
}
} }
} }


Expand Down Expand Up @@ -2730,8 +2730,7 @@ private void checkNearCacheStarted(IgniteCacheProxy<?, ?> cache) throws IgniteCh
@Nullable @Override public <T, S> IgniteAtomicStamped<T, S> atomicStamped(String name, @Nullable @Override public <T, S> IgniteAtomicStamped<T, S> atomicStamped(String name,
@Nullable T initVal, @Nullable T initVal,
@Nullable S initStamp, @Nullable S initStamp,
boolean create) boolean create) {
{
guard(); guard();


try { try {
Expand All @@ -2749,8 +2748,7 @@ private void checkNearCacheStarted(IgniteCacheProxy<?, ?> cache) throws IgniteCh
@Nullable @Override public IgniteCountDownLatch countDownLatch(String name, @Nullable @Override public IgniteCountDownLatch countDownLatch(String name,
int cnt, int cnt,
boolean autoDel, boolean autoDel,
boolean create) boolean create) {
{
guard(); guard();


try { try {
Expand Down
88 changes: 41 additions & 47 deletions modules/core/src/test/config/log4j2-test.xml
@@ -1,63 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>

<!-- <!--
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership. this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0 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 not use this file except in compliance with
the License. You may obtain a copy of the License at the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"> <Configuration>
<Configuration status="debug" strict="true" name="XMLConfigTest" <Appenders>
packages="org.apache.ignite.logger.log4j2"> <Console name="CONSOLE" target="SYSTEM_OUT">
<Filter type="ThresholdFilter" level="TRACE"/> <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
<Appenders> <ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
<Appender type="Console" name="CONSOLE_ERR"> </Console>
</Appender>
<Routing name="Routing"> <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
<Routes pattern="$${ctx:ROUTINGKEY}"> <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
<Route key="$${ctx:ROUTINGKEY}"> </Console>
<RollingFile name="Rolling-default" fileName="work/log/ignite.log"
filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz"> <Routing name="FILE">
<PatternLayout> <Routes pattern="$${sys:nodeId}">
<pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern> <Route>
</PatternLayout> <RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
<Policies> filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
<TimeBasedTriggeringPolicy interval="6" modulate="true" /> <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
<SizeBasedTriggeringPolicy size="10 MB" /> <Policies>
</Policies> <TimeBasedTriggeringPolicy interval="6" modulate="true" />
</RollingFile> <SizeBasedTriggeringPolicy size="10 MB" />
</Route> </Policies>
<Route> </RollingFile>
<RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log" </Route>
filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz"> </Routes>
<PatternLayout> </Routing>
<pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern> </Appenders>
</PatternLayout>
<Policies> <Loggers>
<TimeBasedTriggeringPolicy interval="6" modulate="true" /> <Logger name="org" level="INFO"/>
<SizeBasedTriggeringPolicy size="10 MB" /> <Logger name="org.eclipse.jetty" level="INFO"/>
</Policies>
</RollingFile> <Root level="INFO">
</Route> <AppenderRef ref="CONSOLE" level="DEBUG"/>
</Routes> <AppenderRef ref="CONSOLE_ERR" level="WARN"/>
</Routing> <AppenderRef ref="FILE" level="DEBUG"/>
</Appenders> </Root>
<Loggers> </Loggers>
<Logger name="org.springframework" level="warn"/>
<Logger name="rg.eclipse.jetty" level="warn"/>
<Logger name="org.eclipse.jetty.util.log" level="warn"/>
<Logger name="org.eclipse.jetty.util.component" level="warn"/>
<Logger name="com.amazonaws" level="warn"/>
<Root level="TRACE">
<AppenderRef ref="Routing"/>
</Root>
</Loggers>
</Configuration> </Configuration>
48 changes: 48 additions & 0 deletions modules/core/src/test/config/log4j2-verbose-test.xml
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
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>
<Appenders>
<Console name="CONSOLE_ERR" target="SYSTEM_ERR">
<PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
</Console>

<Routing name="FILE">
<Routes pattern="$${sys:nodeId}">
<Route>
<RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
<PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="6" modulate="true" />
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
</RollingFile>
</Route>
</Routes>
</Routing>
</Appenders>

<Loggers>
<Root level="INFO">
<AppenderRef ref="CONSOLE_ERR" level="WARN"/>
<AppenderRef ref="FILE" level="DEBUG"/>
</Root>
</Loggers>
</Configuration>
2 changes: 1 addition & 1 deletion modules/log4j/README.txt
@@ -1,7 +1,7 @@
Apache Ignite Log4J Module Apache Ignite Log4J Module
-------------------------- --------------------------


Apache Ignite Log4J module provides GridLogger implementation based on Apache Log4J. Apache Ignite Log4J module provides IgniteLogger implementation based on Apache Log4J.


To enable Log4J module when starting a standalone node, move 'optional/ignite-log4j' folder to To enable Log4J module when starting a standalone node, move 'optional/ignite-log4j' folder to
'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will 'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
Expand Down
Expand Up @@ -42,7 +42,7 @@
* Here is a typical example of configuring log4j logger in Ignite configuration file: * Here is a typical example of configuring log4j logger in Ignite configuration file:
* <pre name="code" class="xml"> * <pre name="code" class="xml">
* &lt;property name="gridLogger"&gt; * &lt;property name="gridLogger"&gt;
* &lt;bean class="org.apache.ignite.grid.logger.log4j.GridLog4jLogger"&gt; * &lt;bean class="org.apache.ignite.logger.log4j.Log4JLogger"&gt;
* &lt;constructor-arg type="java.lang.String" value="config/ignite-log4j.xml"/&gt; * &lt;constructor-arg type="java.lang.String" value="config/ignite-log4j.xml"/&gt;
* &lt;/bean> * &lt;/bean>
* &lt;/property&gt; * &lt;/property&gt;
Expand Down

0 comments on commit 928c5e2

Please sign in to comment.