[jira] [Commented] (KARAF-5559) log:tail kills ssh & karaf when root logger is in DEBUG

2018-02-08 Thread JIRA

[ 
https://issues.apache.org/jira/browse/KARAF-5559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16357058#comment-16357058
 ] 

Jean-Baptiste Onofré commented on KARAF-5559:
-

On the client side (OpenSSH here in my case), we can see:

{code}
16:12:44.235 DEBUG [org.apache.karaf.shell.ssh.SshTerminal@7c509cb6 input pump 
thread] waitForSpace(Window[server/remote](ChannelSession[id=0, 
recipient=0]-ServerSessionImpl[karaf@/127.0.0.1:48326])) available: 1036840
{code}

On the Karaf side, we can see:

{code}
karaf@root()> 2018-02-08 16:12:44,231 sshd-SshServer[3debb172]-nio2-thread-2 
ERROR Recursive call to appender PaxOsgi
2018-02-08 16:12:44,232 sshd-SshServer[3debb172]-nio2-thread-2 ERROR Recursive 
call to appender PaxOsgi
2018-02-08 16:12:44,233 sshd-SshServer[3debb172]-nio2-thread-2 ERROR Recursive 
call to appender PaxOsgi
2018-02-08 16:12:44,233 sshd-SshServer[3debb172]-nio2-thread-2 ERROR Recursive 
call to appender PaxOsgi
{code}

In the log, we can see:

{code}
2018-02-08T16:12:44,236 | DEBUG | 
org.apache.karaf.shell.ssh.SshTerminal@7c509cb6 input pump thread | Window  
 | 37 - org.apache.sshd.core - 1.7.0 | 
waitForSpace(Window[server/remote](ChannelSession[id=0, 
recipient=0]-ServerSessionImpl[karaf@/127.0.0.1:48326])) available: 1036840
2018-02-08T16:12:44,236 | DEBUG | 
org.apache.karaf.shell.ssh.SshTerminal@7c509cb6 input pump thread | Window  
 | 37 - org.apache.sshd.core - 1.7.0 | 
waitAndConsume(Window[server/remote](ChannelSession[id=0, 
recipient=0]-ServerSessionImpl[karaf@/127.0.0.1:48326])) - requested=253, 
available=1036840
2018-02-08T16:12:44,236 | DEBUG | 
org.apache.karaf.shell.ssh.SshTerminal@7c509cb6 input pump thread | Nio2Session 
 | 37 - org.apache.sshd.core - 1.7.0 | 
writePacket(Nio2Session[local=/127.0.0.1:8101, remote=/127.0.0.1:48326]) 
Writing 320 bytes
2018-02-08T16:12:44,236 | DEBUG | 
org.apache.karaf.shell.ssh.SshTerminal@7c509cb6 input pump thread | Window  
 | 37 - org.apache.sshd.core - 1.7.0 | 
waitForSpace(Window[server/remote](ChannelSession[id=0, 
recipient=0]-ServerSessionImpl[karaf@/127.0.0.1:48326])) available: 1036587
2018-02-08T16:12:44,236 | DEBUG | 
org.apache.karaf.shell.ssh.SshTerminal@7c509cb6 input pump thread | Window  
 | 37 - org.apache.sshd.core - 1.7.0 | 
waitAndConsume(Window[server/remote](ChannelSession[id=0, 
recipient=0]-ServerSessionImpl[karaf@/127.0.0.1:48326])) - requested=4, 
available=1036587
2018-02-08T16:12:44,237 | DEBUG | 
org.apache.karaf.shell.ssh.SshTerminal@7c509cb6 input pump thread | Nio2Session 
 | 37 - org.apache.sshd.core - 1.7.0 | 
writePacket(Nio2Session[local=/127.0.0.1:8101, remote=/127.0.0.1:48326]) 
Writing 80 bytes
2018-02-08T16:12:44,235 | DEBUG | 
org.apache.karaf.shell.ssh.SshTerminal@7c509cb6 input pump thread | Window  
 | 37 - org.apache.sshd.core - 1.7.0 | 
