IGNITE-1807 Visor cmd write logs to file in quite mode. - Fixes #192.

Signed-off-by: Andrey <anovi...@gridgain.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/73932274
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/73932274
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/73932274

Branch: refs/heads/ignite-638
Commit: 7393227477d2dfeb7ce4925fee9945ed6bb80127
Parents: 354358c
Author: Andrey <anovi...@gridgain.com>
Authored: Mon Nov 9 10:52:31 2015 +0700
Committer: Andrey <anovi...@gridgain.com>
Committed: Mon Nov 9 10:52:31 2015 +0700

----------------------------------------------------------------------
 .../ignite/visor/commands/open/VisorOpenCommand.scala | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/73932274/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
----------------------------------------------------------------------
diff --git 
a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
 
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
index 7d2ee3c..1cfbde4 100644
--- 
a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
+++ 
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
@@ -19,6 +19,8 @@
 
 package org.apache.ignite.visor.commands.open
 
+import java.util.logging.{ConsoleHandler, Logger}
+
 import org.apache.ignite.IgniteSystemProperties._
 import org.apache.ignite.configuration.IgniteConfiguration
 import org.apache.ignite.internal.IgniteComponentType._
@@ -26,7 +28,6 @@ import org.apache.ignite.internal.IgniteEx
 import org.apache.ignite.internal.util.scala.impl
 import org.apache.ignite.internal.util.spring.IgniteSpringHelper
 import org.apache.ignite.internal.util.{IgniteUtils => U}
-import org.apache.ignite.logger.NullLogger
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi
 import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, 
VisorTextTable}
 import org.apache.ignite.visor.visor._
@@ -158,6 +159,13 @@ class VisorOpenCommand extends VisorConsoleCommand {
 
                 val cfg = cfgs.iterator().next()
 
+                if (log4jTup != null)
+                    
System.setProperty(IgniteSystemProperties.IGNITE_CONSOLE_APPENDER, "false")
+                else
+                    Logger.getGlobal.getHandlers.foreach({
+                        case handler: ConsoleHandler => 
Logger.getGlobal.removeHandler(handler)
+                    })
+
                 // Setting up 'Config URL' for properly print in console.
                 System.setProperty(IgniteSystemProperties.IGNITE_CONFIG_URL, 
url.getPath)
 
@@ -236,10 +244,6 @@ class VisorOpenCommand extends VisorConsoleCommand {
         // Make sure visor starts without shutdown hook.
         System.setProperty(IGNITE_NO_SHUTDOWN_HOOK, "true")
 
-        // Set NullLoger in quite mode.
-        if ("true".equalsIgnoreCase(sys.props.getOrElse(IGNITE_QUIET, "true")))
-            cfg.setGridLogger(new NullLogger)
-
         ignite = try {
             // We need to stop previous daemon node before to start new one.
             prevIgnite.foreach(g => Ignition.stop(g.name(), true))

Reply via email to