waitForSpace(Window[server/remote](ChannelSession[id=0, 
recipient=0]-ServerSessionImpl[karaf@/127.0.0.1:48326])) available: 1036840
{code}

> log:tail kills ssh & karaf when root logger is in DEBUG
> ---
>
> Key: KARAF-5559
> URL: https://issues.apache.org/jira/browse/KARAF-5559
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf-logging, karaf-shell
>Affects Versions: 4.1.4, 4.2.0.M2
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
>Priority: Major
> Fix For: 4.2.0, 4.1.5
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KARAF-5559) log:tail kills ssh & karaf when root logger is in DEBUG

2018-02-09 Thread JIRA

[ 
https://issues.apache.org/jira/browse/KARAF-5559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16358370#comment-16358370
 ] 

Jean-Baptiste Onofré commented on KARAF-5559:
-

Actually, it's a normal behavior as SSHD shows the commands in DEBUG, and as we 
are connected using SSH, we are in an infinite loop.
To avoid this, the sshd logger itself should not be in DEBUG. A possible 
improvement is to set sshd logger to WARN in {{log:display}} and {{log:tail}} 
commands to avoid this behavior.

> log:tail kills ssh & karaf when root logger is in DEBUG
> ---
>
> Key: KARAF-5559
> URL: https://issues.apache.org/jira/browse/KARAF-5559
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf-logging, karaf-shell
>Affects Versions: 4.1.4, 4.2.0.M2
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
>Priority: Major
> Fix For: 4.2.0, 4.1.5
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KARAF-5559) log:tail kills ssh & karaf when root logger is in DEBUG

2018-02-09 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-5559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16359277#comment-16359277
 ] 

ASF GitHub Bot commented on KARAF-5559:
---

jbonofre opened a new pull request #448: [KARAF-5559] Change the sshd log level 
in log:tail & log:display commands to avoid infinite loop using ssh
URL: https://github.com/apache/karaf/pull/448
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> log:tail kills ssh & karaf when root logger is in DEBUG
> ---
>
> Key: KARAF-5559
> URL: https://issues.apache.org/jira/browse/KARAF-5559
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf-logging, karaf-shell
>Affects Versions: 4.1.4, 4.2.0.M2
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
>Priority: Major
> Fix For: 4.2.0, 4.1.5
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KARAF-5559) log:tail kills ssh & karaf when root logger is in DEBUG

2018-02-10 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-5559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16359320#comment-16359320
 ] 

ASF subversion and git services commented on KARAF-5559:


Commit 678177241a3b03181490ba4a942e99b7745ba055 in karaf's branch 
refs/heads/master from [~jbonofre]
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=6781772 ]

[KARAF-5559] Change the sshd log level in log:tail & log:display commands to 
avoid infinite loop with ssh


> log:tail kills ssh & karaf when root logger is in DEBUG
> ---
>
> Key: KARAF-5559
> URL: https://issues.apache.org/jira/browse/KARAF-5559
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf-logging, karaf-shell
>Affects Versions: 4.1.4, 4.2.0.M2
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
>Priority: Major
> Fix For: 4.2.0, 4.1.5
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KARAF-5559) log:tail kills ssh & karaf when root logger is in DEBUG

2018-02-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-5559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16359319#comment-16359319
 ] 

ASF GitHub Bot commented on KARAF-5559:
---

jbonofre closed pull request #448: [KARAF-5559] Change the sshd log level in 
log:tail & log:display commands to avoid infinite loop using ssh
URL: https://github.com/apache/karaf/pull/448
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.logging.cfg
 
b/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.logging.cfg
index 6cd8240fa6..ec0b7737fc 100644
--- 
a/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.logging.cfg
+++ 
b/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.logging.cfg
@@ -43,6 +43,10 @@ log4j2.rootLogger.appenderRef.Console.filter.threshold.level 
= ${karaf.log.conso
 
 # Loggers configuration
 
+# SSHD logger
+log4j2.logger.sshd.name = org.apache.sshd
+log4j2.logger.sshd.level = INFO
+
 # Spifly logger
 log4j2.logger.spifly.name = org.apache.aries.spifly
 log4j2.logger.spifly.level = WARN
diff --git a/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java 
b/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java
index 076b8ecbab..16a3296c90 100644
--- a/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java
+++ b/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java
@@ -42,6 +42,8 @@
 public final static int INFO_INT  = 6;
 public final static int DEBUG_INT = 7;
 
+private final static String SSHD_LOGGER = "org.apache.sshd";
+
 @Option(name = "-n", aliases = {}, description="Number of entries to 
display", required = false, multiValued = false)
 int entries;
 
@@ -68,8 +70,11 @@
 public Object execute() throws Exception {
 final PrintStream out = System.out;
 int minLevel = getMinLevel(level);
+String sshdLoggerLevel = 
logService.getLevel(SSHD_LOGGER).get(SSHD_LOGGER);
+logService.setLevel(SSHD_LOGGER, "ERROR");
 display(out, minLevel);
 out.println();
+logService.setLevel(SSHD_LOGGER, sshdLoggerLevel);
 return null;
 }
 
diff --git a/log/src/main/java/org/apache/karaf/log/command/LogTail.java 
b/log/src/main/java/org/apache/karaf/log/command/LogTail.java
index dc67e2627e..7d4ab50b69 100644
--- a/log/src/main/java/org/apache/karaf/log/command/LogTail.java
+++ b/log/src/main/java/org/apache/karaf/log/command/LogTail.java
@@ -74,7 +74,12 @@ private synchronized void stopTail() {
  * Track LogService dynamically so we can react when the log core bundle 
stops even while we block for the tail
  */
 private final class LogServiceTracker extends ServiceTracker {
+
+private final static String SSHD_LOGGER = "org.apache.sshd";
+
 private final PaxAppender appender;
+
+private String sshdLoggerLevel;
 
 private LogServiceTracker(BundleContext context, Class 
clazz,
   ServiceTrackerCustomizer customizer,
@@ -86,12 +91,17 @@ private LogServiceTracker(BundleContext context, 
Class clazz,
 @Override
 public LogService addingService(ServiceReference 
reference) {
 LogService service = super.addingService(reference);
+sshdLoggerLevel = service.getLevel(SSHD_LOGGER).get(SSHD_LOGGER);
+service.setLevel(SSHD_LOGGER, "ERROR");
 service.addAppender(appender);
 return service;
 }
 
 @Override
 public void removedService(ServiceReference reference, 
LogService service) {
+if (sshdLoggerLevel != null) {
+service.setLevel(SSHD_LOGGER, sshdLoggerLevel);
+}
 service.removeAppender(appender);
 stopTail();
 }


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> log:tail kills ssh & karaf when root logger is in DEBUG
> ---
>
> Key: KARAF-5559
> URL: https://issues.apache.org/jira/browse/KARAF-5559
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf-logging, karaf-shell
>Affects Versions: 4.1.4, 4.2.0.M2
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
>Priority: Major
> F

[jira] [Commented] (KARAF-5559) log:tail kills ssh & karaf when root logger is in DEBUG

2018-02-10 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-5559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16359321#comment-16359321
 ] 

ASF subversion and git services commented on KARAF-5559:


Commit 2a30a99243bb47c5bbe90aef9d864d3e0b248ec6 in karaf's branch 
refs/heads/karaf-4.1.x from [~jbonofre]
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=2a30a99 ]

[KARAF-5559] Change the sshd log level in log:tail & log:display commands to 
avoid infinite loop with ssh


> log:tail kills ssh & karaf when root logger is in DEBUG
> ---
>
> Key: KARAF-5559
> URL: https://issues.apache.org/jira/browse/KARAF-5559
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf-logging, karaf-shell
>Affects Versions: 4.1.4, 4.2.0.M2
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
>Priority: Major
> Fix For: 4.2.0, 4.1.5
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)